pdh: Implement and test PdhGetRawCounterValue.
This commit is contained in:
parent
0d516c5377
commit
754ac8c478
|
@ -64,7 +64,7 @@
|
|||
@ stub PdhGetLogSetGUID
|
||||
@ stub PdhGetRawCounterArrayA
|
||||
@ stub PdhGetRawCounterArrayW
|
||||
@ stub PdhGetRawCounterValue
|
||||
@ stdcall PdhGetRawCounterValue(ptr ptr ptr)
|
||||
@ stub PdhIsRealTimeQuery
|
||||
@ stub PdhListLogFileHeaderA
|
||||
@ stub PdhListLogFileHeaderW
|
||||
|
|
|
@ -326,6 +326,30 @@ PDH_STATUS WINAPI PdhGetFormattedCounterValue( PDH_HCOUNTER handle, DWORD format
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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.@)
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue