Commit 7cbaf1f5 authored by Vitaly Lipatov's avatar Vitaly Lipatov Committed by Alexandre Julliard

advapi32/tests: Add test prototype for RegQueryValueEx HKEY_PERFORMANCE_DATA.

parent 2884205d
......@@ -27,6 +27,7 @@
#include "winbase.h"
#include "winternl.h"
#include "winreg.h"
#include "winperf.h"
#include "winsvc.h"
#include "winerror.h"
#include "aclapi.h"
......@@ -3480,6 +3481,54 @@ static void test_RegNotifyChangeKeyValue(void)
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)
{
/* Load pointers for functions that are not available in all Windows versions */
......@@ -3515,6 +3564,7 @@ START_TEST(registry)
test_delete_key_value();
test_RegOpenCurrentUser();
test_RegNotifyChangeKeyValue();
test_RegQueryValueExPerformanceData();
/* cleanup */
delete_key( hkey_main );
......
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