Commit 754ac8c4 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

pdh: Implement and test PdhGetRawCounterValue.

parent 0d516c53
......@@ -64,7 +64,7 @@
@ stub PdhGetLogSetGUID
@ stub PdhGetRawCounterArrayA
@ stub PdhGetRawCounterArrayW
@ stub PdhGetRawCounterValue
@ stdcall PdhGetRawCounterValue(ptr ptr ptr)
@ stub PdhIsRealTimeQuery
@ stub PdhListLogFileHeaderA
@ stub PdhListLogFileHeaderW
......
......@@ -327,6 +327,30 @@ PDH_STATUS WINAPI PdhGetFormattedCounterValue( PDH_HCOUNTER handle, DWORD format
}
/***********************************************************************
* PdhGetRawCounterValue (PDH.@)
*/
PDH_STATUS WINAPI PdhGetRawCounterValue( PDH_HCOUNTER handle, LPDWORD type,
PPDH_RAW_COUNTER value )
{
struct counter *counter = handle;
TRACE("%p %p %p\n", handle, type, value);
if (!value) return PDH_INVALID_ARGUMENT;
if (!counter) return PDH_INVALID_HANDLE;
value->CStatus = counter->status;
value->TimeStamp.dwLowDateTime = counter->stamp.dwLowDateTime;
value->TimeStamp.dwHighDateTime = counter->stamp.dwHighDateTime;
value->FirstValue = counter->one.largevalue;;
value->SecondValue = counter->two.largevalue;
value->MultiCount = 1; /* FIXME */
if (type) *type = counter->type;
return ERROR_SUCCESS;
}
/***********************************************************************
* PdhOpenQueryA (PDH.@)
*/
PDH_STATUS WINAPI PdhOpenQueryA( LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query )
......
......@@ -145,6 +145,40 @@ static void test_PdhGetFormattedCounterValue( void )
ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
}
static void test_PdhGetRawCounterValue( void )
{
PDH_STATUS ret;
PDH_HQUERY query;
PDH_HCOUNTER counter;
PDH_RAW_COUNTER value;
ret = PdhOpenQueryA( NULL, 0, &query );
ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
ret = PdhGetRawCounterValue( NULL, NULL, &value );
ok(ret == PDH_INVALID_HANDLE, "PdhGetRawCounterValue failed 0x%08x\n", ret);
ret = PdhGetRawCounterValue( counter, NULL, NULL );
ok(ret == PDH_INVALID_ARGUMENT, "PdhGetRawCounterValue failed 0x%08x\n", ret);
ret = PdhGetRawCounterValue( counter, NULL, &value );
ok(ret == ERROR_SUCCESS, "PdhGetRawCounterValue failed 0x%08x\n", ret);
ok(value.CStatus == ERROR_SUCCESS, "expected ERROR_SUCCESS got %x", value.CStatus);
ret = PdhCollectQueryData( query );
ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
ret = PdhGetRawCounterValue( counter, NULL, &value );
ok(ret == ERROR_SUCCESS, "PdhGetRawCounterValue failed 0x%08x\n", ret);
ok(value.CStatus == ERROR_SUCCESS, "expected ERROR_SUCCESS got %x", value.CStatus);
ret = PdhCloseQuery( query );
ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
}
static void test_PdhSetCounterScaleFactor( void )
{
PDH_STATUS ret;
......@@ -184,5 +218,6 @@ START_TEST(pdh)
test_open_close_query();
test_add_remove_counter();
test_PdhGetFormattedCounterValue();
test_PdhGetRawCounterValue();
test_PdhSetCounterScaleFactor();
}
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