diff --git a/scanners/module_data.h b/scanners/module_data.h index 801496a7f..bed7a21f5 100644 --- a/scanners/module_data.h +++ b/scanners/module_data.h @@ -15,23 +15,21 @@ namespace pesieve { class ModuleData { public: - ModuleData(HANDLE _processHandle, HMODULE _module, bool _isPEBConnected, bool _useCache) + ModuleData(HANDLE _processHandle, HMODULE _module, bool _isPEBConnected, bool _useCache, const char* _moduleName = nullptr) : processHandle(_processHandle), moduleHandle(_module), isPEBConnected(_isPEBConnected), useCache(_useCache), is_module_named(false), original_size(0), original_module(nullptr), is_dot_net(false) { memset(szModName, 0, MAX_PATH); - loadModuleName(); - } - - ModuleData(HANDLE _processHandle, HMODULE _module, std::string module_name, bool _useCache) - : processHandle(_processHandle), moduleHandle(_module), useCache(_useCache), - is_module_named(false), original_size(0), original_module(nullptr), - is_dot_net(false) - { - memset(szModName, 0, MAX_PATH); - memcpy(this->szModName, module_name.c_str(), module_name.length()); + if (!_moduleName) { + loadModuleName(); + } + else { + const size_t nameLen = strnlen(_moduleName, MAX_PATH); + memcpy(this->szModName, _moduleName, nameLen); + } + } ~ModuleData() diff --git a/scanners/workingset_scanner.cpp b/scanners/workingset_scanner.cpp index 8d6ef1d22..35da48513 100644 --- a/scanners/workingset_scanner.cpp +++ b/scanners/workingset_scanner.cpp @@ -272,7 +272,7 @@ bool pesieve::WorkingSetScanner::scanImg(MemPageData& memPage) } //load module from file: - ModuleData modData(processHandle, module_start, memPage.mapped_name, args.use_cache); + ModuleData modData(processHandle, module_start, true, args.use_cache, memPage.mapped_name.c_str()); if (!modData.loadOriginal()) { if (!args.quiet) { std::cerr << "[-] [" << std::hex << modData.moduleHandle << "] Could not read the module file" << std::endl;