Fix basic registry support and add test

This commit is contained in:
momo5502
2024-11-04 18:36:18 +01:00
parent 6937827e59
commit 808dca6455
7 changed files with 74 additions and 12 deletions

View File

@@ -183,7 +183,7 @@ namespace
if (key_value_information_class == KeyValueBasicInformation)
{
const auto required_size = sizeof(KEY_VALUE_BASIC_INFORMATION) + (original_name.size() * 2) - 1;
const auto required_size = offsetof(KEY_VALUE_BASIC_INFORMATION, Name) + (original_name.size() * 2) - 1;
result_length.write(static_cast<ULONG>(required_size));
if (required_size > length)
@@ -208,7 +208,7 @@ namespace
if (key_value_information_class == KeyValuePartialInformation)
{
const auto required_size = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + value->data.size() - 1;
const auto required_size = offsetof(KEY_VALUE_PARTIAL_INFORMATION, Data) + value->data.size();
result_length.write(static_cast<ULONG>(required_size));
if (required_size > length)
@@ -235,7 +235,7 @@ namespace
{
const auto name_size = original_name.size() * 2;
const auto value_size = value->data.size();
const auto required_size = sizeof(KEY_VALUE_FULL_INFORMATION) + name_size + value_size + -1;
const auto required_size = offsetof(KEY_VALUE_FULL_INFORMATION, Name) + name_size + value_size + -1;
result_length.write(static_cast<ULONG>(required_size));
if (required_size > length)
@@ -268,6 +268,11 @@ namespace
return STATUS_NOT_SUPPORTED;
}
NTSTATUS handle_NtCreateKey()
{
return STATUS_NOT_SUPPORTED;
}
NTSTATUS handle_NtSetInformationThread(const syscall_context& c, const uint64_t thread_handle,
const THREADINFOCLASS info_class,
const uint64_t thread_information,
@@ -2537,6 +2542,7 @@ void syscall_dispatcher::add_handlers(std::map<std::string, syscall_handler>& ha
add_handler(NtQueryKey);
add_handler(NtGetNlsSectionPtr);
add_handler(NtAccessCheck);
add_handler(NtCreateKey);
#undef add_handler
}