ReactOS  0.4.13-dev-551-gf37fb1f
pdh.c File Reference
#include <stdio.h>
#include "windows.h"
#include "pdh.h"
#include "pdhmsg.h"
#include "wine/test.h"
Include dependency graph for pdh.c:

Go to the source code of this file.

Macros

#define GETFUNCPTR(func)   p##func = (void *)GetProcAddress( pdh, #func );
 

Functions

static PDH_STATUS (WINAPI *pPdhAddEnglishCounterA)(PDH_HQUERY
 
static BOOL is_lang_english (void)
 
static void init_function_ptrs (void)
 
static void test_PdhOpenQueryA (void)
 
static void test_PdhOpenQueryW (void)
 
static void test_PdhAddCounterA (void)
 
static void test_PdhAddCounterW (void)
 
static void test_PdhAddEnglishCounterA (void)
 
static void test_PdhAddEnglishCounterW (void)
 
static void test_PdhCollectQueryDataWithTime (void)
 
static void test_PdhGetFormattedCounterValue (void)
 
static void test_PdhGetRawCounterValue (void)
 
static void test_PdhSetCounterScaleFactor (void)
 
static void test_PdhGetCounterTimeBase (void)
 
static void test_PdhGetCounterInfoA (void)
 
static void test_PdhGetCounterInfoW (void)
 
static void test_PdhLookupPerfIndexByNameA (void)
 
static void test_PdhLookupPerfIndexByNameW (void)
 
static void test_PdhLookupPerfNameByIndexA (void)
 
static void test_PdhLookupPerfNameByIndexW (void)
 
static void test_PdhValidatePathA (void)
 
static void test_PdhValidatePathW (void)
 
static void test_PdhValidatePathExA (void)
 
static void test_PdhValidatePathExW (void)
 
static void test_PdhCollectQueryDataEx (void)
 
static void test_PdhMakeCounterPathA (void)
 
static void test_PdhGetDllVersion (void)
 
 START_TEST (pdh)
 

Variables

static HMODULE pdh
 
static LPCSTR
 
static DWORD_PTR
 
static PDH_HCOUNTER *static LPCWSTR
 
static const WCHAR processor_time []
 
static const WCHAR uptime []
 
static const WCHAR system_uptime []
 
static const WCHAR nonexistent_counter []
 
static const WCHAR percentage_processor_time []
 

Macro Definition Documentation

◆ GETFUNCPTR

#define GETFUNCPTR (   func)    p##func = (void *)GetProcAddress( pdh, #func );

Definition at line 38 of file pdh.c.

Function Documentation

◆ init_function_ptrs()

static void init_function_ptrs ( void  )
static

Definition at line 64 of file pdh.c.

65 {
66  pdh = GetModuleHandleA( "pdh" );
72 }
PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY query, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:320
PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:308
#define GETFUNCPTR(func)
Definition: pdh.c:38
PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG source, LPCWSTR path)
Definition: pdh_main.c:1116
PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY handle, LONGLONG *timestamp)
Definition: pdh_main.c:573
PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG source, LPCSTR path)
Definition: pdh_main.c:1101
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static HMODULE pdh
Definition: pdh.c:30

Referenced by START_TEST().

◆ is_lang_english()

static BOOL is_lang_english ( void  )
static

Definition at line 44 of file pdh.c.

45 {
46  static HMODULE hkernel32 = NULL;
47  static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
48  static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
49 
50  if (!hkernel32)
51  {
52  hkernel32 = GetModuleHandleA("kernel32.dll");
53  pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
54  pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
55  }
56  if (pGetThreadUILanguage)
57  return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
58  if (pGetUserDefaultUILanguage)
59  return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
60 
62 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static HINSTANCE hkernel32
Definition: process.c:66
WORD LANGID
Definition: typedefs.h:79
smooth NULL
Definition: ftsmooth.c:416
#define WINAPI
Definition: msvc.h:8
#define LANG_ENGLISH
Definition: nls.h:52
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define GetProcAddress(x, y)
Definition: compat.h:410
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:734
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by START_TEST().

◆ PDH_STATUS()

static PDH_STATUS ( WINAPI pPdhAddEnglishCounterA)
static

◆ START_TEST()

START_TEST ( pdh  )

Definition at line 987 of file pdh.c.

988 {
989  if (!is_lang_english())
990  {
991  skip("An English UI is needed for the pdh tests\n");
992  return;
993  }
995 
998 
1001 
1002  if (pPdhAddEnglishCounterA) test_PdhAddEnglishCounterA();
1003  if (pPdhAddEnglishCounterW) test_PdhAddEnglishCounterW();
1004  if (pPdhCollectQueryDataWithTime) test_PdhCollectQueryDataWithTime();
1005 
1010 
1013 
1016 
1019 
1022 
1023  if (pPdhValidatePathExA) test_PdhValidatePathExA();
1024  if (pPdhValidatePathExW) test_PdhValidatePathExW();
1025 
1029 }
static void test_PdhGetCounterInfoA(void)
Definition: pdh.c:494
static void test_PdhAddEnglishCounterA(void)
Definition: pdh.c:233
static void test_PdhGetCounterTimeBase(void)
Definition: pdh.c:465
static void test_PdhAddCounterA(void)
Definition: pdh.c:135
static void test_PdhValidatePathW(void)
Definition: pdh.c:743
static void test_PdhLookupPerfNameByIndexA(void)
Definition: pdh.c:656
static void test_PdhAddEnglishCounterW(void)
Definition: pdh.c:274
static void init_function_ptrs(void)
Definition: pdh.c:64
static BOOL is_lang_english(void)
Definition: pdh.c:44
static void test_PdhValidatePathExW(void)
Definition: pdh.c:792
static void test_PdhValidatePathA(void)
Definition: pdh.c:720
static void test_PdhGetDllVersion(void)
Definition: pdh.c:965
static void test_PdhSetCounterScaleFactor(void)
Definition: pdh.c:431
static void test_PdhValidatePathExA(void)
Definition: pdh.c:769
static void test_PdhOpenQueryW(void)
Definition: pdh.c:111
static void test_PdhLookupPerfIndexByNameW(void)
Definition: pdh.c:628
static void test_PdhGetCounterInfoW(void)
Definition: pdh.c:548
#define skip(...)
static void test_PdhOpenQueryA(void)
Definition: pdh.c:87
static void test_PdhGetRawCounterValue(void)
Definition: pdh.c:397
static void test_PdhLookupPerfNameByIndexW(void)
Definition: pdh.c:690
static void test_PdhGetFormattedCounterValue(void)
Definition: pdh.c:347
static void test_PdhLookupPerfIndexByNameA(void)
Definition: pdh.c:602
static void test_PdhAddCounterW(void)
Definition: pdh.c:184
static void test_PdhMakeCounterPathA(void)
Definition: pdh.c:868
static void test_PdhCollectQueryDataWithTime(void)
Definition: pdh.c:315
static void test_PdhCollectQueryDataEx(void)
Definition: pdh.c:818

◆ test_PdhAddCounterA()

static void test_PdhAddCounterA ( void  )
static

Definition at line 135 of file pdh.c.

136 {
137  PDH_STATUS ret;
140 
141  ret = PdhOpenQueryA( NULL, 0, &query );
142  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
143 
144  ret = PdhAddCounterA( NULL, "\\System\\System Up Time", 0, NULL );
145  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
146 
147  ret = PdhAddCounterA( NULL, "\\System\\System Up Time", 0, &counter );
148  ok(ret == PDH_INVALID_HANDLE, "PdhAddCounterA failed 0x%08x\n", ret);
149 
150  ret = PdhAddCounterA( query, NULL, 0, &counter );
151  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
152 
153  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, NULL );
154  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterA failed 0x%08x\n", ret);
155 
156  ret = PdhAddCounterA( query, "\\System\\Nonexistent Counter", 0, &counter );
158  broken(ret == PDH_INVALID_PATH), /* Win2K */
159  "PdhAddCounterA failed 0x%08x\n", ret);
160  ok(!counter, "PdhAddCounterA failed %p\n", counter);
161 
162  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
163  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
164 
166  ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryData failed 0x%08x\n", ret);
167 
169  ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryData failed 0x%08x\n", ret);
170 
172  ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
173 
175  ok(ret == PDH_INVALID_HANDLE, "PdhRemoveCounter failed 0x%08x\n", ret);
176 
178  ok(ret == ERROR_SUCCESS, "PdhRemoveCounter failed 0x%08x\n", ret);
179 
180  ret = PdhCloseQuery( query );
181  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
182 }
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
#define PDH_INVALID_PATH
Definition: pdhmsg.h:53
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER handle)
Definition: pdh_main.c:995
GLuint counter
Definition: glext.h:11116
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhAddCounterW()

