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 | /*
|
---|
22 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
23 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
24 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
25 | * a choice of LGPL license versions is made available with the language indicating
|
---|
26 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
27 | * of the LGPL is applied is otherwise unspecified.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef _PDH_H_
|
---|
31 | #define _PDH_H_
|
---|
32 |
|
---|
33 | #ifdef __WINESRC__
|
---|
34 | # include <windef.h>
|
---|
35 | #else
|
---|
36 | # include <windows.h>
|
---|
37 | #endif
|
---|
38 | #include <winperf.h>
|
---|
39 |
|
---|
40 | #ifdef __cplusplus
|
---|
41 | extern "C" {
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | typedef LONG PDH_STATUS;
|
---|
45 | typedef HANDLE PDH_HQUERY;
|
---|
46 | typedef HANDLE PDH_HCOUNTER;
|
---|
47 | typedef HANDLE PDH_HLOG;
|
---|
48 |
|
---|
49 | #define PDH_CVERSION_WIN40 0x0400
|
---|
50 | #define PDH_CVERSION_WIN50 0x0500
|
---|
51 | #define PDH_VERSION 0x0503
|
---|
52 |
|
---|
53 | #define PDH_MAX_SCALE 7
|
---|
54 | #define PDH_MIN_SCALE (-7)
|
---|
55 |
|
---|
56 | #define PDH_MAX_COUNTER_NAME 1024
|
---|
57 |
|
---|
58 | #define PDH_FMT_LONG 0x00000100
|
---|
59 | #define PDH_FMT_DOUBLE 0x00000200
|
---|
60 | #define PDH_FMT_LARGE 0x00000400
|
---|
61 | #define PDH_FMT_NOSCALE 0x00001000
|
---|
62 | #define PDH_FMT_1000 0x00002000
|
---|
63 | #define PDH_FMT_NOCAP100 0x00008000
|
---|
64 |
|
---|
65 | #define DATA_SOURCE_REGISTRY 0x00000001
|
---|
66 | #define DATA_SOURCE_LOGFILE 0x00000002
|
---|
67 | #define DATA_SOURCE_WBEM 0x00000004
|
---|
68 |
|
---|
69 | typedef struct _PDH_FMT_COUNTERVALUE
|
---|
70 | {
|
---|
71 | DWORD CStatus;
|
---|
72 | union
|
---|
73 | {
|
---|
74 | LONG longValue;
|
---|
75 | double doubleValue;
|
---|
76 | LONGLONG largeValue;
|
---|
77 | LPCSTR AnsiStringValue;
|
---|
78 | LPCWSTR WideStringValue;
|
---|
79 | } DUMMYUNIONNAME;
|
---|
80 | } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
|
---|
81 |
|
---|
82 | typedef struct _PDH_RAW_COUNTER
|
---|
83 | {
|
---|
84 | DWORD CStatus;
|
---|
85 | FILETIME TimeStamp;
|
---|
86 | LONGLONG FirstValue;
|
---|
87 | LONGLONG SecondValue;
|
---|
88 | DWORD MultiCount;
|
---|
89 | } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
|
---|
90 |
|
---|
91 | typedef struct _PDH_COUNTER_PATH_ELEMENTS_A
|
---|
92 | {
|
---|
93 | LPSTR szMachineName;
|
---|
94 | LPSTR szObjectName;
|
---|
95 | LPSTR szInstanceName;
|
---|
96 | LPSTR szParentInstance;
|
---|
97 | DWORD dwInstanceIndex;
|
---|
98 | LPSTR szCounterName;
|
---|
99 | } PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A;
|
---|
100 |
|
---|
101 | typedef struct _PDH_COUNTER_PATH_ELEMENTS_W
|
---|
102 | {
|
---|
103 | LPWSTR szMachineName;
|
---|
104 | LPWSTR szObjectName;
|
---|
105 | LPWSTR szInstanceName;
|
---|
106 | LPWSTR szParentInstance;
|
---|
107 | DWORD dwInstanceIndex;
|
---|
108 | LPWSTR szCounterName;
|
---|
109 | } PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W;
|
---|
110 |
|
---|
111 | typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A
|
---|
112 | {
|
---|
113 | LPSTR szMachineName;
|
---|
114 | GUID ObjectGUID;
|
---|
115 | DWORD dwItemId;
|
---|
116 | LPSTR szInstanceName;
|
---|
117 | } PDH_DATA_ITEM_PATH_ELEMENTS_A, *PPDH_DATA_ITEM_PATH_ELEMENTS_A;
|
---|
118 |
|
---|
119 | typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W
|
---|
120 | {
|
---|
121 | LPWSTR szMachineName;
|
---|
122 | GUID ObjectGUID;
|
---|
123 | DWORD dwItemId;
|
---|
124 | LPWSTR szInstanceName;
|
---|
125 | } PDH_DATA_ITEM_PATH_ELEMENTS_W, *PPDH_DATA_ITEM_PATH_ELEMENTS_W;
|
---|
126 |
|
---|
127 | typedef struct _PDH_COUNTER_INFO_A
|
---|
128 | {
|
---|
129 | DWORD dwLength;
|
---|
130 | DWORD dwType;
|
---|
131 | DWORD CVersion;
|
---|
132 | DWORD CStatus;
|
---|
133 | LONG lScale;
|
---|
134 | LONG lDefaultScale;
|
---|
135 | DWORD_PTR dwUserData;
|
---|
136 | DWORD_PTR dwQueryUserData;
|
---|
137 | LPSTR szFullPath;
|
---|
138 | union
|
---|
139 | {
|
---|
140 | PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
|
---|
141 | PDH_COUNTER_PATH_ELEMENTS_A CounterPath;
|
---|
142 | struct
|
---|
143 | {
|
---|
144 | LPSTR szMachineName;
|
---|
145 | LPSTR szObjectName;
|
---|
146 | LPSTR szInstanceName;
|
---|
147 | LPSTR szParentInstance;
|
---|
148 | DWORD dwInstanceIndex;
|
---|
149 | LPSTR szCounterName;
|
---|
150 | } DUMMYSTRUCTNAME;
|
---|
151 | } DUMMYUNIONNAME;
|
---|
152 | LPSTR szExplainText;
|
---|
153 | DWORD DataBuffer[1];
|
---|
154 | } PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;
|
---|
155 |
|
---|
156 | typedef struct _PDH_COUNTER_INFO_W
|
---|
157 | {
|
---|
158 | DWORD dwLength;
|
---|
159 | DWORD dwType;
|
---|
160 | DWORD CVersion;
|
---|
161 | DWORD CStatus;
|
---|
162 | LONG lScale;
|
---|
163 | LONG lDefaultScale;
|
---|
164 | DWORD_PTR dwUserData;
|
---|
165 | DWORD_PTR dwQueryUserData;
|
---|
166 | LPWSTR szFullPath;
|
---|
167 | union
|
---|
168 | {
|
---|
169 | PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
|
---|
170 | PDH_COUNTER_PATH_ELEMENTS_W CounterPath;
|
---|
171 | struct
|
---|
172 | {
|
---|
173 | LPWSTR szMachineName;
|
---|
174 | LPWSTR szObjectName;
|
---|
175 | LPWSTR szInstanceName;
|
---|
176 | LPWSTR szParentInstance;
|
---|
177 | DWORD dwInstanceIndex;
|
---|
178 | LPWSTR szCounterName;
|
---|
179 | } DUMMYSTRUCTNAME;
|
---|
180 | } DUMMYUNIONNAME;
|
---|
181 | LPWSTR szExplainText;
|
---|
182 | DWORD DataBuffer[1];
|
---|
183 | } PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W;
|
---|
184 |
|
---|
185 | PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
|
---|
186 | PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
|
---|
187 | #define PdhAddCounter WINELIB_NAME_AW(PdhAddCounter)
|
---|
188 | PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
|
---|
189 | PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
|
---|
190 | #define PdhAddEnglishCounter WINELIB_NAME_AW(PdhAddEnglishCounter)
|
---|
191 | PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY);
|
---|
192 | PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY);
|
---|
193 | PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY, DWORD, HANDLE);
|
---|
194 | PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY,LONGLONG *);
|
---|
195 | PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR, LPCSTR, LPCSTR, LPSTR, LPDWORD, LPSTR, LPDWORD, DWORD, DWORD);
|
---|
196 | PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR, LPCWSTR, LPCWSTR, LPWSTR, LPDWORD, LPWSTR, LPDWORD, DWORD, DWORD);
|
---|
197 | #define PdhEnumObjectItems WINELIB_NAME_AW(PdhEnumObjectItems)
|
---|
198 | PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A);
|
---|
199 | PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
|
---|
200 | #define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
|
---|
201 | PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
|
---|
202 | PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD);
|
---|
203 | PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
|
---|
204 | PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
|
---|
205 | PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
|
---|
206 | PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR, LPCWSTR, LPDWORD);
|
---|
207 | #define PdhLookupPerfIndexByName WINELIB_NAME_AW(PdhLookupPerfIndexByName)
|
---|
208 | PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR, DWORD, LPSTR, LPDWORD);
|
---|
209 | PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR, DWORD, LPWSTR, LPDWORD);
|
---|
210 | #define PdhLookupPerfNameByIndex WINELIB_NAME_AW(PdhLookupPerfNameByIndex)
|
---|
211 | PDH_STATUS WINAPI PdhMakeCounterPathA(PDH_COUNTER_PATH_ELEMENTS_A *, LPSTR, LPDWORD, DWORD);
|
---|
212 | PDH_STATUS WINAPI PdhMakeCounterPathW(PDH_COUNTER_PATH_ELEMENTS_W *, LPWSTR, LPDWORD, DWORD);
|
---|
213 | #define PdhMakeCounterPath WINELIB_NAME_AW(PdhMakeCounterPath)
|
---|
214 | PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *);
|
---|
215 | PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
|
---|
216 | #define PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
|
---|
217 | PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
|
---|
218 | PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
|
---|
219 | PDH_STATUS WINAPI PdhSetDefaultRealTimeDataSource(DWORD);
|
---|
220 | PDH_STATUS WINAPI PdhValidatePathA(LPCSTR);
|
---|
221 | PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR);
|
---|
222 | #define PdhValidatePath WINELIB_NAME_AW(PdhValidatePath)
|
---|
223 | PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG, LPCSTR);
|
---|
224 | PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG, LPCWSTR);
|
---|
225 | #define PdhValidatePathEx WINELIB_NAME_AW(PdhValidatePathEx)
|
---|
226 |
|
---|
227 | #ifdef __cplusplus
|
---|
228 | }
|
---|
229 | #endif
|
---|
230 |
|
---|
231 | #endif /* _PDH_H_ */
|
---|