From e32624ba1f0268ebee73bd6e46b7953521920155 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 3 Nov 2024 15:26:51 +0100 Subject: [PATCH] Handle root keys --- src/windows-emulator/syscalls.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/windows-emulator/syscalls.cpp b/src/windows-emulator/syscalls.cpp index 30f177b..7aa165d 100644 --- a/src/windows-emulator/syscalls.cpp +++ b/src/windows-emulator/syscalls.cpp @@ -58,7 +58,18 @@ namespace const emulator_object object_attributes) { const auto attributes = object_attributes.read(); - const auto key = read_unicode_string(c.emu, attributes.ObjectName); + auto key = read_unicode_string(c.emu, attributes.ObjectName); + + if (attributes.RootDirectory) + { + const auto* parent_handle = c.proc.registry_keys.get(reinterpret_cast(attributes.RootDirectory)); + if (!parent_handle) + { + return STATUS_INVALID_HANDLE; + } + + key = parent_handle->hive / parent_handle->path / key; + } c.win_emu.logger.print(color::dark_gray, "--> Registry key: %S\n", key.c_str());