static void test_PdhAddCounterW ( void  )
static

Definition at line 184 of file pdh.c.

185 {
186  PDH_STATUS ret;
189 
190  ret = PdhOpenQueryW( NULL, 0, &query );
191  ok(ret == ERROR_SUCCESS, "PdhOpenQueryW failed 0x%08x\n", ret);
192 
194  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterW failed 0x%08x\n", ret);
195 
197  ok(ret == PDH_INVALID_HANDLE, "PdhAddCounterW failed 0x%08x\n", ret);
198 
199  ret = PdhAddCounterW( query, NULL, 0, &counter );
200  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterW failed 0x%08x\n", ret);
201 
203  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddCounterW failed 0x%08x\n", ret);
204 
207  broken(ret == PDH_INVALID_PATH), /* Win2K */
208  "PdhAddCounterW failed 0x%08x\n", ret);
209  ok(!counter, "PdhAddCounterW failed %p\n", counter);
210 
212  ok(ret == ERROR_SUCCESS, "PdhAddCounterW failed 0x%08x\n", ret);
213 
215  ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryData failed 0x%08x\n", ret);
216 
218  ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryData failed 0x%08x\n", ret);
219 
221  ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
222 
224  ok(ret == PDH_INVALID_HANDLE, "PdhRemoveCounter failed 0x%08x\n", ret);
225 
227  ok(ret == ERROR_SUCCESS, "PdhRemoveCounter failed 0x%08x\n", ret);
228 
229  ret = PdhCloseQuery( query );
230  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
231 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR percentage_processor_time[]
Definition: pdh.c:83
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
#define PDH_INVALID_PATH
Definition: pdhmsg.h:53
PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY hquery, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *hcounter)
Definition: pdh_main.c:258
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER handle)
Definition: pdh_main.c:995
GLuint counter
Definition: glext.h:11116
static const WCHAR nonexistent_counter[]
Definition: pdh.c:81
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781
PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle)
Definition: pdh_main.c:969

Referenced by START_TEST().

◆ test_PdhAddEnglishCounterA()

static void test_PdhAddEnglishCounterA ( void  )
static

Definition at line 233 of file pdh.c.

234 {
235  PDH_STATUS ret;
238 
239  ret = PdhOpenQueryA( NULL, 0, &query );
240  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
241 
243  ok(ret == PDH_NO_DATA, "PdhCollectQueryData failed 0x%08x\n", ret);
244 
245  ret = pPdhAddEnglishCounterA( NULL, "\\System\\System Up Time", 0, NULL );
246  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
247 
248  ret = pPdhAddEnglishCounterA( NULL, "\\System\\System Up Time", 0, &counter );
249  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
250 
251  ret = pPdhAddEnglishCounterA( query, NULL, 0, &counter );
252  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
253 
254  ret = pPdhAddEnglishCounterA( query, "\\System\\System Up Time", 0, NULL );
255  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
256 
257  ret = pPdhAddEnglishCounterA( query, "\\System\\System Down Time", 0, &counter );
258  ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
259  ok(!counter, "PdhAddEnglishCounterA failed %p\n", counter);
260 
261  ret = pPdhAddEnglishCounterA( query, "\\System\\System Up Time", 0, &counter );
262  ok(ret == ERROR_SUCCESS, "PdhAddEnglishCounterA failed 0x%08x\n", ret);
263 
265  ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
266 
268  ok(ret == ERROR_SUCCESS, "PdhRemoveCounter failed 0x%08x\n", ret);
269 
270  ret = PdhCloseQuery( query );
271  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
272 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER handle)
Definition: pdh_main.c:995
GLuint counter
Definition: glext.h:11116
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
int ret
#define PDH_NO_DATA
Definition: pdhmsg.h:31
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhAddEnglishCounterW()

static void test_PdhAddEnglishCounterW ( void  )
static

Definition at line 274 of file pdh.c.

