Improvements to registry syscalls

This commit is contained in:
Igor Pissolati
2025-04-20 16:09:04 -03:00
parent 759bd0e9fb
commit 763b8fc760
8 changed files with 349 additions and 11 deletions

View File

@@ -34,6 +34,24 @@ struct KEY_NAME_INFORMATION
char16_t Name[1];
};
typedef struct _KEY_BASIC_INFORMATION
{
LARGE_INTEGER LastWriteTime;
ULONG TitleIndex;
ULONG NameLength;
char16_t Name[1];
} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
typedef struct _KEY_NODE_INFORMATION
{
LARGE_INTEGER LastWriteTime;
ULONG TitleIndex;
ULONG ClassOffset;
ULONG ClassLength;
ULONG NameLength;
char16_t Name[1];
} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
typedef struct _KEY_FULL_INFORMATION
{
LARGE_INTEGER LastWriteTime;

View File

@@ -18,8 +18,39 @@ namespace utils
}
};
struct insensitive_string_hash
{
using is_transparent = void;
size_t operator()(const std::string_view str) const
{
size_t hash = 0;
constexpr std::hash<int> hasher{};
for (unsigned char c : str)
{
hash ^= hasher(std::tolower(c)) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
}
return hash;
}
};
struct insensitive_string_equal
{
using is_transparent = void;
bool operator()(const std::string_view lhs, const std::string_view rhs) const
{
return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
[](unsigned char c1, unsigned char c2) { return std::tolower(c1) == std::tolower(c2); });
}
};
template <typename T>
using unordered_string_map = std::unordered_map<std::string, T, string_hash, std::equal_to<>>;
template <typename T>
using unordered_insensitive_string_map =
std::unordered_map<std::string, T, insensitive_string_hash, insensitive_string_equal>;
using unordered_string_set = std::unordered_set<std::string, string_hash, std::equal_to<>>;
}