Check if the known dll path exists first

This commit is contained in:
ahm3dgg
2026-01-06 09:57:33 +02:00
parent 725c7e3e9c
commit 67e130a3b8
3 changed files with 15 additions and 9 deletions

View File

@@ -177,7 +177,8 @@ namespace
return env_map;
}
void create_known_dlls_section_objects(std::unordered_map<std::u16string, section>& knowndlls_sections, const file_system& file_system, bool is_wow64)
void create_known_dlls_section_objects(std::unordered_map<std::u16string, section>& knowndlls_sections, const file_system& file_system,
bool is_wow64)
{
windows_path known_dlls_fs_root_path;
std::u16string known_dlls_objmgn_root_path;
@@ -218,8 +219,15 @@ namespace
section s{};
const auto known_dll_fs_path = known_dlls_fs_root_path / known_dll_name;
auto local_file = file_system.translate(known_dll_fs_path);
if (!std::filesystem::exists(local_file))
{
continue;
}
auto known_dll_objmgn_path = known_dlls_objmgn_root_path + u"\\" + known_dll_name;
const auto file_size = std::filesystem::file_size(file_system.translate(known_dll_fs_path));
const auto file_size = std::filesystem::file_size(local_file);
utils::string::to_lower_inplace(known_dll_objmgn_path);
s.name = known_dll_objmgn_path;

View File

@@ -70,9 +70,9 @@ struct process_context
{
}
void setup(x86_64_emulator& emu, memory_manager& memory, registry_manager& registry, const file_system& file_system, const application_settings& app_settings,
const mapped_module& executable, const mapped_module& ntdll, const apiset::container& apiset_container,
const mapped_module* ntdll32 = nullptr);
void setup(x86_64_emulator& emu, memory_manager& memory, registry_manager& registry, const file_system& file_system,
const application_settings& app_settings, const mapped_module& executable, const mapped_module& ntdll,
const apiset::container& apiset_container, const mapped_module* ntdll32 = nullptr);
handle create_thread(memory_manager& memory, uint64_t start_address, uint64_t argument, uint64_t stack_size, uint32_t create_flags,
bool initial_thread = false);

View File

@@ -225,10 +225,8 @@ namespace syscalls
return STATUS_NOT_SUPPORTED;
}
bool is_known_dll = (attributes.RootDirectory == KNOWN_DLLS_DIRECTORY
|| attributes.RootDirectory == KNOWN_DLLS32_DIRECTORY
|| filename.starts_with(u"\\KnownDlls")
|| filename.starts_with(u"\\KnownDlls32"));
bool is_known_dll = (attributes.RootDirectory == KNOWN_DLLS_DIRECTORY || attributes.RootDirectory == KNOWN_DLLS32_DIRECTORY ||
filename.starts_with(u"\\KnownDlls") || filename.starts_with(u"\\KnownDlls32"));
if (!is_known_dll && attributes.RootDirectory != BASE_NAMED_OBJECTS_DIRECTORY)
{