275 {
276  PDH_STATUS ret;
279 
280  ret = PdhOpenQueryW( NULL, 0, &query );
281  ok(ret == ERROR_SUCCESS, "PdhOpenQueryW failed 0x%08x\n", ret);
282 
284  ok(ret == PDH_NO_DATA, "PdhCollectQueryData failed 0x%08x\n", ret);
285 
286  ret = pPdhAddEnglishCounterW( NULL, system_uptime, 0, NULL );
287  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
288 
289  ret = pPdhAddEnglishCounterW( NULL, system_uptime, 0, &counter );
290  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
291 
292  ret = pPdhAddEnglishCounterW( query, NULL, 0, &counter );
293  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
294 
295  ret = pPdhAddEnglishCounterW( query, system_uptime, 0, NULL );
296  ok(ret == PDH_INVALID_ARGUMENT, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
297 
298  ret = pPdhAddEnglishCounterW( query, nonexistent_counter, 0, &counter );
299  ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
300  ok(!counter, "PdhAddEnglishCounterA failed %p\n", counter);
301 
302  ret = pPdhAddEnglishCounterW( query, system_uptime, 0, &counter );
303  ok(ret == ERROR_SUCCESS, "PdhAddEnglishCounterW failed 0x%08x\n", ret);
304 
306  ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
307 
309  ok(ret == ERROR_SUCCESS, "PdhRemoveCounter failed 0x%08x\n", ret);
310 
311  ret = PdhCloseQuery( query );
312  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
313 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER handle)
Definition: pdh_main.c:995
GLuint counter
Definition: glext.h:11116
static const WCHAR nonexistent_counter[]
Definition: pdh.c:81
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
int ret
static const WCHAR system_uptime[]
Definition: pdh.c:79
#define PDH_NO_DATA
Definition: pdhmsg.h:31
GLenum query
Definition: glext.h:7781
PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle)
Definition: pdh_main.c:969

Referenced by START_TEST().

◆ test_PdhCollectQueryDataEx()

static void test_PdhCollectQueryDataEx ( void  )
static

Definition at line 818 of file pdh.c.

819 {
823  HANDLE event;
824  BOOL ret;
825  UINT i;
826 
827  status = PdhOpenQueryA( NULL, 0, &query );
828  ok(status == ERROR_SUCCESS, "PdhOpenQuery failed 0x%08x\n", status);
829 
830  event = CreateEventA( NULL, FALSE, FALSE, "winetest" );
831  ok(event != NULL, "CreateEvent failed\n");
832 
833  status = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
834  ok(status == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", status);
835 
837  ok(status == PDH_INVALID_HANDLE, "PdhCollectQueryDataEx failed 0x%08x\n", status);
838 
840  ok(status == ERROR_SUCCESS, "PdhCollectQueryDataEx failed 0x%08x\n", status);
841 
843  ok(status == ERROR_SUCCESS, "PdhCollectQueryDataEx failed 0x%08x\n", status);
844 
846  ok(status == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", status);
847 
848  for (i = 0; i < 3; i++)
849  {
851  {
853 
855  ok(status == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", status);
856 
857  trace( "uptime %s\n", wine_dbgstr_longlong(U(value).largeValue) );
858  }
859  }
860 
861  ret = CloseHandle( event );
862  ok(ret, "CloseHandle failed\n");
863 
865  ok(status == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", status);
866 }
#define trace(...)
Definition: kmt_test.h:217
#define CloseHandle
Definition: compat.h:398
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define U(x)
Definition: wordpad.c:44
PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY handle, DWORD interval, HANDLE event)
Definition: pdh_main.c:514
PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER handle, DWORD format, LPDWORD type, PPDH_FMT_COUNTERVALUE value)
Definition: pdh_main.c:766
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
GLuint counter
Definition: glext.h:11116
#define WAIT_OBJECT_0
Definition: winbase.h:387
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
#define PDH_FMT_LARGE
Definition: pdh.h:51
int ret
struct _cl_event * event
Definition: glext.h:7739
GLsizei const GLfloat * value
Definition: glext.h:6069
unsigned int UINT
Definition: ndis.h:50
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define INFINITE
Definition: serial.h:102
static SERVICE_STATUS status
Definition: service.c:31
GLenum query
Definition: glext.h:7781
Definition: ps.c:97

Referenced by START_TEST().

◆ test_PdhCollectQueryDataWithTime()

static void test_PdhCollectQueryDataWithTime ( void  )
static

Definition at line 315 of file pdh.c.

316 {
317  PDH_STATUS ret;
320  LONGLONG time;
321 
322  ret = PdhOpenQueryA( NULL, 0, &query );
323  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
324 
326  ok(ret == PDH_NO_DATA, "PdhCollectQueryData failed 0x%08x\n", ret);
327 
328  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
329  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
330 
331  ret = pPdhCollectQueryDataWithTime( NULL, NULL );
332  ok(ret == PDH_INVALID_ARGUMENT, "PdhCollectQueryDataWithTime failed 0x%08x\n", ret);
333 
334  ret = pPdhCollectQueryDataWithTime( query, NULL );
335  ok(ret == PDH_INVALID_ARGUMENT, "PdhCollectQueryDataWithTime failed 0x%08x\n", ret);
336 
337  ret = pPdhCollectQueryDataWithTime( NULL, &time );
338  ok(ret == PDH_INVALID_HANDLE, "PdhCollectQueryDataWithTime failed 0x%08x\n", ret);
339 
340  ret = pPdhCollectQueryDataWithTime( query, &time );
341  ok(ret == ERROR_SUCCESS, "PdhCollectQueryDataWithTime failed 0x%08x\n", ret);
342 
343  ret = PdhCloseQuery( query );
344  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
345 }
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
__u16 time
Definition: mkdosfs.c:366
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
int64_t LONGLONG
Definition: typedefs.h:66
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
int ret
#define PDH_NO_DATA
Definition: pdhmsg.h:31
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhGetCounterInfoA()

static void test_PdhGetCounterInfoA ( void  )
static

Definition at line 494 of file pdh.c.

495 {
496  PDH_STATUS ret;
500  DWORD size;
501 
502  ret = PdhOpenQueryA( NULL, 0, &query );
503  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
504 
505  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
506  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
507 
508  ret = PdhGetCounterInfoA( NULL, 0, NULL, NULL );
509  ok(ret == PDH_INVALID_HANDLE || ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoA failed 0x%08x\n", ret);
510 
512  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoA failed 0x%08x\n", ret);
513 
515  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoA failed 0x%08x\n", ret);
516 
517  size = sizeof(info) - 1;
519  ok(ret == PDH_MORE_DATA || ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoA failed 0x%08x\n", ret);
520 
521  size = sizeof(info);
522  ret = PdhGetCounterInfoA( counter, 0, &size, &info );
523  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoA failed 0x%08x\n", ret);
524  ok(size == sizeof(info), "PdhGetCounterInfoA failed %d\n", size);
525 
526  ret = PdhGetCounterInfoA( counter, 0, &size, &info );
527  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoA failed 0x%08x\n", ret);
528  ok(info.lScale == 0, "lScale %d\n", info.lScale);
529 
531  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
532 
533  ret = PdhGetCounterInfoA( counter, 0, &size, &info );
534  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoA failed 0x%08x\n", ret);
535  ok(info.lScale == 0, "lScale %d\n", info.lScale);
536 
538  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
539 
540  ret = PdhGetCounterInfoA( counter, 0, &size, &info );
541  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoA failed 0x%08x\n", ret);
542  ok(info.lScale == -5, "lScale %d\n", info.lScale);
543 
544  ret = PdhCloseQuery( query );
545  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
546 }
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER handle, BOOLEAN text, LPDWORD size, PPDH_COUNTER_INFO_A info)
Definition: pdh_main.c:645
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
struct _test_info info[]
Definition: SetCursorPos.c:19
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
#define PDH_MORE_DATA
Definition: pdhmsg.h:28
GLsizeiptr size
Definition: glext.h:5919
LONG PDH_STATUS
Definition: pdh.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER handle, LONG factor)
Definition: pdh_main.c:1018
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhGetCounterInfoW()

static void test_PdhGetCounterInfoW ( void  )
static

Definition at line 548 of file pdh.c.

549 {
550  PDH_STATUS ret;
554  DWORD size;
555 
556  ret = PdhOpenQueryW( NULL, 0, &query );
557  ok(ret == ERROR_SUCCESS, "PdhOpenQueryW failed 0x%08x\n", ret);
558 
560  ok(ret == ERROR_SUCCESS, "PdhAddCounterW failed 0x%08x\n", ret);
561 
562  ret = PdhGetCounterInfoW( NULL, 0, NULL, NULL );
563  ok(ret == PDH_INVALID_HANDLE || ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoW failed 0x%08x\n", ret);
564 
566  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoW failed 0x%08x\n", ret);
567 
569  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoW failed 0x%08x\n", ret);
570 
571  size = sizeof(info) - 1;
573  ok(ret == PDH_MORE_DATA || ret == PDH_INVALID_ARGUMENT, "PdhGetCounterInfoW failed 0x%08x\n", ret);
574 
575  size = sizeof(info);
576  ret = PdhGetCounterInfoW( counter, 0, &size, &info );
577  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoW failed 0x%08x\n", ret);
578  ok(size == sizeof(info), "PdhGetCounterInfoW failed %d\n", size);
579 
580  ret = PdhGetCounterInfoW( counter, 0, &size, &info );
581  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoW failed 0x%08x\n", ret);
582  ok(info.lScale == 0, "lScale %d\n", info.lScale);
583 
585  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
586 
587  ret = PdhGetCounterInfoW( counter, 0, &size, &info );
588  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoW failed 0x%08x\n", ret);
589  ok(info.lScale == 0, "lScale %d\n", info.lScale);
590 
592  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
593 
594  ret = PdhGetCounterInfoW( counter, 0, &size, &info );
595  ok(ret == ERROR_SUCCESS, "PdhGetCounterInfoW failed 0x%08x\n", ret);
596  ok(info.lScale == -5, "lScale %d\n", info.lScale);
597 
598  ret = PdhCloseQuery( query );
599  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
600 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR percentage_processor_time[]
Definition: pdh.c:83
PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER handle, BOOLEAN text, LPDWORD size, PPDH_COUNTER_INFO_W info)
Definition: pdh_main.c:687
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
struct _test_info info[]
Definition: SetCursorPos.c:19
PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY hquery, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *hcounter)
Definition: pdh_main.c:258
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
#define PDH_MORE_DATA
Definition: pdhmsg.h:28
GLsizeiptr size
Definition: glext.h:5919
LONG PDH_STATUS
Definition: pdh.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER handle, LONG factor)
Definition: pdh_main.c:1018
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781
PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle)
Definition: pdh_main.c:969

