@@ -193,32 +193,31 @@ void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer process, Enumerate
193193 for (auto j = it; j != std::end (sections); ++j)
194194 {
195195 if (sectionAddress >= reinterpret_cast <size_t >(j->BaseAddress )
196- && sectionAddress < reinterpret_cast <size_t >(j->BaseAddress ) + static_cast <size_t >(j->Size )
197- && sectionHeader.VirtualAddress + sectionHeader.Misc .VirtualSize <= me32. modBaseSize )
198- {
199- if ((sectionHeader.Characteristics & IMAGE_SCN_CNT_CODE) == IMAGE_SCN_CNT_CODE)
200- {
201- j->Category = SectionCategory::CODE;
202- }
203- else if (sectionHeader.Characteristics & (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_CNT_UNINITIALIZED_DATA))
204- {
205- j->Category = SectionCategory::DATA;
206- }
207-
208- try {
209- // Copy the name because it is not null padded.
210- char buffer[IMAGE_SIZEOF_SHORT_NAME + 1 ] = { 0 };
211- std::memcpy (buffer, sectionHeader.Name , IMAGE_SIZEOF_SHORT_NAME);
212- MultiByteToUnicode (buffer, j->Name , IMAGE_SIZEOF_SHORT_NAME);
213- } catch (std::range_error &) {
214- std::memset (j->Name , 0 , sizeof j->Name );
215- }
216- std::memcpy (j->ModulePath , me32. szExePath , std::min (MAX_PATH, PATH_MAXIMUM_LENGTH));
217-
218- break ;
219- }
196+ && sectionAddress < reinterpret_cast <size_t >(j->BaseAddress ) + static_cast <size_t >(j->Size )
197+ && sectionHeader.VirtualAddress + sectionHeader.Misc .VirtualSize <= data-> Size )
198+ {
199+ if ((sectionHeader.Characteristics & IMAGE_SCN_CNT_CODE) == IMAGE_SCN_CNT_CODE)
200+ {
201+ j->Category = SectionCategory::CODE;
202+ }
203+ else if (sectionHeader.Characteristics & (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_CNT_UNINITIALIZED_DATA))
204+ {
205+ j->Category = SectionCategory::DATA;
206+ }
207+
208+ try {
209+ // Copy the name because it is not null padded.
210+ char buffer[IMAGE_SIZEOF_SHORT_NAME + 1 ] = { 0 };
211+ std::memcpy (buffer, sectionHeader.Name , IMAGE_SIZEOF_SHORT_NAME);
212+ MultiByteToUnicode (buffer, j->Name , IMAGE_SIZEOF_SHORT_NAME);
213+ } catch (std::range_error &) {
214+ std::memset (j->Name , 0 , sizeof j->Name );
215+ }
216+ std::memcpy (j->ModulePath , data-> Path , std::min (MAX_PATH, PATH_MAXIMUM_LENGTH));
217+
218+ break ;
219+ }
220220 }
221-
222221 }
223222 }
224223 };
0 commit comments