From 24a1ae11fb759b342987398310eec59c7d2e41ad Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 25 Jun 2007 21:09:48 +0200 Subject: [PATCH] pdh: Add public headers. --- include/Makefile.in | 3 + include/pdh.h | 186 ++++++++++++++++++++++++++++++++++++++++++++ include/pdhmsg.h | 32 ++++++++ include/winperf.h | 65 ++++++++++++++++ 4 files changed, 286 insertions(+) create mode 100644 include/pdh.h create mode 100644 include/pdhmsg.h create mode 100644 include/winperf.h diff --git a/include/Makefile.in b/include/Makefile.in index ee6d1930d66..754df2d26ba 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -282,6 +282,8 @@ SRCDIR_INCLUDES = \ oleauto.h \ olectl.h \ oledlg.h \ + pdh.h \ + pdhmsg.h \ pktdef.h \ poppack.h \ powrprof.h \ @@ -359,6 +361,7 @@ SRCDIR_INCLUDES = \ winnls.h \ winnls32.h \ winnt.h \ + winperf.h \ winreg.h \ winres.h \ winresrc.h \ diff --git a/include/pdh.h b/include/pdh.h new file mode 100644 index 00000000000..de5dad3db38 --- /dev/null +++ b/include/pdh.h @@ -0,0 +1,186 @@ +/* + * Performance Data Helper + * + * Copyright 2007 Hans Leidekker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _PDH_H_ +#define _PDH_H_ + +#ifdef __WINESRC__ +# include +#else +# include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef LONG PDH_STATUS; +typedef HANDLE PDH_HQUERY; +typedef HANDLE PDH_HCOUNTER; + +#define PDH_MAX_SCALE 7 +#define PDH_MIN_SCALE (-7) + +#define PDH_FMT_LONG 0x00000100 +#define PDH_FMT_DOUBLE 0x00000200 +#define PDH_FMT_LARGE 0x00000400 +#define PDH_FMT_NOSCALE 0x00001000 +#define PDH_FMT_1000 0x00002000 +#define PDH_FMT_NOCAP100 0x00008000 + +typedef struct _PDH_FMT_COUNTERVALUE +{ + DWORD CStatus; + union + { + LONG longValue; + double doubleValue; + LONGLONG largeValue; + LPCSTR AnsiStringValue; + LPCWSTR WideStringValue; + } DUMMYUNIONNAME; +} PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE; + +typedef struct _PDH_RAW_COUNTER +{ + DWORD CStatus; + FILETIME TimeStamp; + LONGLONG FirstValue; + LONGLONG SecondValue; + DWORD MultiCount; +} PDH_RAW_COUNTER, *PPDH_RAW_COUNTER; + +typedef struct _PDH_COUNTER_PATH_ELEMENTS_A +{ + LPSTR szMachineName; + LPSTR szObjectName; + LPSTR szInstanceName; + LPSTR szParentInstance; + DWORD dwInstanceIndex; + LPSTR szCounterName; +} PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A; + +typedef struct _PDH_COUNTER_PATH_ELEMENTS_W +{ + LPWSTR szMachineName; + LPWSTR szObjectName; + LPWSTR szInstanceName; + LPWSTR szParentInstance; + DWORD dwInstanceIndex; + LPWSTR szCounterName; +} PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W; + +typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A +{ + LPSTR szMachineName; + GUID ObjectGUID; + DWORD dwItemId; + LPSTR szInstanceName; +} PDH_DATA_ITEM_PATH_ELEMENTS_A, *PPDH_DATA_ITEM_PATH_ELEMENTS_A; + +typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W +{ + LPWSTR szMachineName; + GUID ObjectGUID; + DWORD dwItemId; + LPWSTR szInstanceName; +} PDH_DATA_ITEM_PATH_ELEMENTS_W, *PPDH_DATA_ITEM_PATH_ELEMENTS_W; + +typedef struct _PDH_COUNTER_INFO_A +{ + DWORD dwLength; + DWORD dwType; + DWORD CVersion; + DWORD CStatus; + LONG lScale; + LONG lDefaultScale; + DWORD_PTR dwUserData; + DWORD_PTR dwQueryUserData; + LPSTR szFullPath; + union + { + PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath; + PDH_COUNTER_PATH_ELEMENTS_A CounterPath; + struct + { + LPSTR szMachineName; + LPSTR szObjectName; + LPSTR szInstanceName; + LPSTR szParentInstance; + DWORD dwInstanceIndex; + LPSTR szCounterName; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + LPSTR szExplainText; + DWORD DataBuffer[1]; +} PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A; + +typedef struct _PDH_COUNTER_INFO_W +{ + DWORD dwLength; + DWORD dwType; + DWORD CVersion; + DWORD CStatus; + LONG lScale; + LONG lDefaultScale; + DWORD_PTR dwUserData; + DWORD_PTR dwQueryUserData; + LPWSTR szFullPath; + union + { + PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath; + PDH_COUNTER_PATH_ELEMENTS_W CounterPath; + struct + { + LPWSTR szMachineName; + LPWSTR szObjectName; + LPWSTR szInstanceName; + LPWSTR szParentInstance; + DWORD dwInstanceIndex; + LPWSTR szCounterName; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; + LPWSTR szExplainText; + DWORD DataBuffer[1]; +} PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W; + +PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY, LPCSTR, DWORD_PTR, PDH_HCOUNTER *); +PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY, LPCWSTR, DWORD_PTR, PDH_HCOUNTER *); +#define PdhAddCounter WINELIB_NAME_AW(PdhAddCounter) +PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY); +PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY); +PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_A); +PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER, BOOLEAN, LPDWORD, PPDH_COUNTER_INFO_W); +#define PdhGetCounterInfo WINELIB_NAME_AW(PdhGetCounterInfo) +PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER, LONGLONG *); +PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE); +PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER, LPDWORD, PPDH_RAW_COUNTER); +PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR, DWORD_PTR, PDH_HQUERY *); +PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR, DWORD_PTR, PDH_HQUERY *); +#define PdhOpenQuery WINELIB_NAME_AW(PdhOpenQuery) +PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER); +PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER, LONG); + +#ifdef __cplusplus +} +#endif + +#endif /* _PDH_H_ */ diff --git a/include/pdhmsg.h b/include/pdhmsg.h new file mode 100644 index 00000000000..3b0812f2097 --- /dev/null +++ b/include/pdhmsg.h @@ -0,0 +1,32 @@ +/* + * Performance Data Helper + * + * Copyright 2007 Hans Leidekker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _PDH_MSG_H_ +#define _PDH_MSG_H_ + +#define PDH_CSTATUS_VALID_DATA 0x00000000 +#define PDH_MORE_DATA 0x800007d2 +#define PDH_CSTATUS_NO_COUNTER 0xc0000bb9 +#define PDH_MEMORY_ALLOCATION_FAILURE 0xc0000bbb +#define PDH_INVALID_HANDLE 0xc0000bbc +#define PDH_INVALID_ARGUMENT 0xc0000bbd +#define PDH_INVALID_DATA 0xc0000bc6 + +#endif /* _PDH_MSG_H_ */ diff --git a/include/winperf.h b/include/winperf.h new file mode 100644 index 00000000000..eb68ac3404d --- /dev/null +++ b/include/winperf.h @@ -0,0 +1,65 @@ +/* + * Performance Monitor + * + * Copyright 2007 Hans Leidekker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _WINPERF_ +#define _WINPERF_ + +#define PERF_SIZE_DWORD 0x00000000 +#define PERF_SIZE_LARGE 0x00000100 +#define PERF_SIZE_ZERO 0x00000200 +#define PERF_SIZE_VARIABLE_LEN 0x00000300 + +#define PERF_TYPE_NUMBER 0x00000000 +#define PERF_TYPE_COUNTER 0x00000400 +#define PERF_TYPE_TEXT 0x00000800 +#define PERF_TYPE_ZERO 0x00000C00 + +#define PERF_NUMBER_HEX 0x00000000 +#define PERF_NUMBER_DECIMAL 0x00010000 +#define PERF_NUMBER_DEC_1000 0x00020000 + +#define PERF_COUNTER_VALUE 0x00000000 +#define PERF_COUNTER_RATE 0x00010000 +#define PERF_COUNTER_FRACTION 0x00020000 +#define PERF_COUNTER_BASE 0x00030000 +#define PERF_COUNTER_ELAPSED 0x00040000 +#define PERF_COUNTER_QUEUELEN 0x00050000 +#define PERF_COUNTER_HISTOGRAM 0x00060000 +#define PERF_COUNTER_PRECISION 0x00070000 + +#define PERF_TEXT_UNICODE 0x00000000 +#define PERF_TEXT_ASCII 0x00010000 + +#define PERF_TIMER_TICK 0x00000000 +#define PERF_TIMER_100NS 0x00100000 +#define PERF_OBJECT_TIMER 0x00200000 + +#define PERF_DELTA_COUNTER 0x00400000 +#define PERF_DELTA_BASE 0x00800000 +#define PERF_INVERSE_COUNTER 0x01000000 +#define PERF_MULTI_COUNTER 0x02000000 + +#define PERF_DISPLAY_NO_SUFFIX 0x00000000 +#define PERF_DISPLAY_PER_SEC 0x10000000 +#define PERF_DISPLAY_PERCENT 0x20000000 +#define PERF_DISPLAY_SECONDS 0x30000000 +#define PERF_DISPLAY_NOSHOW 0x40000000 + +#endif /* _WINPERF_ */