diff --git a/src/windows-emulator/process_context.cpp b/src/windows-emulator/process_context.cpp index 1e2a8a0f..2573252c 100644 --- a/src/windows-emulator/process_context.cpp +++ b/src/windows-emulator/process_context.cpp @@ -177,7 +177,8 @@ namespace return env_map; } - void create_known_dlls_section_objects(std::unordered_map& knowndlls_sections, const file_system& file_system, bool is_wow64) + void create_known_dlls_section_objects(std::unordered_map& 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; diff --git a/src/windows-emulator/process_context.hpp b/src/windows-emulator/process_context.hpp index 86ae3dc1..f52fdf88 100644 --- a/src/windows-emulator/process_context.hpp +++ b/src/windows-emulator/process_context.hpp @@ -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); diff --git a/src/windows-emulator/syscalls/section.cpp b/src/windows-emulator/syscalls/section.cpp index 4c7e7d1e..b013b0d3 100644 --- a/src/windows-emulator/syscalls/section.cpp +++ b/src/windows-emulator/syscalls/section.cpp @@ -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) {