Commit 5dfc2ead authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

pdh: Add tests for Pdh{Add, Remove}Counter and PdhCollectQueryData.

parent bdb218ab
......@@ -48,7 +48,55 @@ static void test_open_close_query( void )
ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
}
static void test_add_remove_counter( void )
{
PDH_STATUS ret;
PDH_HQUERY query;
PDH_HCOUNTER counter;
ret = PdhOpenQueryA( NULL, 0, &query );
ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
ret = PdhAddCounterA( NULL, "\\System\\System Up Time", 0, NULL );
ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
ret = PdhAddCounterA( NULL, "\\System\\System Up Time", 0, &counter );
ok(ret == PDH_INVALID_HANDLE, "PdhAddCounterA failed 0x%08x\n", ret);
ret = PdhAddCounterA( query, NULL, 0, &counter );
ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, NULL );
ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
ret = PdhAddCounterA( query, "\\System\\System Down Time", 0, &counter );
ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhAddCounterA failed 0x%08x\n", ret);
ok(!counter, "PdhAddCounterA failed %p\n", counter);
ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
ret = PdhCollectQueryData( NULL );
ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryData failed 0x%08x\n", ret);
ret = PdhCollectQueryData( counter );
ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryData failed 0x%08x\n", ret);
ret = PdhCollectQueryData( query );
ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
ret = PdhRemoveCounter( NULL );
ok(ret == PDH_INVALID_HANDLE, "PdhRemoveCounter failed 0x%08x\n", ret);
ret = PdhRemoveCounter( counter );
ok(ret == ERROR_SUCCESS, "PdhRemoveCounter failed 0x%08x\n", ret);
ret = PdhCloseQuery( query );
ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
}
START_TEST(pdh)
{
test_open_close_query();
test_add_remove_counter();
}
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