@@ -32,7 +32,7 @@ struct ArgumentManager {
32
32
void validateArguments (int argc, char * argv[]) {
33
33
34
34
namespace po = boost::program_options;
35
- std::string version = " v1.0.7 " ;
35
+ std::string version = " v1.0.8 " ;
36
36
po::options_description description (" Windows memory extractor " + version + " \n Usage" );
37
37
38
38
description.add_options ()
@@ -499,7 +499,15 @@ struct MemoryExtractionManager {
499
499
if (argumentManager.getIsJoinOptionSupplied ()) {
500
500
std::string fullModuleFilePath = directoryName + " /" + " joinedModuleContents.dmp" ;
501
501
std::ofstream fullModuleDataFile (fullModuleFilePath, std::ofstream::app | std::ofstream::binary);
502
+ if (nextAddressAfterModuleRegion != 0 && nextAddressAfterModuleRegion < reinterpret_cast <std::uintptr_t >(memInfo.BaseAddress )) {
503
+ // Insert padding if memory regions are not contiguous
504
+ SIZE_T paddingSize = reinterpret_cast <std::uintptr_t >(memInfo.BaseAddress ) - nextAddressAfterModuleRegion;
505
+ auto padding = std::make_unique<char []>(paddingSize);
506
+ memset (padding.get (), 0 , paddingSize);
507
+ fullModuleDataFile.write (padding.get (), paddingSize);
508
+ }
502
509
fullModuleDataFile.write (memoryContents.get (), memInfo.RegionSize );
510
+ nextAddressAfterModuleRegion = reinterpret_cast <std::uintptr_t >(memInfo.BaseAddress ) + memInfo.RegionSize ;
503
511
fullModuleDataFile.close ();
504
512
}
505
513
}
@@ -657,6 +665,7 @@ struct MemoryExtractionManager {
657
665
std::string directoryName; // The directory where the memory data files will be placed
658
666
bool isDirectoryCreated;
659
667
unsigned int dmpFilesGeneratedCount;
668
+ SIZE_T nextAddressAfterModuleRegion;
660
669
661
670
};
662
671
0 commit comments