From 73d82d9ee964fd98f4510e7efdf616d1f30066a1 Mon Sep 17 00:00:00 2001 From: ahm3dgg Date: Sun, 11 Jan 2026 01:12:37 +0200 Subject: [PATCH] NtOpenSection: Do Case-Insensitive String Comparison And Some Refactoring --- src/windows-emulator/process_context.cpp | 22 ++++++++++++---------- src/windows-emulator/process_context.hpp | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/windows-emulator/process_context.cpp b/src/windows-emulator/process_context.cpp index a498de94..21876f54 100644 --- a/src/windows-emulator/process_context.cpp +++ b/src/windows-emulator/process_context.cpp @@ -866,9 +866,11 @@ bool process_context::is_knowndll_section_exists(const std::u16string& name, boo if (is_32bit) { return knowndlls32_sections.contains(lname); + return knowndlls32_sections.contains(lname); } return knowndlls64_sections.contains(lname); + return knowndlls64_sections.contains(lname); } std::optional
process_context::get_knowndll_section_by_name(const std::u16string& name, bool is_32bit) const @@ -877,17 +879,17 @@ std::optional
process_context::get_knowndll_section_by_name(const std:: if (is_32bit) { - if (auto section = knowndlls32_sections.find(lname); section != knowndlls32_sections.end()) - { - return section->second; - } + if (auto section = knowndlls32_sections.find(lname); section != knowndlls32_sections.end()) + { + return section->second; + } } else { - if (auto section = knowndlls64_sections.find(lname); section != knowndlls64_sections.end()) - { - return section->second; - } + if (auto section = knowndlls64_sections.find(lname); section != knowndlls64_sections.end()) + { + return section->second; + } } return {}; @@ -899,10 +901,10 @@ void process_context::add_knowndll_section(const std::u16string& name, const sec if (is_32bit) { - this->knowndlls32_sections[lname] = section; + knowndlls32_sections[lname] = section; } else { - this->knowndlls64_sections[lname] = section; + knowndlls64_sections[lname] = section; } } diff --git a/src/windows-emulator/process_context.hpp b/src/windows-emulator/process_context.hpp index f34663be..60f283ec 100644 --- a/src/windows-emulator/process_context.hpp +++ b/src/windows-emulator/process_context.hpp @@ -90,9 +90,9 @@ struct process_context template void build_knowndlls_section_table(registry_manager& registry, const file_system& file_system, bool is_32bit); - std::optional
get_knowndll_section_by_name(const std::u16string& name, bool is_32bit) const; - void add_knowndll_section(const std::u16string& name, const section& section, bool is_32bit); - bool is_knowndll_section_exists(const std::u16string& name, bool is_32bit) const; + std::optional
get_knowndll_section_by_name(const std::u16string& name, bool is_32bit) const; + void add_knowndll_section(const std::u16string& name, const section& section, bool is_32bit); + bool is_knowndll_section_exists(const std::u16string& name, bool is_32bit) const; void serialize(utils::buffer_serializer& buffer) const; void deserialize(utils::buffer_deserializer& buffer);