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

This commit is contained in:
Rob Shearman 2008-01-06 15:35:56 +00:00 committed by Alexandre Julliard
parent edab3a6ff1
commit e958a570e5
2 changed files with 9 additions and 4 deletions

View File

@ -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;

View File

@ -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);