NtOpenSection: Do Case-Insensitive String Comparison

This commit is contained in:
ahm3dgg
2026-01-11 00:15:22 +02:00
parent 5b03324342
commit d54c8bf9ca
2 changed files with 17 additions and 17 deletions

View File

@@ -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<section> process_context::get_knowndll_section_by_name(const std::u16string& name, bool is_32bit)
std::optional<section> 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);

View File

@@ -88,11 +88,11 @@ struct process_context
const std::u16string* get_atom_name(uint16_t atom_id) const;
template <typename T>
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<section> 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<section> 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);