mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-27 23:11:02 +00:00
Merge remote-tracking branch 'origin/main' into multi-platform-support
# Conflicts: # src/analyzer/main.cpp # src/emulator/memory_region.hpp # src/windows-emulator/io_device.cpp # src/windows-emulator/module/module_mapping.cpp # src/windows-emulator/process_context.hpp # src/windows-emulator/syscalls.cpp # src/windows-emulator/windows_emulator.cpp
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "hive_parser.hpp"
|
||||
#include <utils/string.hpp>
|
||||
|
||||
// Based on this implementation: https://github.com/reahly/windows-hive-parser
|
||||
|
||||
@@ -130,11 +131,6 @@ namespace
|
||||
throw std::runtime_error("Bad hive file '" + file_path.string() + "': " + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
char char_to_lower(const char val)
|
||||
{
|
||||
return static_cast<char>(std::tolower(static_cast<unsigned char>(val)));
|
||||
}
|
||||
}
|
||||
|
||||
const hive_value* hive_key::get_value(std::ifstream& file, const std::string_view name)
|
||||
@@ -188,7 +184,7 @@ void hive_key::parse(std::ifstream& file)
|
||||
raw_value.data_offset = offset + static_cast<int>(offsetof(value_block_t, offset));
|
||||
}
|
||||
|
||||
std::ranges::transform(value_name, value_name.begin(), char_to_lower);
|
||||
utils::string::to_lower_inplace(value_name);
|
||||
this->values_[std::move(value_name)] = std::move(raw_value);
|
||||
}
|
||||
|
||||
@@ -211,7 +207,7 @@ void hive_key::parse(std::ifstream& file)
|
||||
const auto subkey = read_file_object<key_block_t>(file, subkey_block_offset);
|
||||
|
||||
std::string subkey_name(subkey.name, std::min(subkey.len, static_cast<short>(sizeof(subkey.name))));
|
||||
std::ranges::transform(subkey_name, subkey_name.begin(), char_to_lower);
|
||||
utils::string::to_lower_inplace(subkey_name);
|
||||
|
||||
this->sub_keys_.emplace(std::move(subkey_name), hive_key{subkey.subkeys, subkey.value_count, subkey.offsets});
|
||||
}
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
#include "registry_manager.hpp"
|
||||
|
||||
#include <cwctype>
|
||||
#include <serialization_helper.hpp>
|
||||
|
||||
#include "hive_parser.hpp"
|
||||
#include <utils/string.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
void string_to_lower(std::string& str)
|
||||
{
|
||||
std::ranges::transform(str, str.begin(), [](const char val)
|
||||
{
|
||||
return static_cast<char>(std::tolower(static_cast<unsigned char>(val)));
|
||||
});
|
||||
}
|
||||
|
||||
std::filesystem::path canonicalize_path(const std::filesystem::path& key)
|
||||
{
|
||||
auto path = key.lexically_normal().wstring();
|
||||
std::ranges::transform(path, path.begin(), std::towlower);
|
||||
return {std::move(path)};
|
||||
return utils::string::to_lower_consume(path);
|
||||
}
|
||||
|
||||
bool is_subpath(const std::filesystem::path& root, const std::filesystem::path& p)
|
||||
@@ -144,7 +135,7 @@ std::optional<registry_key> registry_manager::get_key(const std::filesystem::pat
|
||||
|
||||
std::optional<registry_value> registry_manager::get_value(const registry_key& key, std::string name)
|
||||
{
|
||||
string_to_lower(name);
|
||||
utils::string::to_lower_inplace(name);
|
||||
|
||||
const auto iterator = this->hives_.find(key.hive);
|
||||
if (iterator == this->hives_.end())
|
||||
|
||||
Reference in New Issue
Block a user