include/winhttp.h: Add WINHTTP_TIME_FORMAT_BUFSIZE.
[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 #define PDH_MAX_SCALE 7
41 #define PDH_MIN_SCALE (-7)
42
43 #define PDH_MAX_COUNTER_NAME    1024
44
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
51
52 typedef struct _PDH_FMT_COUNTERVALUE
53 {
54     DWORD CStatus;
55     union
56     {
57         LONG     longValue;
58         double   doubleValue;
59         LONGLONG largeValue;
60         LPCSTR   AnsiStringValue;
61         LPCWSTR  WideStringValue;
62     } DUMMYUNIONNAME;
63 } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
64
65 typedef struct _PDH_RAW_COUNTER
66 {
67     DWORD    CStatus;
68     FILETIME TimeStamp;
69     LONGLONG FirstValue;
70     LONGLONG SecondValue;
71     DWORD    MultiCount;
72 } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
73
74 typedef struct _PDH_COUNTER_PATH_ELEMENTS_A
75 {
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;
83
84 typedef struct _PDH_COUNTER_PATH_ELEMENTS_W
85 {
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;
93
94 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A
95 {
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;
101
102 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W
103 {
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;
109
110 typedef struct _PDH_COUNTER_INFO_A
111 {
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
122     {
123         PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
124         PDH_COUNTER_PATH_ELEMENTS_A   CounterPath;
125         struct
126         {
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;
138
139 typedef struct _PDH_COUNTER_INFO_W
140 {
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
151     {
152         PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
153         PDH_COUNTER_PATH_ELEMENTS_W   CounterPath;
154         struct
155         {
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;
167
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 PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A);
179 PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
180 #define    PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
181 PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
182 PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
183 PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
184 PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
185 PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR, LPCWSTR, LPDWORD);
186 #define    PdhLookupPerfIndexByName WINELIB_NAME_AW(PdhLookupPerfIndexByName)
187 PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR, DWORD, LPSTR, LPDWORD);
188 PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR, DWORD, LPWSTR, LPDWORD);
189 #define    PdhLookupPerfNameByIndex WINELIB_NAME_AW(PdhLookupPerfNameByIndex)
190 PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *);
191 PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
192 #define    PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
193 PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
194 PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
195 PDH_STATUS WINAPI PdhValidatePathA(LPCSTR);
196 PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR);
197 #define    PdhValidatePath WINELIB_NAME_AW(PdhValidatePath)
198 PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG, LPCSTR);
199 PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG, LPCWSTR);
200 #define    PdhValidatePathEx WINELIB_NAME_AW(PdhValidatePathEx)
201
202 #ifdef __cplusplus
203 }
204 #endif
205
206 #endif /* _PDH_H_ */