setupapi: Add missing prototypes and definitions, and change function prototypes...
[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
39 #define PDH_MAX_SCALE 7
40 #define PDH_MIN_SCALE (-7)
41
42 #define PDH_MAX_COUNTER_NAME    1024
43
44 #define PDH_FMT_LONG        0x00000100
45 #define PDH_FMT_DOUBLE      0x00000200
46 #define PDH_FMT_LARGE       0x00000400
47 #define PDH_FMT_NOSCALE     0x00001000
48 #define PDH_FMT_1000        0x00002000
49 #define PDH_FMT_NOCAP100    0x00008000
50
51 typedef struct _PDH_FMT_COUNTERVALUE
52 {
53     DWORD CStatus;
54     union
55     {
56         LONG     longValue;
57         double   doubleValue;
58         LONGLONG largeValue;
59         LPCSTR   AnsiStringValue;
60         LPCWSTR  WideStringValue;
61     } DUMMYUNIONNAME;
62 } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
63
64 typedef struct _PDH_RAW_COUNTER
65 {
66     DWORD    CStatus;
67     FILETIME TimeStamp;
68     LONGLONG FirstValue;
69     LONGLONG SecondValue;
70     DWORD    MultiCount;
71 } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
72
73 typedef struct _PDH_COUNTER_PATH_ELEMENTS_A
74 {
75     LPSTR szMachineName;
76     LPSTR szObjectName;
77     LPSTR szInstanceName;
78     LPSTR szParentInstance;
79     DWORD dwInstanceIndex;
80     LPSTR szCounterName;
81 } PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A;
82
83 typedef struct _PDH_COUNTER_PATH_ELEMENTS_W
84 {
85     LPWSTR szMachineName;
86     LPWSTR szObjectName;
87     LPWSTR szInstanceName;
88     LPWSTR szParentInstance;
89     DWORD  dwInstanceIndex;
90     LPWSTR szCounterName;
91 } PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W;
92
93 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A
94 {
95     LPSTR szMachineName;
96     GUID  ObjectGUID;
97     DWORD dwItemId;
98     LPSTR szInstanceName;
99 } PDH_DATA_ITEM_PATH_ELEMENTS_A, *PPDH_DATA_ITEM_PATH_ELEMENTS_A;
100
101 typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W
102 {
103     LPWSTR szMachineName;
104     GUID   ObjectGUID;
105     DWORD  dwItemId;
106     LPWSTR szInstanceName;
107 } PDH_DATA_ITEM_PATH_ELEMENTS_W, *PPDH_DATA_ITEM_PATH_ELEMENTS_W;
108
109 typedef struct _PDH_COUNTER_INFO_A
110 {
111     DWORD     dwLength;
112     DWORD     dwType;
113     DWORD     CVersion;
114     DWORD     CStatus;
115     LONG      lScale;
116     LONG      lDefaultScale;
117     DWORD_PTR dwUserData;
118     DWORD_PTR dwQueryUserData;
119     LPSTR     szFullPath;
120     union
121     {
122         PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
123         PDH_COUNTER_PATH_ELEMENTS_A   CounterPath;
124         struct
125         {
126             LPSTR szMachineName;
127             LPSTR szObjectName;
128             LPSTR szInstanceName;
129             LPSTR szParentInstance;
130             DWORD dwInstanceIndex;
131             LPSTR szCounterName;
132         } DUMMYSTRUCTNAME;
133     } DUMMYUNIONNAME;
134     LPSTR szExplainText;
135     DWORD DataBuffer[1];
136 } PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;
137
138 typedef struct _PDH_COUNTER_INFO_W
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     LPWSTR    szFullPath;
149     union
150     {
151         PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
152         PDH_COUNTER_PATH_ELEMENTS_W   CounterPath;
153         struct
154         {
155             LPWSTR szMachineName;
156             LPWSTR szObjectName;
157             LPWSTR szInstanceName;
158             LPWSTR szParentInstance;
159             DWORD  dwInstanceIndex;
160             LPWSTR szCounterName;
161         } DUMMYSTRUCTNAME;
162     } DUMMYUNIONNAME;
163     LPWSTR szExplainText;
164     DWORD DataBuffer[1];
165 } PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W;
166
167 PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
168 PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
169 #define    PdhAddCounter WINELIB_NAME_AW(PdhAddCounter)
170 PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *);
171 PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *);
172 #define    PdhAddEnglishCounter WINELIB_NAME_AW(PdhAddEnglishCounter)
173 PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY);
174 PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY);
175 PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY,LONGLONG *);
176 PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A);
177 PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W);
178 #define    PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo)
179 PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *);
180 PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE);
181 PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER);
182 PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR, LPCSTR, LPDWORD);
183 PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR, LPCWSTR, LPDWORD);
184 #define    PdhLookupPerfIndexByName WINELIB_NAME_AW(PdhLookupPerfIndexByName)
185 PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR, DWORD, LPSTR, LPDWORD);
186 PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR, DWORD, LPWSTR, LPDWORD);
187 #define    PdhLookupPerfNameByIndex WINELIB_NAME_AW(PdhLookupPerfNameByIndex)
188 PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *);
189 PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *);
190 #define    PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery)
191 PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER);
192 PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG);
193
194 #ifdef __cplusplus
195 }
196 #endif
197
198 #endif /* _PDH_H_ */