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