pdh: Implement and test PdhGetDllVersion.

This commit is contained in:
Andrew Nguyen 2010-01-30 18:24:52 -06:00 committed by Alexandre Julliard
parent a86adcca61
commit 2da6570ca4
4 changed files with 42 additions and 1 deletions

View File

@ -57,7 +57,7 @@
@ stub PdhGetDefaultPerfObjectHA @ stub PdhGetDefaultPerfObjectHA
@ stub PdhGetDefaultPerfObjectHW @ stub PdhGetDefaultPerfObjectHW
@ stub PdhGetDefaultPerfObjectW @ stub PdhGetDefaultPerfObjectW
@ stub PdhGetDllVersion @ stdcall PdhGetDllVersion(ptr)
@ stub PdhGetFormattedCounterArrayA @ stub PdhGetFormattedCounterArrayA
@ stub PdhGetFormattedCounterArrayW @ stub PdhGetFormattedCounterArrayW
@ stdcall PdhGetFormattedCounterValue(ptr long ptr ptr) @ stdcall PdhGetFormattedCounterValue(ptr long ptr ptr)

View File

@ -725,6 +725,19 @@ PDH_STATUS WINAPI PdhGetCounterTimeBase( PDH_HCOUNTER handle, LONGLONG *base )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
/***********************************************************************
* PdhGetDllVersion (PDH.@)
*/
PDH_STATUS WINAPI PdhGetDllVersion( LPDWORD version )
{
if (!version)
return PDH_INVALID_ARGUMENT;
*version = PDH_VERSION;
return ERROR_SUCCESS;
}
/*********************************************************************** /***********************************************************************
* PdhGetFormattedCounterValue (PDH.@) * PdhGetFormattedCounterValue (PDH.@)
*/ */

View File

@ -934,6 +934,28 @@ static void test_PdhMakeCounterPathA(void)
ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret); ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
} }
static void test_PdhGetDllVersion(void)
{
PDH_STATUS ret;
DWORD version;
ret = PdhGetDllVersion(NULL);
ok(ret == PDH_INVALID_ARGUMENT ||
broken(ret == ERROR_SUCCESS), /* Vista+ */
"Expected PdhGetDllVersion to return PDH_INVALID_ARGUMENT, got %d\n", ret);
ret = PdhGetDllVersion(&version);
ok(ret == ERROR_SUCCESS,
"Expected PdhGetDllVersion to return ERROR_SUCCESS, got %d\n", ret);
if (ret == ERROR_SUCCESS)
{
ok(version == PDH_CVERSION_WIN50 ||
version == PDH_VERSION,
"Expected version number to be PDH_CVERSION_WIN50 or PDH_VERSION, got %u\n", version);
}
}
START_TEST(pdh) START_TEST(pdh)
{ {
if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH) if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH)
@ -975,4 +997,5 @@ START_TEST(pdh)
test_PdhCollectQueryDataEx(); test_PdhCollectQueryDataEx();
test_PdhMakeCounterPathA(); test_PdhMakeCounterPathA();
test_PdhGetDllVersion();
} }

View File

@ -37,6 +37,10 @@ typedef HANDLE PDH_HQUERY;
typedef HANDLE PDH_HCOUNTER; typedef HANDLE PDH_HCOUNTER;
typedef HANDLE PDH_HLOG; typedef HANDLE PDH_HLOG;
#define PDH_CVERSION_WIN40 0x0400
#define PDH_CVERSION_WIN50 0x0500
#define PDH_VERSION 0x0503
#define PDH_MAX_SCALE 7 #define PDH_MAX_SCALE 7
#define PDH_MIN_SCALE (-7) #define PDH_MIN_SCALE (-7)
@ -186,6 +190,7 @@ PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTE
PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W); PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
#define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo) #define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *); PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD);
PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE); PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER); PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD); PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);