Commit e958a570 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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

parent edab3a6f
...@@ -485,9 +485,17 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name, ...@@ -485,9 +485,17 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name,
data_ptr = NULL; data_ptr = NULL;
break; break;
case KeyValueFullInformation: 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; fixed_size = (char *)data_ptr - (char *)info;
break; break;
}
case KeyValuePartialInformation: case KeyValuePartialInformation:
data_ptr = ((KEY_VALUE_PARTIAL_INFORMATION *)info)->Data; data_ptr = ((KEY_VALUE_PARTIAL_INFORMATION *)info)->Data;
fixed_size = (char *)data_ptr - (char *)info; fixed_size = (char *)data_ptr - (char *)info;
......
...@@ -501,7 +501,6 @@ static void test_NtQueryValueKey(void) ...@@ -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->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->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); 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, ok(len == FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) + full_info->DataLength + full_info->NameLength,
"NtQueryValueKey returned wrong len %d\n", len); "NtQueryValueKey returned wrong len %d\n", len);
len = FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) + full_info->DataLength + full_info->NameLength; len = FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]) + full_info->DataLength + full_info->NameLength;
...@@ -513,9 +512,7 @@ static void test_NtQueryValueKey(void) ...@@ -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->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->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); 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"); 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", ok(*(DWORD *)((char *)full_info + full_info->DataOffset) == 711, "incorrect Data returned: 0x%x\n",
*(DWORD *)((char *)full_info + full_info->DataOffset)); *(DWORD *)((char *)full_info + full_info->DataOffset));
HeapFree(GetProcessHeap(), 0, full_info); HeapFree(GetProcessHeap(), 0, full_info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment