Sync with trunk (r48545)
[reactos.git] / include / psdk / 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 #define PDH_CVERSION_WIN40 0x0400
41 #define PDH_CVERSION_WIN50 0x0500
42 #define PDH_VERSION 0x0503
43
44 #define PDH_MAX_SCALE 7
45 #define PDH_MIN_SCALE (-7)
46
47 #define PDH_MAX_COUNTER_NAME 1024
48
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
55
56 #define DATA_SOURCE_REGISTRY 0x00000001
57 #define DATA_SOURCE_LOGFILE 0x00000002
58 #define DATA_SOURCE_WBEM 0x00000004
59
60 typedef struct _PDH_FMT_COUNTERVALUE
61 {
62 DWORD CStatus;
63 union
64 {
65 LONG longValue;
66 double doubleValue;
67 LONGLONG largeValue;
68 LPCSTR AnsiStringValue;
69 LPCWSTR WideStringValue;
70 } DUMMYUNIONNAME;
71 } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
72
73 typedef struct _PDH_RAW_COUNTER
74 {
75 DWORD CStatus;
76 FILETIME TimeStamp;
77 LONGLONG FirstValue;
78 LONGLONG SecondValue;
79 DWORD MultiCount;
80 } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
81
82 typedef struct _PDH_COUNTER_PATH_ELEMENTS_A
83 {
84 LPSTR szMachineName;
85 LPSTR szObjectName;
86 LPSTR szInstanceName;
87 LPSTR szParentInstance;
88 DWORD dwInstanceIndex;
89 LPSTR szCounterName;
90 } PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A;
91
92 typedef struct _PDH_COUNTER_PATH_ELEMENTS_W
93 {
94 LPWSTR szMachineName;
95 LPWSTR szObjectName;
96 LPWSTR szInstanceName;
97 LPWSTR szParentInstance;
98 DWORD dwInstanceIndex;
99 LPWSTR szCounterName;
100 } PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W;
101
102 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A
103 {
104 LPSTR szMachineName;
105 GUID ObjectGUID;
106 DWORD dwItemId;
107 LPSTR szInstanceName;
108 } PDH_DATA_ITEM_PATH_ELEMENTS_A, *PPDH_DATA_ITEM_PATH_ELEMENTS_A;
109
110 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W
111 {
112 LPWSTR szMachineName;
113 GUID ObjectGUID;
114 DWORD dwItemId;
115 LPWSTR szInstanceName;
116 } PDH_DATA_ITEM_PATH_ELEMENTS_W, *PPDH_DATA_ITEM_PATH_ELEMENTS_W;
117
118 typedef struct _PDH_COUNTER_INFO_A
119 {
120 DWORD dwLength;
121 DWORD dwType;
122 DWORD CVersion;
123 DWORD CStatus;
124 LONG lScale;
125 LONG lDefaultScale;
126 DWORD_PTR dwUserData;
127 DWORD_PTR dwQueryUserData;
128 LPSTR szFullPath;
129 union
130 {
131 PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
132 PDH_COUNTER_PATH_ELEMENTS_A CounterPath;
133 struct
134 {
135 LPSTR szMachineName;
136 LPSTR szObjectName;
137 LPSTR szInstanceName;
138 LPSTR szParentInstance;
139 DWORD dwInstanceIndex;
140 LPSTR szCounterName;
141 } DUMMYSTRUCTNAME;
142 } DUMMYUNIONNAME;
143 LPSTR szExplainText;
144 DWORD DataBuffer[1];
145 } PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;
146
147 typedef struct _PDH_COUNTER_INFO_W
148 {
149 DWORD dwLength;
150 DWORD dwType;
151 DWORD CVersion;
152 DWORD CStatus;
153 LONG lScale;
154 LONG lDefaultScale;
155 DWORD_PTR dwUserData;
156 DWORD_PTR dwQueryUserData;
157 LPWSTR szFullPath;
158 union
159 {
160 PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
161 PDH_COUNTER_PATH_ELEMENTS_W CounterPath;
162 struct
163 {
164 LPWSTR szMachineName;
165 LPWSTR szObjectName;
166 LPWSTR szInstanceName;
167 LPWSTR szParentInstance;
168 DWORD dwInstanceIndex;
169 LPWSTR szCounterName;
170 } DUMMYSTRUCTNAME;
171 } DUMMYUNIONNAME;
172 LPWSTR szExplainText;
173 DWORD DataBuffer[1];
174 } PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W;
175
176 PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
177 PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
178 #define PdhAddCounter WINELIB_NAME_AW(PdhAddCounter)
179 PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
180 PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
181 #define PdhAddEnglishCounter WINELIB_NAME_AW(PdhAddEnglishCounter)
182 PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY);
183 PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY);
184 PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY, DWORD, HANDLE);
185 PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY,LONGLONG *);
186 PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR, LPCSTR, LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, DWORD, DWORD);
187 PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, DWORD, DWORD);
188 #define PdhEnumObjectItems WINELIB_NAME_AW(PdhEnumObjectItems)
189 PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A);
190 PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
191 #define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
192 PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
193 PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD);
194 PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
195 PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
196 PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
197 PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR, LPCWSTR, LPDWORD);
198 #define PdhLookupPerfIndexByName WINELIB_NAME_AW(PdhLookupPerfIndexByName)
199 PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR, DWORD, LPSTR, LPDWORD);
200 PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR, DWORD, LPWSTR, LPDWORD);
201 #define PdhLookupPerfNameByIndex WINELIB_NAME_AW(PdhLookupPerfNameByIndex)
202 PDH_STATUS WINAPI PdhMakeCounterPathA(PDH_COUNTER_PATH_ELEMENTS_A *, LPSTR, LPDWORD, DWORD);
203 PDH_STATUS WINAPI PdhMakeCounterPathW(PDH_COUNTER_PATH_ELEMENTS_W *, LPWSTR, LPDWORD, DWORD);
204 #define PdhMakeCounterPath WINELIB_NAME_AW(PdhMakeCounterPath)
205 PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *);
206 PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
207 #define PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
208 PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
209 PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
210 PDH_STATUS WINAPI PdhSetDefaultRealTimeDataSource(DWORD);
211 PDH_STATUS WINAPI PdhValidatePathA(LPCSTR);
212 PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR);
213 #define PdhValidatePath WINELIB_NAME_AW(PdhValidatePath)
214 PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG, LPCSTR);
215 PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG, LPCWSTR);
216 #define PdhValidatePathEx WINELIB_NAME_AW(PdhValidatePathEx)
217
218 #ifdef __cplusplus
219 }
220 #endif
221
222 #endif /* _PDH_H_ */