Andrew Nguyen : pdh: Implement and test PdhGetDllVersion.
Alexandre Julliard
julliard at winehq.org
Mon Feb 1 08:56:00 CST 2010
Module: wine
Branch: master
Commit: 2da6570ca4cb9cf277c0504b2cbe2cfd84d48956
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2da6570ca4cb9cf277c0504b2cbe2cfd84d48956
Author: Andrew Nguyen <arethusa26 at gmail.com>
Date: Sat Jan 30 18:24:52 2010 -0600
pdh: Implement and test PdhGetDllVersion.
---
dlls/pdh/pdh.spec | 2 +-
dlls/pdh/pdh_main.c | 13 +++++++++++++
dlls/pdh/tests/pdh.c | 23 +++++++++++++++++++++++
include/pdh.h | 5 +++++
4 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/dlls/pdh/pdh.spec b/dlls/pdh/pdh.spec
index 3d75bb1..b475d53 100644
--- a/dlls/pdh/pdh.spec
+++ b/dlls/pdh/pdh.spec
@@ -57,7 +57,7 @@
@ stub PdhGetDefaultPerfObjectHA
@ stub PdhGetDefaultPerfObjectHW
@ stub PdhGetDefaultPerfObjectW
-@ stub PdhGetDllVersion
+@ stdcall PdhGetDllVersion(ptr)
@ stub PdhGetFormattedCounterArrayA
@ stub PdhGetFormattedCounterArrayW
@ stdcall PdhGetFormattedCounterValue(ptr long ptr ptr)
diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c
index fd6deba..bdf83a9 100644
--- a/dlls/pdh/pdh_main.c
+++ b/dlls/pdh/pdh_main.c
@@ -726,6 +726,19 @@ PDH_STATUS WINAPI PdhGetCounterTimeBase( PDH_HCOUNTER handle, LONGLONG *base )
}
/***********************************************************************
+ * PdhGetDllVersion (PDH.@)
+ */
+PDH_STATUS WINAPI PdhGetDllVersion( LPDWORD version )
+{
+ if (!version)
+ return PDH_INVALID_ARGUMENT;
+
+ *version = PDH_VERSION;
+
+ return ERROR_SUCCESS;
+}
+
+/***********************************************************************
* PdhGetFormattedCounterValue (PDH.@)
*/
PDH_STATUS WINAPI PdhGetFormattedCounterValue( PDH_HCOUNTER handle, DWORD format,
diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c
index cd03bcb..094ad74 100644
--- a/dlls/pdh/tests/pdh.c
+++ b/dlls/pdh/tests/pdh.c
@@ -934,6 +934,28 @@ static void test_PdhMakeCounterPathA(void)
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)
{
if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH)
@@ -975,4 +997,5 @@ START_TEST(pdh)
test_PdhCollectQueryDataEx();
test_PdhMakeCounterPathA();
+ test_PdhGetDllVersion();
}
diff --git a/include/pdh.h b/include/pdh.h
index f4764af..7f3d334 100644
--- a/include/pdh.h
+++ b/include/pdh.h
@@ -37,6 +37,10 @@ typedef HANDLE PDH_HQUERY;
typedef HANDLE PDH_HCOUNTER;
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_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);
#define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
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 PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
More information about the wine-cvs
mailing list