Referenced by START_TEST().

◆ test_PdhGetCounterTimeBase()

static void test_PdhGetCounterTimeBase ( void  )
static

Definition at line 465 of file pdh.c.

466 {
467  PDH_STATUS ret;
470  LONGLONG base;
471 
472  ret = PdhOpenQueryA( NULL, 0, &query );
473  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
474 
475  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
476  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
477 
479  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetCounterTimeBase failed 0x%08x\n", ret);
480 
482  ok(ret == PDH_INVALID_HANDLE, "PdhGetCounterTimeBase failed 0x%08x\n", ret);
483 
485  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetCounterTimeBase failed 0x%08x\n", ret);
486 
488  ok(ret == ERROR_SUCCESS, "PdhGetCounterTimeBase failed 0x%08x\n", ret);
489 
490  ret = PdhCloseQuery( query );
491  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
492 }
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
GLuint base
Definition: 3dtext.c:35
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
int64_t LONGLONG
Definition: typedefs.h:66
PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER handle, LONGLONG *base)
Definition: pdh_main.c:729
LONG PDH_STATUS
Definition: pdh.h:35
int ret
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhGetDllVersion()

static void test_PdhGetDllVersion ( void  )
static

Definition at line 965 of file pdh.c.

966 {
967  PDH_STATUS ret;
968  DWORD version;
969 
972  broken(ret == ERROR_SUCCESS), /* Vista+ */
973  "Expected PdhGetDllVersion to return PDH_INVALID_ARGUMENT, got %d\n", ret);
974 
976  ok(ret == ERROR_SUCCESS,
977  "Expected PdhGetDllVersion to return ERROR_SUCCESS, got %d\n", ret);
978 
979  if (ret == ERROR_SUCCESS)
980  {
982  version == PDH_VERSION,
983  "Expected version number to be PDH_CVERSION_WIN50 or PDH_VERSION, got %u\n", version);
984  }
985 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_VERSION
Definition: pdh.h:42
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CVERSION_WIN50
Definition: pdh.h:41
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
LONG PDH_STATUS
Definition: pdh.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define broken(x)
Definition: _sntprintf.h:21
PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD version)
Definition: pdh_main.c:753

Referenced by START_TEST().

