push 7b30519979490489283b8c9fd6a7de5d4bea772e
[wine/hacks.git] / include / pdh.h
blob082f5ccea941b5941545d165ed2c901d9679df94
1 /*
2 * Performance Data Helper
4 * Copyright 2007 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _PDH_H_
22 #define _PDH_H_
24 #ifdef __WINESRC__
25 # include <windef.h>
26 #else
27 # include <windows.h>
28 #endif
29 #include <winperf.h>
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 typedef LONG PDH_STATUS;
36 typedef HANDLE PDH_HQUERY;
37 typedef HANDLE PDH_HCOUNTER;
38 typedef HANDLE PDH_HLOG;
40 #define PDH_MAX_SCALE 7
41 #define PDH_MIN_SCALE (-7)
43 #define PDH_MAX_COUNTER_NAME 1024
45 #define PDH_FMT_LONG 0x00000100
46 #define PDH_FMT_DOUBLE 0x00000200
47 #define PDH_FMT_LARGE 0x00000400
48 #define PDH_FMT_NOSCALE 0x00001000
49 #define PDH_FMT_1000 0x00002000
50 #define PDH_FMT_NOCAP100 0x00008000
52 typedef struct _PDH_FMT_COUNTERVALUE
54 DWORD CStatus;
55 union
57 LONG longValue;
58 double doubleValue;
59 LONGLONG largeValue;
60 LPCSTR AnsiStringValue;
61 LPCWSTR WideStringValue;
62 } DUMMYUNIONNAME;
63 } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
65 typedef struct _PDH_RAW_COUNTER
67 DWORD CStatus;
68 FILETIME TimeStamp;
69 LONGLONG FirstValue;
70 LONGLONG SecondValue;
71 DWORD MultiCount;
72 } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
74 typedef struct _PDH_COUNTER_PATH_ELEMENTS_A
76 LPSTR szMachineName;
77 LPSTR szObjectName;
78 LPSTR szInstanceName;
79 LPSTR szParentInstance;
80 DWORD dwInstanceIndex;
81 LPSTR szCounterName;
82 } PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A;
84 typedef struct _PDH_COUNTER_PATH_ELEMENTS_W
86 LPWSTR szMachineName;
87 LPWSTR szObjectName;
88 LPWSTR szInstanceName;
89 LPWSTR szParentInstance;
90 DWORD dwInstanceIndex;
91 LPWSTR szCounterName;
92 } PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W;
94 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A
96 LPSTR szMachineName;
97 GUID ObjectGUID;
98 DWORD dwItemId;
99 LPSTR szInstanceName;
100 } PDH_DATA_ITEM_PATH_ELEMENTS_A, *PPDH_DATA_ITEM_PATH_ELEMENTS_A;
102 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W
104 LPWSTR szMachineName;
105 GUID ObjectGUID;
106 DWORD dwItemId;
107 LPWSTR szInstanceName;
108 } PDH_DATA_ITEM_PATH_ELEMENTS_W, *PPDH_DATA_ITEM_PATH_ELEMENTS_W;
110 typedef struct _PDH_COUNTER_INFO_A
112 DWORD dwLength;
113 DWORD dwType;
114 DWORD CVersion;
115 DWORD CStatus;
116 LONG lScale;
117 LONG lDefaultScale;
118 DWORD_PTR dwUserData;
119 DWORD_PTR dwQueryUserData;
120 LPSTR szFullPath;
121 union
123 PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
124 PDH_COUNTER_PATH_ELEMENTS_A CounterPath;
125 struct
127 LPSTR szMachineName;
128 LPSTR szObjectName;
129 LPSTR szInstanceName;
130 LPSTR szParentInstance;
131 DWORD dwInstanceIndex;
132 LPSTR szCounterName;
133 } DUMMYSTRUCTNAME;
134 } DUMMYUNIONNAME;
135 LPSTR szExplainText;
136 DWORD DataBuffer[1];
137 } PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;
139 typedef struct _PDH_COUNTER_INFO_W
141 DWORD dwLength;
142 DWORD dwType;
143 DWORD CVersion;
144 DWORD CStatus;
145 LONG lScale;
146 LONG lDefaultScale;
147 DWORD_PTR dwUserData;
148 DWORD_PTR dwQueryUserData;
149 LPWSTR szFullPath;
150 union
152 PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
153 PDH_COUNTER_PATH_ELEMENTS_W CounterPath;
154 struct
156 LPWSTR szMachineName;
157 LPWSTR szObjectName;
158 LPWSTR szInstanceName;
159 LPWSTR szParentInstance;
160 DWORD dwInstanceIndex;
161 LPWSTR szCounterName;
162 } DUMMYSTRUCTNAME;
163 } DUMMYUNIONNAME;
164 LPWSTR szExplainText;
165 DWORD DataBuffer[1];
166 } PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W;
168 PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
169 PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
170 #define PdhAddCounter WINELIB_NAME_AW(PdhAddCounter)
171 PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
172 PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
173 #define PdhAddEnglishCounter WINELIB_NAME_AW(PdhAddEnglishCounter)
174 PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY);
175 PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY);
176 PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY, DWORD, HANDLE);
177 PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY,LONGLONG *);
178 PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR, LPCSTR, LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, DWORD, DWORD);
179 PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, DWORD, DWORD);
180 #define PdhEnumObjectItems WINELIB_NAME_AW(PdhEnumObjectItems)
181 PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A);
182 PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
183 #define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
184 PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
185 PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
186 PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
187 PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
188 PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR, LPCWSTR, LPDWORD);
189 #define PdhLookupPerfIndexByName WINELIB_NAME_AW(PdhLookupPerfIndexByName)
190 PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR, DWORD, LPSTR, LPDWORD);
191 PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR, DWORD, LPWSTR, LPDWORD);
192 #define PdhLookupPerfNameByIndex WINELIB_NAME_AW(PdhLookupPerfNameByIndex)
193 PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *);
194 PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
195 #define PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
196 PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
197 PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
198 PDH_STATUS WINAPI PdhValidatePathA(LPCSTR);
199 PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR);
200 #define PdhValidatePath WINELIB_NAME_AW(PdhValidatePath)
201 PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG, LPCSTR);
202 PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG, LPCWSTR);
203 #define PdhValidatePathEx WINELIB_NAME_AW(PdhValidatePathEx)
205 #ifdef __cplusplus
207 #endif
209 #endif /* _PDH_H_ */