Commit b15680a0 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Implement NtQueryValueKey(KeyValuePartialInformationAlign64).

parent 9878b47b
...@@ -768,6 +768,7 @@ static void test_NtQueryValueKey(void) ...@@ -768,6 +768,7 @@ static void test_NtQueryValueKey(void)
UNICODE_STRING ValName; UNICODE_STRING ValName;
KEY_VALUE_BASIC_INFORMATION *basic_info; KEY_VALUE_BASIC_INFORMATION *basic_info;
KEY_VALUE_PARTIAL_INFORMATION *partial_info, pi; KEY_VALUE_PARTIAL_INFORMATION *partial_info, pi;
KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *aligned_info;
KEY_VALUE_FULL_INFORMATION *full_info; KEY_VALUE_FULL_INFORMATION *full_info;
DWORD len, expected; DWORD len, expected;
...@@ -815,6 +816,42 @@ static void test_NtQueryValueKey(void) ...@@ -815,6 +816,42 @@ static void test_NtQueryValueKey(void)
ok(*(DWORD *)partial_info->Data == 711, "incorrect Data returned: 0x%lx\n", *(DWORD *)partial_info->Data); ok(*(DWORD *)partial_info->Data == 711, "incorrect Data returned: 0x%lx\n", *(DWORD *)partial_info->Data);
HeapFree(GetProcessHeap(), 0, partial_info); HeapFree(GetProcessHeap(), 0, partial_info);
len = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data[0]);
aligned_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*aligned_info) + 4);
aligned_info = (KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *)((char *)aligned_info + 4);
status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformationAlign64, aligned_info, len, &len);
ok(status == STATUS_BUFFER_OVERFLOW, "NtQueryValueKey should have returned STATUS_BUFFER_OVERFLOW instead of 0x%08lx\n", status);
ok(aligned_info->Type == REG_DWORD, "NtQueryValueKey returned wrong Type %ld\n", aligned_info->Type);
ok(aligned_info->DataLength == 4, "NtQueryValueKey returned wrong DataLength %ld\n", aligned_info->DataLength);
ok(len == FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data[aligned_info->DataLength]), "NtQueryValueKey returned wrong len %ld\n", len);
len = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data[0]);
aligned_info = (KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *)((char *)aligned_info - 4);
status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformationAlign64, aligned_info, len, &len);
ok(status == STATUS_BUFFER_OVERFLOW, "NtQueryValueKey should have returned STATUS_BUFFER_OVERFLOW instead of 0x%08lx\n", status);
ok(aligned_info->Type == REG_DWORD, "NtQueryValueKey returned wrong Type %ld\n", aligned_info->Type);
ok(aligned_info->DataLength == 4, "NtQueryValueKey returned wrong DataLength %ld\n", aligned_info->DataLength);
ok(len == FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data[aligned_info->DataLength]), "NtQueryValueKey returned wrong len %ld\n", len);
aligned_info = HeapReAlloc(GetProcessHeap(), 0, aligned_info, len + 4);
aligned_info = (KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *)((char *)aligned_info + 4);
status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformationAlign64, aligned_info, len, &len);
ok(status == STATUS_SUCCESS, "NtQueryValueKey should have returned STATUS_SUCCESS instead of 0x%08lx\n", status);
ok(aligned_info->Type == REG_DWORD, "NtQueryValueKey returned wrong Type %ld\n", aligned_info->Type);
ok(aligned_info->DataLength == 4, "NtQueryValueKey returned wrong DataLength %ld\n", aligned_info->DataLength);
ok(len == FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data[aligned_info->DataLength]), "NtQueryValueKey returned wrong len %ld\n", len);
ok(*(DWORD *)aligned_info->Data == 711, "incorrect Data returned: 0x%lx\n", *(DWORD *)aligned_info->Data);
aligned_info = (KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *)((char *)aligned_info - 4);
status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformationAlign64, aligned_info, len, &len);
ok(status == STATUS_SUCCESS, "NtQueryValueKey should have returned STATUS_SUCCESS instead of 0x%08lx\n", status);
ok(aligned_info->Type == REG_DWORD, "NtQueryValueKey returned wrong Type %ld\n", aligned_info->Type);
ok(aligned_info->DataLength == 4, "NtQueryValueKey returned wrong DataLength %ld\n", aligned_info->DataLength);
ok(len == FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data[aligned_info->DataLength]), "NtQueryValueKey returned wrong len %ld\n", len);
ok(*(DWORD *)aligned_info->Data == 711, "incorrect Data returned: 0x%lx\n", *(DWORD *)aligned_info->Data);
HeapFree(GetProcessHeap(), 0, aligned_info);
len = FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]); len = FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]);
full_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*full_info)); full_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*full_info));
status = pNtQueryValueKey(key, &ValName, KeyValueFullInformation, full_info, len, &len); status = pNtQueryValueKey(key, &ValName, KeyValueFullInformation, full_info, len, &len);
......
...@@ -425,6 +425,16 @@ static void copy_key_value_info( KEY_VALUE_INFORMATION_CLASS info_class, void *i ...@@ -425,6 +425,16 @@ static void copy_key_value_info( KEY_VALUE_INFORMATION_CLASS info_class, void *i
break; break;
} }
case KeyValuePartialInformationAlign64:
{
KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 keyinfo;
keyinfo.Type = type;
keyinfo.DataLength = data_len;
length = min( length, (char *)keyinfo.Data - (char *)&keyinfo );
memcpy( info, &keyinfo, length );
break;
}
default: default:
break; break;
} }
...@@ -519,6 +529,11 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name, ...@@ -519,6 +529,11 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name,
data_ptr = ((KEY_VALUE_PARTIAL_INFORMATION *)info)->Data; data_ptr = ((KEY_VALUE_PARTIAL_INFORMATION *)info)->Data;
break; break;
case KeyValuePartialInformationAlign64:
min_size = fixed_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data);
data_ptr = ((KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 *)info)->Data;
break;
default: default:
FIXME( "Information class %d not implemented\n", info_class ); FIXME( "Information class %d not implemented\n", info_class );
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
......
...@@ -2460,6 +2460,12 @@ typedef struct _KEY_VALUE_PARTIAL_INFORMATION { ...@@ -2460,6 +2460,12 @@ typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
UCHAR Data[1]; UCHAR Data[1];
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION; } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
ULONG Type;
ULONG DataLength;
UCHAR Data[1];
} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
#ifndef __OBJECT_ATTRIBUTES_DEFINED__ #ifndef __OBJECT_ATTRIBUTES_DEFINED__
#define __OBJECT_ATTRIBUTES_DEFINED__ #define __OBJECT_ATTRIBUTES_DEFINED__
typedef struct _OBJECT_ATTRIBUTES { typedef struct _OBJECT_ATTRIBUTES {
......
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