◆ test_PdhGetFormattedCounterValue()

static void test_PdhGetFormattedCounterValue ( void  )
static

Definition at line 347 of file pdh.c.

348 {
349  PDH_STATUS ret;
353 
354  ret = PdhOpenQueryA( NULL, 0, &query );
355  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
356 
357  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
358  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
359 
361  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
362 
364  ok(ret == PDH_INVALID_HANDLE, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
365 
367  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
368 
370  ok(ret == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
371 
373  ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
374 
376  ok(ret == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
377 
379  ok(ret == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
380 
382  ok(ret == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
383 
385  ok(ret == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
386 
388  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
389 
391  ok(ret == ERROR_SUCCESS, "PdhGetFormattedCounterValue failed 0x%08x\n", ret);
392 
393  ret = PdhCloseQuery( query );
394  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
395 }
#define PDH_FMT_NOCAP100
Definition: pdh.h:54
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER handle, DWORD format, LPDWORD type, PPDH_FMT_COUNTERVALUE value)
Definition: pdh_main.c:766
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
#define PDH_FMT_LARGE
Definition: pdh.h:51
int ret
GLsizei const GLfloat * value
Definition: glext.h:6069
#define PDH_FMT_NOSCALE
Definition: pdh.h:52
#define PDH_FMT_1000
Definition: pdh.h:53
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER handle, LONG factor)
Definition: pdh_main.c:1018
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhGetRawCounterValue()

static void test_PdhGetRawCounterValue ( void  )
static

Definition at line 397 of file pdh.c.

398 {
399  PDH_STATUS ret;
403 
404  ret = PdhOpenQueryA( NULL, 0, &query );
405  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
406 
407  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
408  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
409 
411  ok(ret == PDH_INVALID_HANDLE, "PdhGetRawCounterValue failed 0x%08x\n", ret);
412 
414  ok(ret == PDH_INVALID_ARGUMENT, "PdhGetRawCounterValue failed 0x%08x\n", ret);
415 
417  ok(ret == ERROR_SUCCESS, "PdhGetRawCounterValue failed 0x%08x\n", ret);
418  ok(value.CStatus == ERROR_SUCCESS, "expected ERROR_SUCCESS got %x\n", value.CStatus);
419 
421  ok(ret == ERROR_SUCCESS, "PdhCollectQueryData failed 0x%08x\n", ret);
422 
424  ok(ret == ERROR_SUCCESS, "PdhGetRawCounterValue failed 0x%08x\n", ret);
425  ok(value.CStatus == ERROR_SUCCESS, "expected ERROR_SUCCESS got %x\n", value.CStatus);
426 
427  ret = PdhCloseQuery( query );
428  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
429 }
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER handle, LPDWORD type, PPDH_RAW_COUNTER value)
Definition: pdh_main.c:800
GLuint counter
Definition: glext.h:11116
LONG PDH_STATUS
Definition: pdh.h:35
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:458
int ret
GLsizei const GLfloat * value
Definition: glext.h:6069
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhLookupPerfIndexByNameA()

static void test_PdhLookupPerfIndexByNameA ( void  )
static

Definition at line 602 of file pdh.c.

603 {
604  PDH_STATUS ret;
605  DWORD index;
606 
608  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameA failed 0x%08x\n", ret);
609 
611  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameA failed 0x%08x\n", ret);
612 
613  ret = PdhLookupPerfIndexByNameA( NULL, "No Counter", &index );
614  ok(ret == PDH_STRING_NOT_FOUND, "PdhLookupPerfIndexByNameA failed 0x%08x\n", ret);
615 
616  ret = PdhLookupPerfIndexByNameA( NULL, "% Processor Time", NULL );
617  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameA failed 0x%08x\n", ret);
618 
619  ret = PdhLookupPerfIndexByNameA( NULL, "% Processor Time", &index );
620  ok(ret == ERROR_SUCCESS, "PdhLookupPerfIndexByNameA failed 0x%08x\n", ret);
621  ok(index == 6, "PdhLookupPerfIndexByNameA failed %d\n", index);
622 
623  ret = PdhLookupPerfIndexByNameA( NULL, "System Up Time", &index );
624  ok(ret == ERROR_SUCCESS, "PdhLookupPerfIndexByNameA failed 0x%08x\n", ret);
625  ok(index == 674, "PdhLookupPerfIndexByNameA failed %d\n", index);
626 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_STRING_NOT_FOUND
Definition: pdhmsg.h:69
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
LONG PDH_STATUS
Definition: pdh.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define index(s, c)
Definition: various.h:29
PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR machine, LPCSTR name, LPDWORD index)
Definition: pdh_main.c:832

Referenced by START_TEST().

◆ test_PdhLookupPerfIndexByNameW()

static void test_PdhLookupPerfIndexByNameW ( void  )
static

Definition at line 628 of file pdh.c.

629 {
630  PDH_STATUS ret;
631  DWORD index;
632 
633  static const WCHAR no_counter[] = {'N','o',' ','C','o','u','n','t','e','r',0};
634 
636  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
637 
639  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
640 
641  ret = PdhLookupPerfIndexByNameW( NULL, no_counter, &index );
642  ok(ret == PDH_STRING_NOT_FOUND, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
643 
645  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
646 
648  ok(ret == ERROR_SUCCESS, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
649  ok(index == 6, "PdhLookupPerfIndexByNameW failed %d\n", index);
650 
652  ok(ret == ERROR_SUCCESS, "PdhLookupPerfIndexByNameW failed 0x%08x\n", ret);
653  ok(index == 674, "PdhLookupPerfIndexByNameW failed %d\n", index);
654 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_STRING_NOT_FOUND
Definition: pdhmsg.h:69
static const WCHAR uptime[]
Definition: pdh.c:76
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
LONG PDH_STATUS
Definition: pdh.h:35
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define index(s, c)
Definition: various.h:29
static const WCHAR processor_time[]
Definition: pdh.c:74
PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR machine, LPCWSTR name, LPDWORD index)
Definition: pdh_main.c:857

Referenced by START_TEST().

◆ test_PdhLookupPerfNameByIndexA()

static void test_PdhLookupPerfNameByIndexA ( void  )
static

Definition at line 656 of file pdh.c.

657 {
658  PDH_STATUS ret;
659  char buffer[PDH_MAX_COUNTER_NAME] = "!!";
660  DWORD size;
661 
663  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfNameByIndexA failed 0x%08x\n", ret);
664 
665  size = 0;
667  ok(ret == PDH_MORE_DATA || ret == PDH_INSUFFICIENT_BUFFER, "PdhLookupPerfNameByIndexA failed 0x%08x\n", ret);
668 
669  size = sizeof(buffer);
671  ok(ret == ERROR_SUCCESS, "PdhLookupPerfNameByIndexA failed 0x%08x\n", ret);
672  ok(!lstrcmpA( buffer, "% Processor Time" ),
673  "PdhLookupPerfNameByIndexA failed, got %s expected \'%% Processor Time\'\n", buffer);
674  ok(size == sizeof("% Processor Time"), "PdhLookupPerfNameByIndexA failed %d\n", size);
675 
676  size = sizeof(buffer);
679  ret == PDH_MORE_DATA, /* win2k3 */
680  "PdhLookupPerfNameByIndexA failed 0x%08x\n", ret);
681 
682  size = sizeof(buffer);
684  ok(ret == ERROR_SUCCESS, "PdhLookupPerfNameByIndexA failed 0x%08x\n", ret);
685  ok(!lstrcmpA( buffer, "System Up Time" ),
686  "PdhLookupPerfNameByIndexA failed, got %s expected \'System Up Time\'\n", buffer);
687  ok(size == sizeof("System Up Time"), "PdhLookupPerfNameByIndexA failed %d\n", size);
688 }
#define PDH_INSUFFICIENT_BUFFER
Definition: pdhmsg.h:51
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
GLuint buffer
Definition: glext.h:5915
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define PDH_MORE_DATA
Definition: pdhmsg.h:28
GLsizeiptr size
Definition: glext.h:5919
LONG PDH_STATUS
Definition: pdh.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR machine, DWORD index, LPSTR buffer, LPDWORD size)
Definition: pdh_main.c:884
#define PDH_MAX_COUNTER_NAME
Definition: pdh.h:47

Referenced by START_TEST().

◆ test_PdhLookupPerfNameByIndexW()

static void test_PdhLookupPerfNameByIndexW ( void  )
static

Definition at line 690 of file pdh.c.

691 {
692  PDH_STATUS ret;
694  DWORD size;
695 
697  ok(ret == PDH_INVALID_ARGUMENT, "PdhLookupPerfNameByIndexW failed 0x%08x\n", ret);
698 
699  size = 0;
701  ok(ret == PDH_MORE_DATA || ret == PDH_INSUFFICIENT_BUFFER, "PdhLookupPerfNameByIndexW failed 0x%08x\n", ret);
702 
705  ok(ret == ERROR_SUCCESS, "PdhLookupPerfNameByIndexW failed 0x%08x\n", ret);
706  ok(size == ARRAY_SIZE(processor_time), "PdhLookupPerfNameByIndexW failed %d\n", size);
707 
711  ret == PDH_MORE_DATA, /* win2k3 */
712  "PdhLookupPerfNameByIndexW failed 0x%08x\n", ret);
713 
716  ok(ret == ERROR_SUCCESS, "PdhLookupPerfNameByIndexW failed 0x%08x\n", ret);
717  ok(size == ARRAY_SIZE(uptime), "PdhLookupPerfNameByIndexW failed %d\n", size);
718 }
#define PDH_INSUFFICIENT_BUFFER
Definition: pdhmsg.h:51
#define ERROR_SUCCESS
Definition: deptool.c:10
PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR machine, DWORD index, LPWSTR buffer, LPDWORD size)
Definition: pdh_main.c:912
GLuint buffer
Definition: glext.h:5915
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
static const WCHAR uptime[]
Definition: pdh.c:76
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define PDH_MORE_DATA
Definition: pdhmsg.h:28
GLsizeiptr size
Definition: glext.h:5919
LONG PDH_STATUS
Definition: pdh.h:35
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ARRAY_SIZE(a)
Definition: main.h:24
static const WCHAR processor_time[]
Definition: pdh.c:74
#define PDH_MAX_COUNTER_NAME
Definition: pdh.h:47

Referenced by START_TEST().

◆ test_PdhMakeCounterPathA()

static void test_PdhMakeCounterPathA ( void  )
static

Definition at line 868 of file pdh.c.

869 {
870  PDH_STATUS ret;
872  char buffer[1024];
873  DWORD buflen;
874 
876  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
877 
878  buflen = 0;
879  ret = PdhMakeCounterPathA(NULL, NULL, &buflen, 0);
880  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
881 
882  buflen = 0;
883  ret = PdhMakeCounterPathA(NULL, buffer, &buflen, 0);
884  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
885 
886  buflen = sizeof(buffer);
887  memset(&e, 0, sizeof(e));
888  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
889  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
890 
891  buffer[0] = 0;
892  buflen = sizeof(buffer);
893  e.szMachineName = (char *)"machine";
894  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
895  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
896  ok(!strcmp(buffer, ""), "expected \"machine\" got %s\n", buffer);
897 
898  buffer[0] = 0;
899  buflen = sizeof(buffer);
900  e.szObjectName = (char *)"object";
901  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
902  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
903  ok(!strcmp(buffer, ""), "expected \"machine\" got %s\n", buffer);
904 
905  buffer[0] = 0;
906  buflen = sizeof(buffer);
907  e.szInstanceName = (char *)"instance";
908  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
909  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
910  ok(!strcmp(buffer, ""), "expected \"machine\" got %s\n", buffer);
911 
912  buffer[0] = 0;
913  buflen = sizeof(buffer);
914  e.szParentInstance = (char *)"parent";
915  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
916  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
917  ok(!strcmp(buffer, ""), "expected \"machine\" got %s\n", buffer);
918 
919  buffer[0] = 0;
920  buflen = sizeof(buffer);
921  e.dwInstanceIndex = 1;
922  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
923  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
924  ok(!strcmp(buffer, ""), "expected \"machine\" got %s\n", buffer);
925 
926  buffer[0] = 0;
927  buflen = sizeof(buffer);
928  e.szCounterName = (char *)"counter";
929  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
930  ok(ret == ERROR_SUCCESS, "PdhMakeCounterPathA failed 0x%08x\n", ret);
931  ok(!strcmp(buffer, "\\\\machine\\object(parent/instance#1)\\counter"),
932  "expected \"\\\\machine\\object(parent/instance#1)\\counter\" got %s\n", buffer);
933 
934  buffer[0] = 0;
935  buflen = sizeof(buffer);
936  e.szParentInstance = NULL;
937  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
938  ok(ret == ERROR_SUCCESS, "PdhMakeCounterPathA failed 0x%08x\n", ret);
939  ok(!strcmp(buffer, "\\\\machine\\object(instance#1)\\counter"),
940  "expected \"\\\\machine\\object(instance#1)\\counter\" got %s\n", buffer);
941 
942  buffer[0] = 0;
943  buflen = sizeof(buffer);
944  e.szInstanceName = NULL;
945  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
946  ok(ret == ERROR_SUCCESS, "PdhMakeCounterPathA failed 0x%08x\n", ret);
947  ok(!strcmp(buffer, "\\\\machine\\object\\counter"),
948  "expected \"\\\\machine\\object\\counter\" got %s\n", buffer);
949 
950  buffer[0] = 0;
951  buflen = sizeof(buffer);
952  e.szMachineName = NULL;
953  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
954  ok(ret == ERROR_SUCCESS, "PdhMakeCounterPathA failed 0x%08x\n", ret);
955  ok(!strcmp(buffer, "\\object\\counter"),
956  "expected \"\\object\\counter\" got %s\n", buffer);
957 
958  buffer[0] = 0;
959  buflen = sizeof(buffer);
960  e.szObjectName = NULL;
961  ret = PdhMakeCounterPathA(&e, buffer, &buflen, 0);
962  ok(ret == PDH_INVALID_ARGUMENT, "PdhMakeCounterPathA failed 0x%08x\n", ret);
963 }
PDH_STATUS WINAPI PdhMakeCounterPathA(PDH_COUNTER_PATH_ELEMENTS_A *e, LPSTR buffer, LPDWORD buflen, DWORD flags)
Definition: pdh_main.c:1131
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint buffer
Definition: glext.h:5915
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define e
Definition: ke_i.h:82
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG PDH_STATUS
Definition: pdh.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_PdhOpenQueryA()

static void test_PdhOpenQueryA ( void  )
static

Definition at line 87 of file pdh.c.

88 {
91 
92  ret = PdhOpenQueryA( NULL, 0, NULL );
93  ok(ret == PDH_INVALID_ARGUMENT, "PdhOpenQueryA failed 0x%08x\n", ret);
94 
95  ret = PdhOpenQueryA( NULL, 0, &query );
96  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
97 
98  ret = PdhCloseQuery( NULL );
99  ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
100 
101  ret = PdhCloseQuery( &query );
102  ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
103 
104  ret = PdhCloseQuery( query );
105  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
106 
107  ret = PdhCloseQuery( query );
108  ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
109 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
LONG PDH_STATUS
Definition: pdh.h:35
int ret
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhOpenQueryW()

static void test_PdhOpenQueryW ( void  )
static

Definition at line 111 of file pdh.c.

112 {
113  PDH_STATUS ret;
115 
116  ret = PdhOpenQueryW( NULL, 0, NULL );
117  ok(ret == PDH_INVALID_ARGUMENT, "PdhOpenQueryW failed 0x%08x\n", ret);
118 
119  ret = PdhOpenQueryW( NULL, 0, &query );
120  ok(ret == ERROR_SUCCESS, "PdhOpenQueryW failed 0x%08x\n", ret);
121 
122  ret = PdhCloseQuery( NULL );
123  ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
124 
125  ret = PdhCloseQuery( &query );
126  ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
127 
128  ret = PdhCloseQuery( query );
129  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
130 
131  ret = PdhCloseQuery( query );
132  ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
133 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
LONG PDH_STATUS
Definition: pdh.h:35
int ret
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781
PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle)
Definition: pdh_main.c:969

Referenced by START_TEST().

◆ test_PdhSetCounterScaleFactor()

static void test_PdhSetCounterScaleFactor ( void  )
static

Definition at line 431 of file pdh.c.

432 {
433  PDH_STATUS ret;
436 
437  ret = PdhOpenQueryA( NULL, 0, &query );
438  ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
439 
440  ret = PdhAddCounterA( query, "\\System\\System Up Time", 0, &counter );
441  ok(ret == ERROR_SUCCESS, "PdhAddCounterA failed 0x%08x\n", ret);
442 
444  ok(ret == PDH_INVALID_HANDLE, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
445 
447  ok(ret == PDH_INVALID_HANDLE, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
448 
450  ok(ret == PDH_INVALID_ARGUMENT, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
451 
453  ok(ret == PDH_INVALID_ARGUMENT, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
454 
456  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
457 
459  ok(ret == ERROR_SUCCESS, "PdhSetCounterScaleFactor failed 0x%08x\n", ret);
460 
461  ret = PdhCloseQuery( query );
462  ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
463 }
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:236
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:951
#define ok(value,...)
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:391
smooth NULL
Definition: ftsmooth.c:416
GLuint counter
Definition: glext.h:11116
LONG PDH_STATUS
Definition: pdh.h:35
int ret
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER handle, LONG factor)
Definition: pdh_main.c:1018
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
GLenum query
Definition: glext.h:7781

Referenced by START_TEST().

◆ test_PdhValidatePathA()

static void test_PdhValidatePathA ( void  )
static

Definition at line 720 of file pdh.c.

721 {
722  PDH_STATUS ret;
723 
725  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathA failed 0x%08x\n", ret);
726 
727  ret = PdhValidatePathA( "" );
728  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathA failed 0x%08x\n", ret);
729 
730  ret = PdhValidatePathA( "\\System" );
731  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathA failed 0x%08x\n", ret);
732 
733  ret = PdhValidatePathA( "System Up Time" );
734  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathA failed 0x%08x\n", ret);
735 
736  ret = PdhValidatePathA( "\\System\\Nonexistent Counter" );
737  ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathA failed 0x%08x\n", ret);
738 
739  ret = PdhValidatePathA( "\\System\\System Up Time" );
740  ok(ret == ERROR_SUCCESS, "PdhValidatePathA failed 0x%08x\n", ret);
741 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG PDH_STATUS
Definition: pdh.h:35
int ret
#define PDH_CSTATUS_BAD_COUNTERNAME
Definition: pdhmsg.h:49
PDH_STATUS WINAPI PdhValidatePathA(LPCSTR path)
Definition: pdh_main.c:1045

Referenced by START_TEST().

◆ test_PdhValidatePathExA()

static void test_PdhValidatePathExA ( void  )
static

Definition at line 769 of file pdh.c.

770 {
771  PDH_STATUS ret;
772 
773  ret = pPdhValidatePathExA( NULL, NULL );
774  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExA failed 0x%08x\n", ret);
775 
776  ret = pPdhValidatePathExA( NULL, "" );
777  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExA failed 0x%08x\n", ret);
778 
779  ret = pPdhValidatePathExA( NULL, "\\System" );
780  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExA failed 0x%08x\n", ret);
781 
782  ret = pPdhValidatePathExA( NULL, "System Up Time" );
783  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExA failed 0x%08x\n", ret);
784 
785  ret = pPdhValidatePathExA( NULL, "\\System\\System Down Time" );
786  ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathExA failed 0x%08x\n", ret);
787 
788  ret = pPdhValidatePathExA( NULL, "\\System\\System Up Time" );
789  ok(ret == ERROR_SUCCESS, "PdhValidatePathExA failed 0x%08x\n", ret);
790 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG PDH_STATUS
Definition: pdh.h:35
int ret
#define PDH_CSTATUS_BAD_COUNTERNAME
Definition: pdhmsg.h:49

Referenced by START_TEST().

◆ test_PdhValidatePathExW()

static void test_PdhValidatePathExW ( void  )
static

Definition at line 792 of file pdh.c.

793 {
794  PDH_STATUS ret;
795 
796  static const WCHAR empty[] = {0};
797  static const WCHAR system[] = {'\\','S','y','s','t','e','m',0};
798 
799  ret = pPdhValidatePathExW( NULL, NULL );
800  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExW failed 0x%08x\n", ret);
801 
802  ret = pPdhValidatePathExW( NULL, empty );
803  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathExW failed 0x%08x\n", ret);
804 
805  ret = pPdhValidatePathExW( NULL, system );
806  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExW failed 0x%08x\n", ret);
807 
808  ret = pPdhValidatePathExW( NULL, uptime );
809  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathExW failed 0x%08x\n", ret);
810 
811  ret = pPdhValidatePathExW( NULL, nonexistent_counter );
812  ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathExW failed 0x%08x\n", ret);
813 
814  ret = pPdhValidatePathExW( NULL, system_uptime );
815  ok(ret == ERROR_SUCCESS, "PdhValidatePathExW failed 0x%08x\n", ret);
816 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR empty[]
Definition: main.c:49
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
static const WCHAR uptime[]
Definition: pdh.c:76
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
int __cdecl system(_In_opt_z_ const char *_Command)
static const WCHAR nonexistent_counter[]
Definition: pdh.c:81
LONG PDH_STATUS
Definition: pdh.h:35
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static const WCHAR system_uptime[]
Definition: pdh.c:79
#define PDH_CSTATUS_BAD_COUNTERNAME
Definition: pdhmsg.h:49

Referenced by START_TEST().

◆ test_PdhValidatePathW()

static void test_PdhValidatePathW ( void  )
static

Definition at line 743 of file pdh.c.

744 {
745  PDH_STATUS ret;
746 
747  static const WCHAR empty[] = {0};
748  static const WCHAR system[] = {'\\','S','y','s','t','e','m',0};
749 
751  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathW failed 0x%08x\n", ret);
752 
754  ok(ret == PDH_INVALID_ARGUMENT, "PdhValidatePathW failed 0x%08x\n", ret);
755 
757  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathW failed 0x%08x\n", ret);
758 
760  ok(ret == PDH_CSTATUS_BAD_COUNTERNAME, "PdhValidatePathW failed 0x%08x\n", ret);
761 
763  ok(ret == PDH_CSTATUS_NO_COUNTER, "PdhValidatePathW failed 0x%08x\n", ret);
764 
766  ok(ret == ERROR_SUCCESS, "PdhValidatePathW failed 0x%08x\n", ret);
767 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR empty[]
Definition: main.c:49
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
static const WCHAR uptime[]
Definition: pdh.c:76
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
int __cdecl system(_In_opt_z_ const char *_Command)
static const WCHAR nonexistent_counter[]
Definition: pdh.c:81
LONG PDH_STATUS
Definition: pdh.h:35
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static const WCHAR system_uptime[]
Definition: pdh.c:79
#define PDH_CSTATUS_BAD_COUNTERNAME
Definition: pdhmsg.h:49
PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR path)
Definition: pdh_main.c:1071

Referenced by START_TEST().

Variable Documentation

◆ DWORD_PTR

Definition at line 32 of file pdh.c.

◆ LPCSTR

PDH_HCOUNTER* static PDH_HCOUNTER* static LONGLONG* static LPCSTR

Definition at line 32 of file pdh.c.

◆ LPCWSTR

Definition at line 33 of file pdh.c.

◆ nonexistent_counter

const WCHAR nonexistent_counter[]
static
Initial value:
=
{'\\','S','y','s','t','e','m','\\','S','y','s','t','e','m',' ','D','o','w','n',' ','T','i','m','e',0}

Definition at line 81 of file pdh.c.

Referenced by test_PdhAddCounterW(), test_PdhAddEnglishCounterW(), test_PdhValidatePathExW(), and test_PdhValidatePathW().

◆ pdh

HMODULE pdh
static

Definition at line 30 of file pdh.c.

Referenced by GetSeparateDebugHeader(), init_function_ptrs(), and render_embed_source_hack().

◆ percentage_processor_time

const WCHAR percentage_processor_time[]
static
Initial value:
=
{'\\','P','r','o','c','e','s','s','o','r','(','_','T','o','t','a','l',')',
'\\','%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0}

Definition at line 83 of file pdh.c.

Referenced by test_PdhAddCounterW(), and test_PdhGetCounterInfoW().

◆ processor_time

const WCHAR processor_time[]
static
Initial value:
=
{'%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0}

Definition at line 74 of file pdh.c.

Referenced by test_PdhLookupPerfIndexByNameW(), and test_PdhLookupPerfNameByIndexW().

◆ system_uptime

const WCHAR system_uptime[]
static
Initial value:
=
{'\\','S','y','s','t','e','m','\\','S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0}

Definition at line 79 of file pdh.c.

Referenced by test_PdhAddEnglishCounterW(), test_PdhValidatePathExW(), and test_PdhValidatePathW().

◆ uptime

const WCHAR uptime[]
static
Initial value:
=
{'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0}

Definition at line 76 of file pdh.c.

Referenced by test_PdhLookupPerfIndexByNameW(), test_PdhLookupPerfNameByIndexW(), test_PdhValidatePathExW(), and test_PdhValidatePathW().