From d54c8bf9ca60cf07be37018bc6a400c2d6fedf28 Mon Sep 17 00:00:00 2001 From: ahm3dgg Date: Sun, 11 Jan 2026 00:15:22 +0200 Subject: [PATCH] NtOpenSection: Do Case-Insensitive String Comparison --- src/windows-emulator/process_context.cpp | 26 ++++++++++++------------ src/windows-emulator/process_context.hpp | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/windows-emulator/process_context.cpp b/src/windows-emulator/process_context.cpp index 71e836f9..a498de94 100644 --- a/src/windows-emulator/process_context.cpp +++ b/src/windows-emulator/process_context.cpp @@ -859,41 +859,41 @@ void process_context::build_knowndlls_section_table(registry_manager& registry, } } -bool process_context::is_knowndll_section_exists(const std::u16string& name, bool is_32bit) +bool process_context::is_knowndll_section_exists(const std::u16string& name, bool is_32bit) const { auto lname = utils::string::to_lower(name); if (is_32bit) { - return this->knowndlls32_sections.contains(lname); + return knowndlls32_sections.contains(lname); } - return this->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) +std::optional
process_context::get_knowndll_section_by_name(const std::u16string& name, bool is_32bit) const { auto lname = utils::string::to_lower(name); if (is_32bit) { - if (this->knowndlls32_sections.contains(lname)) - { - return this->knowndlls32_sections[lname]; - } + if (auto section = knowndlls32_sections.find(lname); section != knowndlls32_sections.end()) + { + return section->second; + } } else { - if (this->knowndlls64_sections.contains(lname)) - { - return this->knowndlls64_sections[lname]; - } + if (auto section = knowndlls64_sections.find(lname); section != knowndlls64_sections.end()) + { + return section->second; + } } return {}; } -void process_context::add_knowndll_section(const std::u16string& name, section section, bool is_32bit) +void process_context::add_knowndll_section(const std::u16string& name, const section& section, bool is_32bit) { auto lname = utils::string::to_lower(name); diff --git a/src/windows-emulator/process_context.hpp b/src/windows-emulator/process_context.hpp index 4810e8fe..f34663be 100644 --- a/src/windows-emulator/process_context.hpp +++ b/src/windows-emulator/process_context.hpp @@ -88,11 +88,11 @@ struct process_context const std::u16string* get_atom_name(uint16_t atom_id) const; template - void build_knowndlls_section_table(registry_manager& registry, const file_system& file_system, bool is_wow64); + 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); - void add_knowndll_section(const std::u16string& name, section section, bool is_32bit); - bool is_knowndll_section_exists(const std::u16string& name, 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; void serialize(utils::buffer_serializer& buffer) const; void deserialize(utils::buffer_deserializer& buffer);