From 06cc62042c2a67e15266f45829826677c15bc63d Mon Sep 17 00:00:00 2001 From: ahm3dgg Date: Thu, 8 Jan 2026 00:36:53 +0200 Subject: [PATCH] Serialize and Deserialize KnownDLLs Tables --- src/windows-emulator/process_context.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/windows-emulator/process_context.cpp b/src/windows-emulator/process_context.cpp index dad58b8e..c5646080 100644 --- a/src/windows-emulator/process_context.cpp +++ b/src/windows-emulator/process_context.cpp @@ -229,13 +229,10 @@ namespace } template - void create_known_dlls_section_objects(std::unordered_map& knowndlls_section_objects, - registry_manager& registry, const apiset::container& apiset_container, + void create_known_dlls_section_objects(knowndlls_map& knowndlls_section_objects, + std::unordered_map& apiset, registry_manager& registry, const file_system& file_system, bool is_wow64) { - const auto* api_set_data = reinterpret_cast(apiset_container.data.data()); - auto apiset = get_apiset_namespace_table(api_set_data); - windows_path system_root_path; std::filesystem::path local_system_root_path; @@ -574,8 +571,10 @@ void process_context::setup(x86_64_emulator& emu, memory_manager& memory, regist } } - create_known_dlls_section_objects(this->knowndlls32_sections, registry, apiset_container, file_system, true); - create_known_dlls_section_objects(this->knowndlls64_sections, registry, apiset_container, file_system, false); + const auto* api_set_data = reinterpret_cast(apiset_container.data.data()); + auto apiset = get_apiset_namespace_table(api_set_data); + create_known_dlls_section_objects(this->knowndlls32_sections, apiset, registry, file_system, true); + create_known_dlls_section_objects(this->knowndlls64_sections, apiset, registry, file_system, false); this->ntdll_image_base = ntdll.image_base; this->ldr_initialize_thunk = ntdll.find_export("LdrInitializeThunk"); @@ -652,6 +651,8 @@ void process_context::serialize(utils::buffer_serializer& buffer) const buffer.write(this->timers); buffer.write(this->registry_keys); buffer.write_map(this->atoms); + buffer.write_map(this->knowndlls32_sections); + buffer.write_map(this->knowndlls64_sections); buffer.write(this->last_extended_params_numa_node); buffer.write(this->last_extended_params_attributes); @@ -701,6 +702,8 @@ void process_context::deserialize(utils::buffer_deserializer& buffer) buffer.read(this->timers); buffer.read(this->registry_keys); buffer.read_map(this->atoms); + buffer.read_map(this->knowndlls32_sections); + buffer.read_map(this->knowndlls64_sections); buffer.read(this->last_extended_params_numa_node); buffer.read(this->last_extended_params_attributes);