hidclass.sys: Return STATUS_INVALID_USER_BUFFER if buffer_len is 0.
[wine.git] / include / pdh.h
blob3d688bd8ded77831f1ee27de84cf19aa10d7670d
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 #include <windows.h>
25 #include <winperf.h>
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 typedef LONG PDH_STATUS;
32 typedef HANDLE PDH_HQUERY;
33 typedef HANDLE PDH_HCOUNTER;
34 typedef HANDLE PDH_HLOG;
36 typedef PDH_HCOUNTER HCOUNTER;
37 typedef PDH_HQUERY HQUERY;
38 typedef PDH_HLOG HLOG;
40 #define PDH_CVERSION_WIN40 0x0400
41 #define PDH_CVERSION_WIN50 0x0500
42 #define PDH_VERSION 0x0503
44 #define PDH_MAX_SCALE 7
45 #define PDH_MIN_SCALE (-7)
47 #define PDH_MAX_COUNTER_NAME 1024
49 #define PDH_FMT_LONG 0x00000100
50 #define PDH_FMT_DOUBLE 0x00000200
51 #define PDH_FMT_LARGE 0x00000400
52 #define PDH_FMT_NOSCALE 0x00001000
53 #define PDH_FMT_1000 0x00002000
54 #define PDH_FMT_NOCAP100 0x00008000
56 #define DATA_SOURCE_REGISTRY 0x00000001
57 #define DATA_SOURCE_LOGFILE 0x00000002
58 #define DATA_SOURCE_WBEM 0x00000004
60 #ifdef WINE_NO_UNICODE_MACROS
61 # define DECL_PDH_TYPE_AW(name) /* nothing */
62 #else /* WINE_NO_UNICODE_MACROS */
63 # ifdef UNICODE
64 # define DECL_PDH_TYPE_AW(name) typedef name##_W name;
65 # else
66 # define DECL_PDH_TYPE_AW(name) typedef name##_A name;
67 # endif
68 #endif /* WINE_NO_UNICODE_MACROS */
70 typedef struct _PDH_FMT_COUNTERVALUE
72 DWORD CStatus;
73 union
75 LONG longValue;
76 double doubleValue;
77 LONGLONG largeValue;
78 LPCSTR AnsiStringValue;
79 LPCWSTR WideStringValue;
80 } DUMMYUNIONNAME;
81 } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
83 typedef struct _PDH_RAW_COUNTER
85 DWORD CStatus;
86 FILETIME TimeStamp;
87 LONGLONG FirstValue;
88 LONGLONG SecondValue;
89 DWORD MultiCount;
90 } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
92 typedef struct _PDH_COUNTER_PATH_ELEMENTS_A
94 LPSTR szMachineName;
95 LPSTR szObjectName;
96 LPSTR szInstanceName;
97 LPSTR szParentInstance;
98 DWORD dwInstanceIndex;
99 LPSTR szCounterName;
100 } PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A;
102 typedef struct _PDH_COUNTER_PATH_ELEMENTS_W
104 LPWSTR szMachineName;
105 LPWSTR szObjectName;
106 LPWSTR szInstanceName;
107 LPWSTR szParentInstance;
108 DWORD dwInstanceIndex;
109 LPWSTR szCounterName;
110 } PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W;
112 DECL_PDH_TYPE_AW(PDH_COUNTER_PATH_ELEMENTS)
113 DECL_PDH_TYPE_AW(PPDH_COUNTER_PATH_ELEMENTS)
115 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A
117 LPSTR szMachineName;
118 GUID ObjectGUID;
119 DWORD dwItemId;
120 LPSTR szInstanceName;
121 } PDH_DATA_ITEM_PATH_ELEMENTS_A, *PPDH_DATA_ITEM_PATH_ELEMENTS_A;
123 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W
125 LPWSTR szMachineName;
126 GUID ObjectGUID;
127 DWORD dwItemId;
128 LPWSTR szInstanceName;
129 } PDH_DATA_ITEM_PATH_ELEMENTS_W, *PPDH_DATA_ITEM_PATH_ELEMENTS_W;
131 DECL_PDH_TYPE_AW(PDH_DATA_ITEM_PATH_ELEMENTS)
132 DECL_PDH_TYPE_AW(PPDH_DATA_ITEM_PATH_ELEMENTS)
134 typedef struct _PDH_COUNTER_INFO_A
136 DWORD dwLength;
137 DWORD dwType;
138 DWORD CVersion;
139 DWORD CStatus;
140 LONG lScale;
141 LONG lDefaultScale;
142 DWORD_PTR dwUserData;
143 DWORD_PTR dwQueryUserData;
144 LPSTR szFullPath;
145 union
147 PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
148 PDH_COUNTER_PATH_ELEMENTS_A CounterPath;
149 struct
151 LPSTR szMachineName;
152 LPSTR szObjectName;
153 LPSTR szInstanceName;
154 LPSTR szParentInstance;
155 DWORD dwInstanceIndex;
156 LPSTR szCounterName;
157 } DUMMYSTRUCTNAME;
158 } DUMMYUNIONNAME;
159 LPSTR szExplainText;
160 DWORD DataBuffer[1];
161 } PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;
163 typedef struct _PDH_COUNTER_INFO_W
165 DWORD dwLength;
166 DWORD dwType;
167 DWORD CVersion;
168 DWORD CStatus;
169 LONG lScale;
170 LONG lDefaultScale;
171 DWORD_PTR dwUserData;
172 DWORD_PTR dwQueryUserData;
173 LPWSTR szFullPath;
174 union
176 PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
177 PDH_COUNTER_PATH_ELEMENTS_W CounterPath;
178 struct
180 LPWSTR szMachineName;
181 LPWSTR szObjectName;
182 LPWSTR szInstanceName;
183 LPWSTR szParentInstance;
184 DWORD dwInstanceIndex;
185 LPWSTR szCounterName;
186 } DUMMYSTRUCTNAME;
187 } DUMMYUNIONNAME;
188 LPWSTR szExplainText;
189 DWORD DataBuffer[1];
190 } PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W;
192 DECL_PDH_TYPE_AW(PDH_COUNTER_INFO)
193 DECL_PDH_TYPE_AW(PPDH_COUNTER_INFO)
195 #undef DECL_PDH_TYPE_AW
197 PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
198 PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
199 #define PdhAddCounter WINELIB_NAME_AW(PdhAddCounter)
200 PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
201 PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
202 #define PdhAddEnglishCounter WINELIB_NAME_AW(PdhAddEnglishCounter)
203 PDH_STATUS WINAPI PdhBindInputDataSourceA(PDH_HLOG *, const char *);
204 PDH_STATUS WINAPI PdhBindInputDataSourceW(PDH_HLOG *, const WCHAR *);
205 #define PdhBindInputDataSource WINELIB_NAME_AW(PdhBindInputDataSource)
206 PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY);
207 PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY);
208 PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY, DWORD, HANDLE);
209 PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY,LONGLONG *);
210 PDH_STATUS WINAPI PdhEnumObjectsA(LPCSTR,LPCSTR,PZZSTR,LPDWORD,DWORD,BOOL);
211 PDH_STATUS WINAPI PdhEnumObjectsW(LPCWSTR,LPCWSTR,PZZWSTR,LPDWORD,DWORD,BOOL);
212 #define PdhEnumObjects WINELIB_NAME_AW(PdhEnumObjects)
213 PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR, LPCSTR, LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, DWORD, DWORD);
214 PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, DWORD, DWORD);
215 #define PdhEnumObjectItems WINELIB_NAME_AW(PdhEnumObjectItems)
216 PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A);
217 PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
218 #define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
219 PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
220 PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD);
221 PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
222 PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
223 PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
224 PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR, LPCWSTR, LPDWORD);
225 #define PdhLookupPerfIndexByName WINELIB_NAME_AW(PdhLookupPerfIndexByName)
226 PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR, DWORD, LPSTR, LPDWORD);
227 PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR, DWORD, LPWSTR, LPDWORD);
228 #define PdhLookupPerfNameByIndex WINELIB_NAME_AW(PdhLookupPerfNameByIndex)
229 PDH_STATUS WINAPI PdhMakeCounterPathA(PDH_COUNTER_PATH_ELEMENTS_A *, LPSTR, LPDWORD, DWORD);
230 PDH_STATUS WINAPI PdhMakeCounterPathW(PDH_COUNTER_PATH_ELEMENTS_W *, LPWSTR, LPDWORD, DWORD);
231 #define PdhMakeCounterPath WINELIB_NAME_AW(PdhMakeCounterPath)
232 PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *);
233 PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
234 #define PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
235 PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
236 PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
237 PDH_STATUS WINAPI PdhSetDefaultRealTimeDataSource(DWORD);
238 PDH_STATUS WINAPI PdhValidatePathA(LPCSTR);
239 PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR);
240 #define PdhValidatePath WINELIB_NAME_AW(PdhValidatePath)
241 PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG, LPCSTR);
242 PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG, LPCWSTR);
243 #define PdhValidatePathEx WINELIB_NAME_AW(PdhValidatePathEx)
245 #ifdef __cplusplus
247 #endif
249 #endif /* _PDH_H_ */