Rob Shearman : ntdll: Fix the Data and Name returned by NtQueryValueKey for KeyValueFullInformation .

Alexandre Julliard julliard at winehq.org
Mon Jan 7 16:24:58 CST 2008


Module: wine
Branch: master
Commit: e958a570e5f40f3d288bf1c0a4366c5c7bb90f1c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e958a570e5f40f3d288bf1c0a4366c5c7bb90f1c

Author: Rob Shearman <rob at codeweavers.com>
Date:   Sun Jan  6 15:35:56 2008 +0000

ntdll: Fix the Data and Name returned by NtQueryValueKey for KeyValueFullInformation.

---

 dlls/ntdll/reg.c       |   10 +++++++++-
 dlls/ntdll/tests/reg.c |    3 ---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 7620bdd..e2a3b91 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -485,9 +485,17 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name,
         data_ptr = NULL;
         break;
     case KeyValueFullInformation:
-        data_ptr = (UCHAR *)((KEY_VALUE_FULL_INFORMATION *)info)->Name;
+    {
+        KEY_VALUE_FULL_INFORMATION *full_info = info;
+        if (FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name) < length)
+        {
+            memcpy(full_info->Name, name->Buffer,
+                   min(length - FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name), name->Length));
+        }
+        data_ptr = (UCHAR *)full_info->Name + name->Length;
         fixed_size = (char *)data_ptr - (char *)info;
         break;
+    }
     case KeyValuePartialInformation:
         data_ptr = ((KEY_VALUE_PARTIAL_INFORMATION *)info)->Data;
         fixed_size = (char *)data_ptr - (char *)info;
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index b5653d8..3b983ee 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -501,7 +501,6 @@ static void test_NtQueryValueKey(void)
     ok(full_info->Type == REG_DWORD, "NtQueryValueKey returned wrong Type %d\n", full_info->Type);
     ok(full_info->DataLength == 4, "NtQueryValueKey returned wrong DataLength %d\n", full_info->DataLength);
     ok(full_info->NameLength == 20, "NtQueryValueKey returned wrong NameLength %d\n", full_info->NameLength);
-    todo_wine
     ok(len == FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) + full_info->DataLength + full_info->NameLength,
         "NtQueryValueKey returned wrong len %d\n", len);
     len = FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) + full_info->DataLength + full_info->NameLength;
@@ -513,9 +512,7 @@ static void test_NtQueryValueKey(void)
     ok(full_info->Type == REG_DWORD, "NtQueryValueKey returned wrong Type %d\n", full_info->Type);
     ok(full_info->DataLength == 4, "NtQueryValueKey returned wrong DataLength %d\n", full_info->DataLength);
     ok(full_info->NameLength == 20, "NtQueryValueKey returned wrong NameLength %d\n", full_info->NameLength);
-    todo_wine
     ok(!memcmp(full_info->Name, ValName.Buffer, ValName.Length), "incorrect Name returned\n");
-    todo_wine
     ok(*(DWORD *)((char *)full_info + full_info->DataOffset) == 711, "incorrect Data returned: 0x%x\n",
         *(DWORD *)((char *)full_info + full_info->DataOffset));
     HeapFree(GetProcessHeap(), 0, full_info);




More information about the wine-cvs mailing list