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