advapi32/tests: Add test prototype for RegQueryValueEx HKEY_PERFORMANCE_DATA.

Signed-off-by: Vitaly Lipatov <lav@etersoft.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vitaly Lipatov 2017-03-22 14:03:46 +03:00 committed by Alexandre Julliard
parent 2884205db3
commit 7cbaf1f56f
1 changed files with 50 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "winbase.h" #include "winbase.h"
#include "winternl.h" #include "winternl.h"
#include "winreg.h" #include "winreg.h"
#include "winperf.h"
#include "winsvc.h" #include "winsvc.h"
#include "winerror.h" #include "winerror.h"
#include "aclapi.h" #include "aclapi.h"
@ -3480,6 +3481,54 @@ static void test_RegNotifyChangeKeyValue(void)
CloseHandle(event); CloseHandle(event);
} }
static void test_RegQueryValueExPerformanceData(void)
{
DWORD cbData, len;
BYTE *value;
DWORD dwret;
LONG limit = 6;
PERF_DATA_BLOCK *pdb;
/* Test with data == NULL */
dwret = RegQueryValueExA( HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, NULL, &cbData );
todo_wine ok( dwret == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", dwret );
/* Test ERROR_MORE_DATA, start with small buffer */
len = 10;
value = HeapAlloc(GetProcessHeap(), 0, len);
cbData = len;
dwret = RegQueryValueExA( HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, value, &cbData );
todo_wine ok( dwret == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", dwret );
while( dwret == ERROR_MORE_DATA && limit)
{
len = len * 10;
value = HeapReAlloc( GetProcessHeap(), 0, value, len );
cbData = len;
dwret = RegQueryValueExA( HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, value, &cbData );
limit--;
}
ok(limit > 0, "too many times ERROR_MORE_DATA returned\n");
todo_wine ok(dwret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", dwret);
/* Check returned data */
if (dwret == ERROR_SUCCESS)
{
todo_wine ok(len >= sizeof(PERF_DATA_BLOCK), "got size %d\n", len);
if (len >= sizeof(PERF_DATA_BLOCK)) {
pdb = (PERF_DATA_BLOCK*) value;
ok(pdb->Signature[0] == 'P', "expected Signature[0] = 'P', got 0x%x\n", pdb->Signature[0]);
ok(pdb->Signature[1] == 'E', "expected Signature[1] = 'E', got 0x%x\n", pdb->Signature[1]);
ok(pdb->Signature[2] == 'R', "expected Signature[2] = 'R', got 0x%x\n", pdb->Signature[2]);
ok(pdb->Signature[3] == 'F', "expected Signature[3] = 'F', got 0x%x\n", pdb->Signature[3]);
/* TODO: check other field */
}
}
HeapFree(GetProcessHeap(), 0, value);
}
START_TEST(registry) START_TEST(registry)
{ {
/* Load pointers for functions that are not available in all Windows versions */ /* Load pointers for functions that are not available in all Windows versions */
@ -3515,6 +3564,7 @@ START_TEST(registry)
test_delete_key_value(); test_delete_key_value();
test_RegOpenCurrentUser(); test_RegOpenCurrentUser();
test_RegNotifyChangeKeyValue(); test_RegNotifyChangeKeyValue();
test_RegQueryValueExPerformanceData();
/* cleanup */ /* cleanup */
delete_key( hkey_main ); delete_key( hkey_main );