Pdh.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:40k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4.     PDH.H
  5. Abstract:
  6.     Header file for the Performance Data Helper (PDH) DLL functions.
  7. --*/
  8. #ifndef _PDH_H_
  9. #define _PDH_H_
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #if _MSC_VER >= 1200
  14. #pragma warning(push)
  15. #endif
  16. #pragma warning ( disable : 4201)
  17. // system include files required for datatype and constant definitions
  18. #include <windows.h>    // necessary for data types used in this file
  19. #include <winperf.h>    // necessary for the Detail Level definitions
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. typedef LONG            PDH_STATUS;
  24. #define PDH_FUNCTION    PDH_STATUS __stdcall
  25. // version info
  26. #define PDH_CVERSION_WIN40  ((DWORD)(0x0400))
  27. #define PDH_CVERSION_WIN50  ((DWORD)(0x0500))
  28. // v1.1 revision of PDH -- basic log functions
  29. // v1.2 of the PDH -- adds variable instance counters
  30. // v1.3 of the PDH -- adds log service control & stubs for NT5/PDH v2 fn's
  31. // v2.0 of the PDH -- is the NT v 5.0 B2 version
  32. #define PDH_VERSION         ((DWORD)((PDH_CVERSION_WIN50) + 0x0003))
  33. // define severity masks
  34. #define IsSuccessSeverity(ErrorCode)    
  35.     ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0x00000000L) ? TRUE : FALSE)
  36. #define IsInformationalSeverity(ErrorCode)    
  37.     ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0x40000000L) ? TRUE : FALSE)
  38. #define IsWarningSeverity(ErrorCode)    
  39.     ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0x80000000L) ? TRUE : FALSE)
  40. #define IsErrorSeverity(ErrorCode)      
  41.     ((((DWORD)(ErrorCode) & (0xC0000000L)) == 0xC0000000L) ? TRUE : FALSE)
  42. #define MAX_COUNTER_PATH    256         // Maximum counter path length
  43. // data type definitions
  44. typedef HANDLE       PDH_HCOUNTER;
  45. typedef HANDLE       PDH_HQUERY;
  46. typedef HANDLE       PDH_HLOG;
  47. typedef PDH_HCOUNTER HCOUNTER;
  48. typedef PDH_HQUERY   HQUERY;
  49. #ifndef _LMHLOGDEFINED_
  50. typedef PDH_HLOG     HLOG;
  51. #endif
  52. #ifdef INVALID_HANDLE_VALUE
  53. #undef INVALID_HANDLE_VALUE
  54. #define INVALID_HANDLE_VALUE  ((HANDLE)((LONG_PTR)-1))
  55. #endif
  56. #define H_REALTIME_DATASOURCE NULL
  57. #define H_WBEM_DATASOURCE     INVALID_HANDLE_VALUE
  58. typedef struct _PDH_RAW_COUNTER {
  59.     DWORD       CStatus;
  60.     FILETIME    TimeStamp;
  61.     LONGLONG    FirstValue;
  62.     LONGLONG    SecondValue;
  63.     DWORD       MultiCount;
  64. } PDH_RAW_COUNTER, *PPDH_RAW_COUNTER;
  65. typedef struct _PDH_RAW_COUNTER_ITEM_A {
  66.     LPSTR           szName;
  67.     PDH_RAW_COUNTER RawValue;
  68. } PDH_RAW_COUNTER_ITEM_A, *PPDH_RAW_COUNTER_ITEM_A;
  69. typedef struct _PDH_RAW_COUNTER_ITEM_W {
  70.     LPWSTR          szName;
  71.     PDH_RAW_COUNTER RawValue;
  72. } PDH_RAW_COUNTER_ITEM_W, *PPDH_RAW_COUNTER_ITEM_W;
  73. typedef struct _PDH_FMT_COUNTERVALUE {
  74.     DWORD    CStatus;
  75.     union {
  76.         LONG        longValue;
  77.         double      doubleValue;
  78.         LONGLONG    largeValue;
  79.         LPCSTR      AnsiStringValue;
  80.         LPCWSTR     WideStringValue;
  81.     };
  82. } PDH_FMT_COUNTERVALUE, *PPDH_FMT_COUNTERVALUE;
  83. typedef struct _PDH_FMT_COUNTERVALUE_ITEM_A {
  84.     LPSTR                   szName;
  85.     PDH_FMT_COUNTERVALUE    FmtValue;
  86. } PDH_FMT_COUNTERVALUE_ITEM_A, *PPDH_FMT_COUNTERVALUE_ITEM_A;
  87. typedef struct _PDH_FMT_COUNTERVALUE_ITEM_W {
  88.     LPWSTR                  szName;
  89.     PDH_FMT_COUNTERVALUE    FmtValue;
  90. } PDH_FMT_COUNTERVALUE_ITEM_W, *PPDH_FMT_COUNTERVALUE_ITEM_W;
  91. typedef struct _PDH_STATISTICS {
  92.     DWORD                   dwFormat;
  93.     DWORD                   count;
  94.     PDH_FMT_COUNTERVALUE    min;
  95.     PDH_FMT_COUNTERVALUE    max;
  96.     PDH_FMT_COUNTERVALUE    mean;
  97. } PDH_STATISTICS, *PPDH_STATISTICS;
  98. typedef struct _PDH_COUNTER_PATH_ELEMENTS_A {
  99.     LPSTR   szMachineName;
  100.     LPSTR   szObjectName;
  101.     LPSTR   szInstanceName;
  102.     LPSTR   szParentInstance;
  103.     DWORD   dwInstanceIndex;
  104.     LPSTR   szCounterName;
  105. } PDH_COUNTER_PATH_ELEMENTS_A, *PPDH_COUNTER_PATH_ELEMENTS_A;
  106. typedef struct _PDH_COUNTER_PATH_ELEMENTS_W {
  107.     LPWSTR  szMachineName;
  108.     LPWSTR  szObjectName;
  109.     LPWSTR  szInstanceName;
  110.     LPWSTR  szParentInstance;
  111.     DWORD   dwInstanceIndex;
  112.     LPWSTR  szCounterName;
  113. } PDH_COUNTER_PATH_ELEMENTS_W, *PPDH_COUNTER_PATH_ELEMENTS_W;
  114. typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_A {
  115.     LPSTR   szMachineName;
  116.     GUID    ObjectGUID;
  117.     DWORD   dwItemId;
  118.     LPSTR   szInstanceName;
  119. } PDH_DATA_ITEM_PATH_ELEMENTS_A, * PPDH_DATA_ITEM_PATH_ELEMENTS_A;
  120. typedef struct _PDH_DATA_ITEM_PATH_ELEMENTS_W {
  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. typedef struct _PDH_COUNTER_INFO_A {
  127.     DWORD   dwLength;
  128.     DWORD   dwType;
  129.     DWORD   CVersion;
  130.     DWORD   CStatus;
  131.     LONG    lScale;
  132.     LONG    lDefaultScale;
  133.     DWORD_PTR   dwUserData;
  134.     DWORD_PTR   dwQueryUserData;
  135.     LPSTR   szFullPath;
  136.     union   {
  137.         PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
  138.         PDH_COUNTER_PATH_ELEMENTS_A CounterPath;
  139.         struct {
  140.             LPSTR   szMachineName;
  141.             LPSTR   szObjectName;
  142.             LPSTR   szInstanceName;
  143.             LPSTR   szParentInstance;
  144.             DWORD   dwInstanceIndex;
  145.             LPSTR   szCounterName;
  146.         };
  147.     };
  148.     LPSTR   szExplainText;
  149.     DWORD   DataBuffer[1];
  150. } PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;
  151. typedef struct _PDH_COUNTER_INFO_W {
  152.     DWORD   dwLength;
  153.     DWORD   dwType;
  154.     DWORD   CVersion;
  155.     DWORD   CStatus;
  156.     LONG    lScale;
  157.     LONG    lDefaultScale;
  158.     DWORD_PTR   dwUserData;
  159.     DWORD_PTR   dwQueryUserData;
  160.     LPWSTR  szFullPath;
  161.     union   {
  162.         PDH_DATA_ITEM_PATH_ELEMENTS_W DataItemPath;
  163.         PDH_COUNTER_PATH_ELEMENTS_W CounterPath;
  164.         struct {
  165.             LPWSTR   szMachineName;
  166.             LPWSTR   szObjectName;
  167.             LPWSTR   szInstanceName;
  168.             LPWSTR   szParentInstance;
  169.             DWORD    dwInstanceIndex;
  170.             LPWSTR   szCounterName;
  171.         };
  172.     };
  173.     LPWSTR  szExplainText;
  174.     DWORD   DataBuffer[1];
  175. } PDH_COUNTER_INFO_W, *PPDH_COUNTER_INFO_W;
  176. typedef struct _PDH_TIME_INFO {
  177.     LONGLONG    StartTime;
  178.     LONGLONG    EndTime;
  179.     DWORD       SampleCount;
  180. } PDH_TIME_INFO, *PPDH_TIME_INFO;
  181. typedef struct _PDH_RAW_LOG_RECORD {
  182.     DWORD       dwStructureSize;
  183.     DWORD       dwRecordType;
  184.     DWORD       dwItems;
  185.     UCHAR       RawBytes[1];
  186. } PDH_RAW_LOG_RECORD, *PPDH_RAW_LOG_RECORD;
  187. typedef struct _PDH_LOG_SERVICE_QUERY_INFO_A {
  188.     DWORD   dwSize;
  189.     DWORD   dwFlags;
  190.     DWORD   dwLogQuota;
  191.     LPSTR   szLogFileCaption;
  192.     LPSTR   szDefaultDir;
  193.     LPSTR   szBaseFileName;
  194.     DWORD   dwFileType;
  195.     DWORD   dwReserved;
  196.     union {
  197.         struct {
  198.             DWORD   PdlAutoNameInterval;
  199.             DWORD   PdlAutoNameUnits;
  200.             LPSTR   PdlCommandFilename;
  201.             LPSTR   PdlCounterList;
  202.             DWORD   PdlAutoNameFormat;
  203.             DWORD   PdlSampleInterval;
  204.             FILETIME    PdlLogStartTime;
  205.             FILETIME    PdlLogEndTime;
  206.         };
  207.         struct {
  208.             DWORD   TlNumberOfBuffers;
  209.             DWORD   TlMinimumBuffers;
  210.             DWORD   TlMaximumBuffers;
  211.             DWORD   TlFreeBuffers;
  212.             DWORD   TlBufferSize;
  213.             DWORD   TlEventsLost;
  214.             DWORD   TlLoggerThreadId;
  215.             DWORD   TlBuffersWritten;
  216.             DWORD   TlLogHandle;
  217.             LPSTR   TlLogFileName;
  218.         };
  219.     };
  220. } PDH_LOG_SERVICE_QUERY_INFO_A, *PPDH_LOG_SERVICE_QUERY_INFO_A;
  221. typedef struct _PDH_LOG_SERVICE_QUERY_INFO_W {
  222.     DWORD   dwSize;
  223.     DWORD   dwFlags;
  224.     DWORD   dwLogQuota;
  225.     LPWSTR  szLogFileCaption;
  226.     LPWSTR  szDefaultDir;
  227.     LPWSTR  szBaseFileName;
  228.     DWORD   dwFileType;
  229.     DWORD   dwReserved;
  230.     union {
  231.         struct {
  232.             DWORD   PdlAutoNameInterval;
  233.             DWORD   PdlAutoNameUnits;
  234.             LPWSTR  PdlCommandFilename;
  235.             LPWSTR  PdlCounterList;
  236.             DWORD   PdlAutoNameFormat;
  237.             DWORD   PdlSampleInterval;
  238.             FILETIME    PdlLogStartTime;
  239.             FILETIME    PdlLogEndTime;
  240.         };
  241.         struct {
  242.             DWORD   TlNumberOfBuffers;
  243.             DWORD   TlMinimumBuffers;
  244.             DWORD   TlMaximumBuffers;
  245.             DWORD   TlFreeBuffers;
  246.             DWORD   TlBufferSize;
  247.             DWORD   TlEventsLost;
  248.             DWORD   TlLoggerThreadId;
  249.             DWORD   TlBuffersWritten;
  250.             DWORD   TlLogHandle;
  251.             LPWSTR  TlLogFileName;
  252.         };
  253.     };
  254. } PDH_LOG_SERVICE_QUERY_INFO_W, *PPDH_LOG_SERVICE_QUERY_INFO_W;
  255. //
  256. //  Time value constants
  257. //
  258. #define MAX_TIME_VALUE      ((LONGLONG)0x7FFFFFFFFFFFFFFF)
  259. #define MIN_TIME_VALUE      ((LONGLONG)0)
  260. // function definitions
  261. PDH_FUNCTION
  262. PdhGetDllVersion(
  263.     IN  LPDWORD lpdwVersion
  264. );
  265. //
  266. //  Query Functions
  267. //
  268. PDH_FUNCTION
  269. PdhOpenQueryW (
  270.     IN      LPCWSTR      szDataSource,
  271.     IN      DWORD_PTR    dwUserData,
  272.     IN      PDH_HQUERY * phQuery
  273. );
  274. PDH_FUNCTION
  275. PdhOpenQueryA (
  276.     IN      LPCSTR       szDataSource,
  277.     IN      DWORD_PTR    dwUserData,
  278.     IN      PDH_HQUERY * phQuery
  279. );
  280. PDH_FUNCTION
  281. PdhAddCounterW (
  282.     IN      PDH_HQUERY     hQuery,
  283.     IN      LPCWSTR        szFullCounterPath,
  284.     IN      DWORD_PTR      dwUserData,
  285.     IN      PDH_HCOUNTER * phCounter
  286. );
  287. PDH_FUNCTION
  288. PdhAddCounterA (
  289.     IN      PDH_HQUERY     hQuery,
  290.     IN      LPCSTR         szFullCounterPath,
  291.     IN      DWORD_PTR      dwUserData,
  292.     IN      PDH_HCOUNTER * phCounter
  293. );
  294. PDH_FUNCTION
  295. PdhRemoveCounter (
  296.     IN      PDH_HCOUNTER    hCounter
  297. );
  298. PDH_FUNCTION
  299. PdhCollectQueryData (
  300.     IN      PDH_HQUERY      hQuery
  301. );
  302. PDH_FUNCTION
  303. PdhCloseQuery (
  304.     IN      PDH_HQUERY      hQuery
  305. );
  306. //
  307. //  Counter Functions
  308. //
  309. PDH_FUNCTION
  310. PdhGetFormattedCounterValue (
  311.     IN      PDH_HCOUNTER            hCounter,
  312.     IN      DWORD                   dwFormat,
  313.     IN      LPDWORD                 lpdwType,
  314.     IN      PPDH_FMT_COUNTERVALUE   pValue
  315. );
  316. PDH_FUNCTION
  317. PdhGetFormattedCounterArrayA (
  318.     IN      PDH_HCOUNTER                 hCounter,
  319.     IN      DWORD                        dwFormat,
  320.     IN      LPDWORD                      lpdwBufferSize,
  321.     IN      LPDWORD                      lpdwItemCount,
  322.     IN      PPDH_FMT_COUNTERVALUE_ITEM_A ItemBuffer
  323. );
  324. PDH_FUNCTION
  325. PdhGetFormattedCounterArrayW (
  326.     IN      PDH_HCOUNTER                 hCounter,
  327.     IN      DWORD                        dwFormat,
  328.     IN      LPDWORD                      lpdwBufferSize,
  329.     IN      LPDWORD                      lpdwItemCount,
  330.     IN      PPDH_FMT_COUNTERVALUE_ITEM_W ItemBuffer
  331. );
  332. // dwFormat flag values
  333. //
  334. #define PDH_FMT_RAW     ((DWORD)0x00000010)
  335. #define PDH_FMT_ANSI    ((DWORD)0x00000020)
  336. #define PDH_FMT_UNICODE ((DWORD)0x00000040)
  337. #define PDH_FMT_LONG    ((DWORD)0x00000100)
  338. #define PDH_FMT_DOUBLE  ((DWORD)0x00000200)
  339. #define PDH_FMT_LARGE   ((DWORD)0x00000400)
  340. #define PDH_FMT_NOSCALE ((DWORD)0x00001000)
  341. #define PDH_FMT_1000    ((DWORD)0x00002000)
  342. #define PDH_FMT_NODATA  ((DWORD)0x00004000)
  343. #define PDH_FMT_NOCAP100 ((DWORD)0x00008000)
  344. #define PERF_DETAIL_COSTLY   ((DWORD)0x00010000)
  345. #define PERF_DETAIL_STANDARD ((DWORD)0x0000FFFF)
  346. PDH_FUNCTION
  347. PdhGetRawCounterValue (
  348.     IN      PDH_HCOUNTER      hCounter,
  349.     IN      LPDWORD           lpdwType,
  350.     IN      PPDH_RAW_COUNTER  pValue
  351. );
  352. PDH_FUNCTION
  353. PdhGetRawCounterArrayA (
  354.     IN      PDH_HCOUNTER            hCounter,
  355.     IN      LPDWORD                 lpdwBufferSize,
  356.     IN      LPDWORD                 lpdwItemCount,
  357.     IN      PPDH_RAW_COUNTER_ITEM_A ItemBuffer
  358. );
  359. PDH_FUNCTION
  360. PdhGetRawCounterArrayW (
  361.     IN      PDH_HCOUNTER            hCounter,
  362.     IN      LPDWORD                 lpdwBufferSize,
  363.     IN      LPDWORD                 lpdwItemCount,
  364.     IN      PPDH_RAW_COUNTER_ITEM_W ItemBuffer
  365. );
  366. PDH_FUNCTION
  367. PdhCalculateCounterFromRawValue (
  368.     IN      PDH_HCOUNTER            hCounter,
  369.     IN      DWORD                   dwFormat,
  370.     IN      PPDH_RAW_COUNTER        rawValue1,
  371.     IN      PPDH_RAW_COUNTER        rawValue2,
  372.     IN      PPDH_FMT_COUNTERVALUE   fmtValue
  373. );
  374. PDH_FUNCTION
  375. PdhComputeCounterStatistics (
  376.     IN      PDH_HCOUNTER        hCounter,
  377.     IN      DWORD               dwFormat,
  378.     IN      DWORD               dwFirstEntry,
  379.     IN      DWORD               dwNumEntries,
  380.     IN      PPDH_RAW_COUNTER    lpRawValueArray,
  381.     IN      PPDH_STATISTICS     data
  382. );
  383. PDH_FUNCTION
  384. PdhGetCounterInfoW (
  385.     IN      PDH_HCOUNTER        hCounter,
  386.     IN      BOOLEAN             bRetrieveExplainText,
  387.     IN      LPDWORD             pdwBufferSize,
  388.     IN      PPDH_COUNTER_INFO_W lpBuffer
  389. );
  390. PDH_FUNCTION
  391. PdhGetCounterInfoA (
  392.     IN      PDH_HCOUNTER        hCounter,
  393.     IN      BOOLEAN             bRetrieveExplainText,
  394.     IN      LPDWORD             pdwBufferSize,
  395.     IN      PPDH_COUNTER_INFO_A lpBuffer
  396. );
  397. #define PDH_MAX_SCALE    (7L)
  398. #define PDH_MIN_SCALE   (-7L)
  399. PDH_FUNCTION
  400. PdhSetCounterScaleFactor (
  401.     IN      PDH_HCOUNTER  hCounter,
  402.     IN      LONG          lFactor
  403. );
  404. //
  405. //   Browsing and enumeration functions
  406. //
  407. PDH_FUNCTION
  408. PdhConnectMachineW (
  409.     IN      LPCWSTR  szMachineName
  410. );
  411. PDH_FUNCTION
  412. PdhConnectMachineA (
  413.     IN      LPCSTR  szMachineName
  414. );
  415. PDH_FUNCTION
  416. PdhEnumMachinesW (
  417.     IN      LPCWSTR szDataSource,
  418.     IN      LPWSTR  mszMachineList,
  419.     IN      LPDWORD pcchBufferSize
  420. );
  421. PDH_FUNCTION
  422. PdhEnumMachinesA (
  423.     IN      LPCSTR   szDataSource,
  424.     IN      LPSTR    mszMachineList,
  425.     IN      LPDWORD  pcchBufferSize
  426. );
  427. PDH_FUNCTION
  428. PdhEnumObjectsW (
  429.     IN      LPCWSTR szDataSource,
  430.     IN      LPCWSTR szMachineName,
  431.     IN      LPWSTR  mszObjectList,
  432.     IN      LPDWORD pcchBufferSize,
  433.     IN      DWORD   dwDetailLevel,
  434.     IN      BOOL    bRefresh
  435. );
  436. PDH_FUNCTION
  437. PdhEnumObjectsA (
  438.     IN      LPCSTR  szDataSource,
  439.     IN      LPCSTR  szMachineName,
  440.     IN      LPSTR   mszObjectList,
  441.     IN      LPDWORD pcchBufferSize,
  442.     IN      DWORD   dwDetailLevel,
  443.     IN      BOOL    bRefresh
  444. );
  445. PDH_FUNCTION
  446. PdhEnumObjectItemsW (
  447.     IN      LPCWSTR szDataSource,
  448.     IN      LPCWSTR szMachineName,
  449.     IN      LPCWSTR szObjectName,
  450.     IN      LPWSTR  mszCounterList,
  451.     IN      LPDWORD pcchCounterListLength,
  452.     IN      LPWSTR  mszInstanceList,
  453.     IN      LPDWORD pcchInstanceListLength,
  454.     IN      DWORD   dwDetailLevel,
  455.     IN      DWORD   dwFlags
  456. );
  457. PDH_FUNCTION
  458. PdhEnumObjectItemsA (
  459.     IN      LPCSTR  szDataSource,
  460.     IN      LPCSTR  szMachineName,
  461.     IN      LPCSTR  szObjectName,
  462.     IN      LPSTR   mszCounterList,
  463.     IN      LPDWORD pcchCounterListLength,
  464.     IN      LPSTR   mszInstanceList,
  465.     IN      LPDWORD pcchInstanceListLength,
  466.     IN      DWORD   dwDetailLevel,
  467.     IN      DWORD   dwFlags
  468. );
  469. #define PDH_OBJECT_HAS_INSTANCES    ((DWORD) 0x00000001)
  470. PDH_FUNCTION
  471. PdhMakeCounterPathW (
  472.     IN      PDH_COUNTER_PATH_ELEMENTS_W *pCounterPathElements,
  473.     IN      LPWSTR                      szFullPathBuffer,
  474.     IN      LPDWORD                     pcchBufferSize,
  475.     IN      DWORD                       dwFlags
  476. );
  477. PDH_FUNCTION
  478. PdhMakeCounterPathA (
  479.     IN      PDH_COUNTER_PATH_ELEMENTS_A *pCounterPathElements,
  480.     IN      LPSTR                       szFullPathBuffer,
  481.     IN      LPDWORD                     pcchBufferSize,
  482.     IN      DWORD                       dwFlags
  483. );
  484. PDH_FUNCTION
  485. PdhParseCounterPathW (
  486.     IN      LPCWSTR                     szFullPathBuffer,
  487.     IN      PDH_COUNTER_PATH_ELEMENTS_W *pCounterPathElements,
  488.     IN      LPDWORD                     pdwBufferSize,
  489.     IN      DWORD                       dwFlags
  490. );
  491. PDH_FUNCTION
  492. PdhParseCounterPathA (
  493.     IN      LPCSTR                      szFullPathBuffer,
  494.     IN      PDH_COUNTER_PATH_ELEMENTS_A *pCounterPathElements,
  495.     IN      LPDWORD                     pdwBufferSize,
  496.     IN      DWORD                       dwFlags
  497. );
  498. #define PDH_PATH_WBEM_RESULT        ((DWORD)0x00000001)
  499. #define PDH_PATH_WBEM_INPUT         ((DWORD)0x00000002)
  500. #define PDH_PATH_LANG_FLAGS(LangId, Flags)  ((DWORD)(((LangId & 0x0000FFFF) << 16) | (Flags & 0x0000FFFF)))
  501. PDH_FUNCTION
  502. PdhParseInstanceNameW (
  503.     IN      LPCWSTR szInstanceString,
  504.     IN      LPWSTR  szInstanceName,
  505.     IN      LPDWORD pcchInstanceNameLength,
  506.     IN      LPWSTR  szParentName,
  507.     IN      LPDWORD pcchParentNameLength,
  508.     IN      LPDWORD lpIndex
  509. );
  510. PDH_FUNCTION
  511. PdhParseInstanceNameA (
  512.     IN      LPCSTR  szInstanceString,
  513.     IN      LPSTR   szInstanceName,
  514.     IN      LPDWORD pcchInstanceNameLength,
  515.     IN      LPSTR   szParentName,
  516.     IN      LPDWORD pcchParentNameLength,
  517.     IN      LPDWORD lpIndex
  518. );
  519. PDH_FUNCTION
  520. PdhValidatePathW (
  521.     IN      LPCWSTR szFullPathBuffer
  522. );
  523. PDH_FUNCTION
  524. PdhValidatePathA (
  525.     IN      LPCSTR  szFullPathBuffer
  526. );
  527. PDH_FUNCTION
  528. PdhGetDefaultPerfObjectW (
  529.     IN      LPCWSTR szDataSource,
  530.     IN      LPCWSTR szMachineName,
  531.     IN      LPWSTR  szDefaultObjectName,
  532.     IN      LPDWORD pcchBufferSize
  533. );
  534. PDH_FUNCTION
  535. PdhGetDefaultPerfObjectA (
  536.     IN      LPCSTR  szDataSource,
  537.     IN      LPCSTR  szMachineName,
  538.     IN      LPSTR   szDefaultObjectName,
  539.     IN      LPDWORD pcchBufferSize
  540. );
  541. PDH_FUNCTION
  542. PdhGetDefaultPerfCounterW (
  543.     IN      LPCWSTR szDataSource,
  544.     IN      LPCWSTR szMachineName,
  545.     IN      LPCWSTR szObjectName,
  546.     IN      LPWSTR  szDefaultCounterName,
  547.     IN      LPDWORD pcchBufferSize
  548. );
  549. PDH_FUNCTION
  550. PdhGetDefaultPerfCounterA (
  551.     IN      LPCSTR  szDataSource,
  552.     IN      LPCSTR  szMachineName,
  553.     IN      LPCSTR  szObjectName,
  554.     IN      LPSTR   szDefaultCounterName,
  555.     IN      LPDWORD pcchBufferSize
  556. );
  557. typedef PDH_STATUS (__stdcall *CounterPathCallBack)(DWORD_PTR);
  558. #if _MSC_VER >= 1200
  559. #pragma warning(push)
  560. #endif
  561. #pragma warning ( disable : 4214 )  // Disable warning messages
  562. typedef struct _BrowseDlgConfig_HW {
  563.     // Configuration flags
  564.     DWORD   bIncludeInstanceIndex:1,
  565.             bSingleCounterPerAdd:1,
  566.             bSingleCounterPerDialog:1,
  567.             bLocalCountersOnly:1,
  568.             bWildCardInstances:1,
  569.             bHideDetailBox:1,
  570.             bInitializePath:1,
  571.             bDisableMachineSelection:1,
  572.             bIncludeCostlyObjects:1,
  573.             bShowObjectBrowser:1,
  574.             bReserved:22;
  575.     HWND                hWndOwner;
  576.     PDH_HLOG            hDataSource;
  577.     LPWSTR              szReturnPathBuffer;
  578.     DWORD               cchReturnPathLength;
  579.     CounterPathCallBack pCallBack;
  580.     DWORD_PTR           dwCallBackArg;
  581.     PDH_STATUS          CallBackStatus;
  582.     DWORD               dwDefaultDetailLevel;
  583.     LPWSTR              szDialogBoxCaption;
  584. } PDH_BROWSE_DLG_CONFIG_HW, *PPDH_BROWSE_DLG_CONFIG_HW;
  585. typedef struct _BrowseDlgConfig_HA {
  586.     // Configuration flags
  587.     DWORD   bIncludeInstanceIndex:1,
  588.             bSingleCounterPerAdd:1,
  589.             bSingleCounterPerDialog:1,
  590.             bLocalCountersOnly:1,
  591.             bWildCardInstances:1,
  592.             bHideDetailBox:1,
  593.             bInitializePath:1,
  594.             bDisableMachineSelection:1,
  595.             bIncludeCostlyObjects:1,
  596.             bShowObjectBrowser:1,
  597.             bReserved:22;
  598.     HWND                hWndOwner;
  599.     PDH_HLOG            hDataSource;
  600.     LPSTR               szReturnPathBuffer;
  601.     DWORD               cchReturnPathLength;
  602.     CounterPathCallBack pCallBack;
  603.     DWORD_PTR           dwCallBackArg;
  604.     PDH_STATUS          CallBackStatus;
  605.     DWORD               dwDefaultDetailLevel;
  606.     LPSTR               szDialogBoxCaption;
  607. } PDH_BROWSE_DLG_CONFIG_HA, *PPDH_BROWSE_DLG_CONFIG_HA;
  608. typedef struct _BrowseDlgConfig_W {
  609.     // Configuration flags
  610.     DWORD   bIncludeInstanceIndex:1,
  611.             bSingleCounterPerAdd:1,
  612.             bSingleCounterPerDialog:1,
  613.             bLocalCountersOnly:1,
  614.             bWildCardInstances:1,
  615.             bHideDetailBox:1,
  616.             bInitializePath:1,
  617.             bDisableMachineSelection:1,
  618.             bIncludeCostlyObjects:1,
  619.             bShowObjectBrowser:1,
  620.             bReserved:22;
  621.     HWND                hWndOwner;
  622.     LPWSTR              szDataSource;
  623.     LPWSTR              szReturnPathBuffer;
  624.     DWORD               cchReturnPathLength;
  625.     CounterPathCallBack pCallBack;
  626.     DWORD_PTR           dwCallBackArg;
  627.     PDH_STATUS          CallBackStatus;
  628.     DWORD               dwDefaultDetailLevel;
  629.     LPWSTR              szDialogBoxCaption;
  630. } PDH_BROWSE_DLG_CONFIG_W, *PPDH_BROWSE_DLG_CONFIG_W;
  631. typedef struct _BrowseDlgConfig_A {
  632.     // Configuration flags
  633.     DWORD   bIncludeInstanceIndex:1,
  634.             bSingleCounterPerAdd:1,
  635.             bSingleCounterPerDialog:1,
  636.             bLocalCountersOnly:1,
  637.             bWildCardInstances:1,
  638.             bHideDetailBox:1,
  639.             bInitializePath:1,
  640.             bDisableMachineSelection:1,
  641.             bIncludeCostlyObjects:1,
  642.             bShowObjectBrowser:1,
  643.             bReserved:22;
  644.     HWND                hWndOwner;
  645.     LPSTR               szDataSource;
  646.     LPSTR               szReturnPathBuffer;
  647.     DWORD               cchReturnPathLength;
  648.     CounterPathCallBack pCallBack;
  649.     DWORD_PTR           dwCallBackArg;
  650.     PDH_STATUS          CallBackStatus;
  651.     DWORD               dwDefaultDetailLevel;
  652.     LPSTR               szDialogBoxCaption;
  653. } PDH_BROWSE_DLG_CONFIG_A, *PPDH_BROWSE_DLG_CONFIG_A;
  654. #if _MSC_VER >= 1200
  655. #pragma warning(pop)
  656. #else
  657. #pragma warning ( default : 4214 )
  658. #endif
  659. PDH_FUNCTION
  660. PdhBrowseCountersW (
  661.     IN      PPDH_BROWSE_DLG_CONFIG_W    pBrowseDlgData
  662. );
  663. PDH_FUNCTION
  664. PdhBrowseCountersA (
  665.     IN      PPDH_BROWSE_DLG_CONFIG_A    pBrowseDlgData
  666. );
  667. PDH_FUNCTION
  668. PdhExpandCounterPathW (
  669.     IN      LPCWSTR     szWildCardPath,
  670.     IN      LPWSTR      mszExpandedPathList,
  671.     IN      LPDWORD     pcchPathListLength
  672. );
  673. PDH_FUNCTION
  674. PdhExpandCounterPathA (
  675.     IN      LPCSTR      szWildCardPath,
  676.     IN      LPSTR       mszExpandedPathList,
  677.     IN      LPDWORD     pcchPathListLength
  678. );
  679. //
  680. //  v2.0 functions
  681. //
  682. PDH_FUNCTION
  683. PdhLookupPerfNameByIndexW (
  684.     LPCWSTR szMachineName,
  685.     DWORD   dwNameIndex,
  686.     LPWSTR  szNameBuffer,
  687.     LPDWORD pcchNameBufferSize
  688. );
  689. PDH_FUNCTION
  690. PdhLookupPerfNameByIndexA (
  691.     LPCSTR  szMachineName,
  692.     DWORD   dwNameIndex,
  693.     LPSTR   szNameBuffer,
  694.     LPDWORD pcchNameBufferSize
  695. );
  696. PDH_FUNCTION
  697. PdhLookupPerfIndexByNameW (
  698.     LPCWSTR szMachineName,
  699.     LPCWSTR szNameBuffer,
  700.     LPDWORD pdwIndex
  701. );
  702. PDH_FUNCTION
  703. PdhLookupPerfIndexByNameA (
  704.     LPCSTR  szMachineName,
  705.     LPCSTR  szNameBuffer,
  706.     LPDWORD pdwIndex
  707. );
  708. #define     PDH_NOEXPANDCOUNTERS    1
  709. #define     PDH_NOEXPANDINSTANCES   2
  710. PDH_FUNCTION
  711. PdhExpandWildCardPathA (
  712.     IN      LPCSTR  szDataSource,
  713.     IN      LPCSTR  szWildCardPath,
  714.     IN      LPSTR   mszExpandedPathList,
  715.     IN      LPDWORD pcchPathListLength,
  716.     IN      DWORD   dwFlags
  717. );
  718. PDH_FUNCTION
  719. PdhExpandWildCardPathW (
  720.     IN      LPCWSTR  szDataSource,
  721.     IN      LPCWSTR  szWildCardPath,
  722.     IN      LPWSTR  mszExpandedPathList,
  723.     IN      LPDWORD pcchPathListLength,
  724.     IN      DWORD   dwFlags
  725. );
  726. //
  727. //   Logging Functions
  728. //
  729. #define PDH_LOG_READ_ACCESS     ((DWORD)0x00010000)
  730. #define PDH_LOG_WRITE_ACCESS    ((DWORD)0x00020000)
  731. #define PDH_LOG_UPDATE_ACCESS   ((DWORD)0x00040000)
  732. #define PDH_LOG_ACCESS_MASK     ((DWORD)0x000F0000)
  733. #define PDH_LOG_CREATE_NEW      ((DWORD)0x00000001)
  734. #define PDH_LOG_CREATE_ALWAYS   ((DWORD)0x00000002)
  735. #define PDH_LOG_OPEN_ALWAYS     ((DWORD)0x00000003)
  736. #define PDH_LOG_OPEN_EXISTING   ((DWORD)0x00000004)
  737. #define PDH_LOG_CREATE_MASK     ((DWORD)0x0000000F)
  738. #define PDH_LOG_OPT_USER_STRING  ((DWORD)0x01000000)
  739. #define PDH_LOG_OPT_CIRCULAR     ((DWORD)0x02000000)
  740. #define PDH_LOG_OPT_MAX_IS_BYTES ((DWORD)0x04000000)
  741. #define PDH_LOG_OPT_APPEND       ((DWORD)0x08000000)
  742. #define PDH_LOG_OPT_MASK         ((DWORD)0x0F000000)
  743. #define PDH_LOG_TYPE_UNDEFINED      0
  744. #define PDH_LOG_TYPE_CSV            1
  745. #define PDH_LOG_TYPE_TSV            2
  746. //#define PDH_LOG_TYPE_BINARY         3 // this is the retired binary format
  747. #define PDH_LOG_TYPE_TRACE_KERNEL   4
  748. #define PDH_LOG_TYPE_TRACE_GENERIC  5
  749. #define PDH_LOG_TYPE_PERFMON        6
  750. #define PDH_LOG_TYPE_SQL            7
  751. #define PDH_LOG_TYPE_BINARY         8
  752. PDH_FUNCTION
  753. PdhOpenLogW (
  754.     IN      LPCWSTR     szLogFileName,
  755.     IN      DWORD       dwAccessFlags,
  756.     IN      LPDWORD     lpdwLogType,
  757.     IN      PDH_HQUERY  hQuery,
  758.     IN      DWORD       dwMaxSize,
  759.     IN      LPCWSTR     szUserCaption,
  760.     IN      PDH_HLOG  * phLog
  761. );
  762. PDH_FUNCTION
  763. PdhOpenLogA (
  764.     IN      LPCSTR       szLogFileName,
  765.     IN      DWORD        dwAccessFlags,
  766.     IN      LPDWORD      lpdwLogType,
  767.     IN      PDH_HQUERY   hQuery,
  768.     IN      DWORD        dwMaxSize,
  769.     IN      LPCSTR       szUserCaption,
  770.     IN      PDH_HLOG   * phLog
  771. );
  772. PDH_FUNCTION
  773. PdhUpdateLogW (
  774.     IN      PDH_HLOG hLog,
  775.     IN      LPCWSTR  szUserString
  776. );
  777. PDH_FUNCTION
  778. PdhUpdateLogA (
  779.     IN      PDH_HLOG hLog,
  780.     IN      LPCSTR   szUserString
  781. );
  782. PDH_FUNCTION
  783. PdhUpdateLogFileCatalog (
  784.     IN      PDH_HLOG    hLog
  785. );
  786. PDH_FUNCTION
  787. PdhGetLogFileSize (
  788.     IN  PDH_HLOG     hLog,
  789.     IN  LONGLONG   * llSize
  790. );
  791. PDH_FUNCTION
  792. PdhCloseLog(
  793.     IN  PDH_HLOG    hLog,
  794.     IN  DWORD       dwFlags
  795. );
  796. #define PDH_FLAGS_CLOSE_QUERY   ((DWORD)0x00000001)
  797. //
  798. //  Data source selection dialog
  799. //
  800. #define PDH_FLAGS_FILE_BROWSER_ONLY ((DWORD)0x00000001)
  801. PDH_FUNCTION
  802. PdhSelectDataSourceW (
  803.     IN  HWND    hWndOwner,
  804.     IN  DWORD   dwFlags,
  805.     IN  LPWSTR  szDataSource,
  806.     IN  LPDWORD pcchBufferLength
  807. );
  808. PDH_FUNCTION
  809. PdhSelectDataSourceA (
  810.     IN  HWND    hWndOwner,
  811.     IN  DWORD   dwFlags,
  812.     IN  LPSTR   szDataSource,
  813.     IN  LPDWORD pcchBufferLength
  814. );
  815. BOOL
  816. PdhIsRealTimeQuery (
  817.     IN  PDH_HQUERY  hQuery
  818. );
  819. PDH_FUNCTION
  820. PdhSetQueryTimeRange (
  821.     IN      PDH_HQUERY      hQuery,
  822.     IN      PPDH_TIME_INFO  pInfo
  823. );
  824. PDH_FUNCTION
  825. PdhGetDataSourceTimeRangeW (
  826.     IN      LPCWSTR         szDataSource,
  827.     IN      LPDWORD         pdwNumEntries,
  828.     IN      PPDH_TIME_INFO  pInfo,
  829.     IN      LPDWORD         pdwBufferSize
  830. );
  831. PDH_FUNCTION
  832. PdhGetDataSourceTimeRangeA (
  833.     IN      LPCSTR          szDataSource,
  834.     IN      LPDWORD         pdwNumEntries,
  835.     IN      PPDH_TIME_INFO  pInfo,
  836.     IN      LPDWORD         dwBufferSize
  837. );
  838. PDH_FUNCTION
  839. PdhCollectQueryDataEx (
  840.     IN      PDH_HQUERY  hQuery,
  841.     IN      DWORD       dwIntervalTime,
  842.     IN      HANDLE      hNewDataEvent
  843. );
  844. PDH_FUNCTION
  845. PdhFormatFromRawValue (
  846.     IN      DWORD               dwCounterType,
  847.     IN      DWORD               dwFormat,
  848.     IN      LONGLONG            *pTimeBase,
  849.     IN      PPDH_RAW_COUNTER    pRawValue1,
  850.     IN      PPDH_RAW_COUNTER    pRawValue2,
  851.     IN      PPDH_FMT_COUNTERVALUE   pFmtValue
  852. );
  853. PDH_FUNCTION
  854. PdhGetCounterTimeBase (
  855.     IN  PDH_HCOUNTER   hCounter,
  856.     IN  LONGLONG     * pTimeBase
  857. );
  858. PDH_FUNCTION
  859. PdhReadRawLogRecord (
  860.     IN  PDH_HLOG                hLog,
  861.     IN  FILETIME                ftRecord,
  862.     IN  PPDH_RAW_LOG_RECORD     pRawLogRecord,
  863.     IN  LPDWORD                 pdwBufferLength
  864. );
  865. #define DATA_SOURCE_REGISTRY    ((DWORD)0x00000001)
  866. #define DATA_SOURCE_LOGFILE     ((DWORD)0x00000002)
  867. #define DATA_SOURCE_WBEM        ((DWORD)0x00000004)
  868. PDH_FUNCTION
  869. PdhSetDefaultRealTimeDataSource (
  870.     IN  DWORD   dwDataSourceId
  871. );
  872. // flags for the log service api's
  873. #define PDH_LOGSVC_NO_WAIT          ((DWORD)0x80000000)
  874. #define PDH_LOGSVC_ALL_QUERIES      ((DWORD)0x00000001)
  875. #define PDH_LOGSVC_TRACE_LOG        ((DWORD)0x00000002)
  876. #define PDH_LOGSVC_CMD_START        ((DWORD)0x00000010)
  877. #define PDH_LOGSVC_CMD_STOP         ((DWORD)0x00000020)
  878. #define PDH_LOGSVC_CTRL_ADD         ((DWORD)0x00000100)
  879. #define PDH_LOGSVC_CTRL_REMOVE      ((DWORD)0x00000200)
  880. #define PDH_LOGSVC_CTRL_INFO        ((DWORD)0x00000400)
  881. #define PDH_LOGSVC_STATUS_RUNNING   ((DWORD)0x00001000)
  882. #define PDH_LOGSVC_STATUS_STOPPED   ((DWORD)0x00002000)
  883. #define PDH_LOGSVC_STATUS_PAUSED    ((DWORD)0x00004000)
  884. #define PDH_LOGSVC_STATUS_ERROR     ((DWORD)0x00008000)
  885. #define PDH_LOGSVC_STATUS_PENDING   ((DWORD)0x00010000)
  886. #define PDH_LOGSVC_NAME_UNDEFINED  ((DWORD)-1)
  887. #define PDH_LOGSVC_NAME_MMDDHH     ((DWORD)0)
  888. #define PDH_LOGSVC_NAME_NNNNNN     ((DWORD)1)
  889. #define PDH_LOGSVC_NAME_YYDDD      ((DWORD)2)
  890. #define PDH_LOGSVC_NAME_YYMM       ((DWORD)3)
  891. #define PDH_LOGSVC_NAME_YYMMDD     ((DWORD)4)
  892. #define PDH_LOGSVC_NAME_YYMMDDHH   ((DWORD)5)
  893. #define PDH_LOGSVC_RENAME_UNDEFINED ((DWORD)-1)
  894. #define PDH_LOGSVC_RENAME_HOURS    ((DWORD)0)
  895. #define PDH_LOGSVC_RENAME_DAYS     ((DWORD)1)
  896. #define PDH_LOGSVC_RENAME_MONTHS   ((DWORD)2)
  897. #define PDH_LOGSVC_RENAME_KBYTES   ((DWORD)3)
  898. #define PDH_LOGSVC_RENAME_MBYTES   ((DWORD)4)
  899. PDH_FUNCTION
  900. PdhLogServiceCommandA (
  901.     IN  LPCSTR          szMachineName,
  902.     IN  LPCSTR          szQueryName,
  903.     IN  DWORD           dwFlags,
  904.     IN  LPDWORD         pdwStatus
  905. );
  906. PDH_FUNCTION
  907. PdhLogServiceCommandW (
  908.     IN  LPCWSTR         szMachineName,
  909.     IN  LPCWSTR         szQueryName,
  910.     IN  DWORD           dwFlags,
  911.     IN  LPDWORD         pdwStatus
  912. );
  913. PDH_FUNCTION
  914. PdhLogServiceControlA (
  915.     IN  LPCSTR          szMachineName,
  916.     IN  LPCSTR          szQueryName,
  917.     IN  DWORD           dwFlags,
  918.     IN  PPDH_LOG_SERVICE_QUERY_INFO_A pInfoBuffer,
  919.     IN  LPDWORD         pdwBufferSize
  920. );
  921. PDH_FUNCTION
  922. PdhLogServiceControlW (
  923.     IN  LPCWSTR         szMachineName,
  924.     IN  LPCWSTR         szQueryName,
  925.     IN  DWORD           dwFlags,
  926.     IN  PPDH_LOG_SERVICE_QUERY_INFO_W pInfoBuffer,
  927.     IN  LPDWORD         pdwBufferSize
  928. );
  929. // Extended API for WMI event trace logfile format
  930. //
  931. PDH_FUNCTION
  932. PdhBindInputDataSourceW (
  933.     IN PDH_HLOG    * phDataSource,
  934.     IN LPCWSTR       LogFileNameList
  935. );
  936. PDH_FUNCTION
  937. PdhBindInputDataSourceA (
  938.     IN PDH_HLOG   * phDataSource,
  939.     IN LPCSTR       LogFileNameList
  940. );
  941. PDH_FUNCTION
  942. PdhOpenQueryH (
  943.     IN PDH_HLOG     hDataSource,
  944.     IN DWORD_PTR    dwUserData,
  945.     IN PDH_HQUERY * phQuery
  946. );
  947. PDH_FUNCTION
  948. PdhEnumMachinesHW (
  949.     IN PDH_HLOG    hDataSource,
  950.     IN LPWSTR      mszMachineList,
  951.     IN LPDWORD     pcchBufferSize
  952. );
  953. PDH_FUNCTION
  954. PdhEnumMachinesHA (
  955.     IN PDH_HLOG    hDataSource,
  956.     IN LPSTR       mszMachineList,
  957.     IN LPDWORD     pcchBufferSize
  958. );
  959. PDH_FUNCTION
  960. PdhEnumObjectsHW (
  961.     IN PDH_HLOG    hDataSource,
  962.     IN LPCWSTR     szMachineName,
  963.     IN LPWSTR      mszObjectList,
  964.     IN LPDWORD     pcchBufferSize,
  965.     IN DWORD       dwDetailLevel,
  966.     IN BOOL        bRefresh
  967. );
  968. PDH_FUNCTION
  969. PdhEnumObjectsHA (
  970.     IN PDH_HLOG    hDataSource,
  971.     IN LPCSTR      szMachineName,
  972.     IN LPSTR       mszObjectList,
  973.     IN LPDWORD     pcchBufferSize,
  974.     IN DWORD       dwDetailLevel,
  975.     IN BOOL        bRefresh
  976. );
  977. PDH_FUNCTION
  978. PdhEnumObjectItemsHW (
  979.     IN PDH_HLOG    hDataSource,
  980.     IN LPCWSTR     szMachineName,
  981.     IN LPCWSTR     szObjectName,
  982.     IN LPWSTR      mszCounterList,
  983.     IN LPDWORD     pcchCounterListLength,
  984.     IN LPWSTR      mszInstanceList,
  985.     IN LPDWORD     pcchInstanceListLength,
  986.     IN DWORD       dwDetailLevel,
  987.     IN DWORD       dwFlags
  988. );
  989. PDH_FUNCTION
  990. PdhEnumObjectItemsHA (
  991.     IN PDH_HLOG    hDataSource,
  992.     IN LPCSTR      szMachineName,
  993.     IN LPCSTR      szObjectName,
  994.     IN LPSTR       mszCounterList,
  995.     IN LPDWORD     pcchCounterListLength,
  996.     IN LPSTR       mszInstanceList,
  997.     IN LPDWORD     pcchInstanceListLength,
  998.     IN DWORD       dwDetailLevel,
  999.     IN DWORD       dwFlags
  1000. );
  1001. PDH_FUNCTION
  1002. PdhExpandWildCardPathHW (
  1003.     IN PDH_HLOG    hDataSource,
  1004.     IN LPCWSTR     szWildCardPath,
  1005.     IN LPWSTR      mszExpandedPathList,
  1006.     IN LPDWORD     pcchPathListLength,
  1007.     IN DWORD       dwFlags
  1008. );
  1009. PDH_FUNCTION
  1010. PdhExpandWildCardPathHA (
  1011.     IN PDH_HLOG    hDataSource,
  1012.     IN LPCSTR      szWildCardPath,
  1013.     IN LPSTR       mszExpandedPathList,
  1014.     IN LPDWORD     pcchPathListLength,
  1015.     IN DWORD       dwFlags
  1016. );
  1017. PDH_FUNCTION
  1018. PdhGetDataSourceTimeRangeH (
  1019.     IN PDH_HLOG        hDataSource,
  1020.     IN LPDWORD         pdwNumEntries,
  1021.     IN PPDH_TIME_INFO  pInfo,
  1022.     IN LPDWORD         pdwBufferSize
  1023. );
  1024. PDH_FUNCTION
  1025. PdhGetDefaultPerfObjectHW (
  1026.     IN PDH_HLOG  hDataSource,
  1027.     IN LPCWSTR   szMachineName,
  1028.     IN LPWSTR    szDefaultObjectName,
  1029.     IN LPDWORD   pcchBufferSize
  1030. );
  1031. PDH_FUNCTION
  1032. PdhGetDefaultPerfObjectHA (
  1033.     IN PDH_HLOG    hDataSource,
  1034.     IN LPCSTR      szMachineName,
  1035.     IN LPSTR       szDefaultObjectName,
  1036.     IN LPDWORD     pcchBufferSize
  1037. );
  1038. PDH_FUNCTION
  1039. PdhGetDefaultPerfCounterHW (
  1040.     IN PDH_HLOG    hDataSource,
  1041.     IN LPCWSTR     szMachineName,
  1042.     IN LPCWSTR     szObjectName,
  1043.     IN LPWSTR      szDefaultCounterName,
  1044.     IN LPDWORD pcchBufferSize
  1045. );
  1046. PDH_FUNCTION
  1047. PdhGetDefaultPerfCounterHA (
  1048.     IN PDH_HLOG    hDataSource,
  1049.     IN LPCSTR      szMachineName,
  1050.     IN LPCSTR      szObjectName,
  1051.     IN LPSTR       szDefaultCounterName,
  1052.     IN LPDWORD pcchBufferSize
  1053. );
  1054. PDH_FUNCTION
  1055. PdhBrowseCountersHW (
  1056.     IN PPDH_BROWSE_DLG_CONFIG_HW pBrowseDlgData
  1057. );
  1058. PDH_FUNCTION
  1059. PdhBrowseCountersHA (
  1060.     IN PPDH_BROWSE_DLG_CONFIG_HA pBrowseDlgData
  1061. );
  1062. //Check that a DSN points to a database that contains the correct Perfmon tables.
  1063. PDH_FUNCTION
  1064. PdhVerifySQLDBW (
  1065. IN LPCWSTR szDataSource
  1066. );
  1067. PDH_FUNCTION
  1068. PdhVerifySQLDBA (
  1069. IN LPCSTR szDataSource
  1070. );
  1071. //Create the correct perfmon tables in the database pointed to by a DSN.
  1072. PDH_FUNCTION
  1073. PdhCreateSQLTablesW (
  1074. IN LPCWSTR szDataSource
  1075. );  
  1076. PDH_FUNCTION
  1077. PdhCreateSQLTablesA (
  1078. IN LPCSTR szDataSource
  1079. );     
  1080. //Return the list of Log set names in the database pointed to by the DSN.
  1081. PDH_FUNCTION
  1082. PdhEnumLogSetNamesW (
  1083. IN LPCWSTR szDataSource,
  1084. IN LPWSTR mszDataSetNameList,
  1085. IN LPDWORD pcchBufferLength
  1086. );
  1087. PDH_FUNCTION
  1088. PdhEnumLogSetNamesA (
  1089. IN LPCSTR szDataSource,
  1090. IN LPSTR mszDataSetNameList,
  1091. IN LPDWORD pcchBufferLength
  1092. );
  1093. //Retrieve the GUID for an open Log Set
  1094. PDH_FUNCTION
  1095. PdhGetLogSetGUID (
  1096. IN PDH_HLOG    hLog,             
  1097. IN GUID      * pGuid,
  1098. IN int       * pRunId
  1099. );
  1100. //Set the RunID for an open Log Set
  1101. PDH_FUNCTION
  1102. PdhSetLogSetRunID (
  1103. IN PDH_HLOG    hLog,             
  1104. IN int         RunId
  1105. );
  1106. //
  1107. //   Unicode/ANSI compatibility section
  1108. //
  1109. #ifdef UNICODE
  1110. #ifndef _UNICODE
  1111. #define _UNICODE
  1112. #endif
  1113. #endif
  1114. #ifdef _UNICODE
  1115. #ifndef UNICODE
  1116. #define UNICODE
  1117. #endif
  1118. #endif
  1119. #ifdef UNICODE
  1120. // start of UNICODE definitions
  1121. #define PdhOpenQuery                PdhOpenQueryW
  1122. #define PdhAddCounter               PdhAddCounterW
  1123. #define PdhGetCounterInfo           PdhGetCounterInfoW
  1124. #define PDH_COUNTER_INFO            PDH_COUNTER_INFO_W
  1125. #define PPDH_COUNTER_INFO           PPDH_COUNTER_INFO_W
  1126. #define PdhConnectMachine           PdhConnectMachineW
  1127. #define PdhEnumMachines             PdhEnumMachinesW
  1128. #define PdhEnumObjects              PdhEnumObjectsW
  1129. #define PdhEnumObjectItems          PdhEnumObjectItemsW
  1130. #define PdhMakeCounterPath          PdhMakeCounterPathW
  1131. #define PDH_COUNTER_PATH_ELEMENTS   PDH_COUNTER_PATH_ELEMENTS_W
  1132. #define PPDH_COUNTER_PATH_ELEMENTS  PPDH_COUNTER_PATH_ELEMENTS_W
  1133. #define PdhParseCounterPath         PdhParseCounterPathW
  1134. #define PdhParseInstanceName        PdhParseInstanceNameW
  1135. #define PdhValidatePath             PdhValidatePathW
  1136. #define PdhGetDefaultPerfObject     PdhGetDefaultPerfObjectW
  1137. #define PdhGetDefaultPerfCounter    PdhGetDefaultPerfCounterW
  1138. #define PdhBrowseCounters           PdhBrowseCountersW
  1139. #define PdhBrowseCountersH          PdhBrowseCountersHW
  1140. #define PDH_BROWSE_DLG_CONFIG       PDH_BROWSE_DLG_CONFIG_W
  1141. #define PPDH_BROWSE_DLG_CONFIG      PPDH_BROWSE_DLG_CONFIG_W
  1142. #define PDH_BROWSE_DLG_CONFIG_H     PDH_BROWSE_DLG_CONFIG_HW
  1143. #define PPDH_BROWSE_DLG_CONFIG_H    PPDH_BROWSE_DLG_CONFIG_HW
  1144. #define PdhExpandCounterPath        PdhExpandCounterPathW
  1145. // v2.0 functions
  1146. #define PDH_FMT_COUNTERVALUE_ITEM   PDH_FMT_COUNTERVALUE_ITEM_W
  1147. #define PPDH_FMT_COUNTERVALUE_ITEM  PPDH_FMT_COUNTERVALUE_ITEM_W
  1148. #define PDH_RAW_COUNTER_ITEM        PDH_RAW_COUNTER_ITEM_W
  1149. #define PPDH_RAW_COUNTER_ITEM       PPDH_RAW_COUNTER_ITEM_W
  1150. #define PdhGetFormattedCounterArray PdhGetFormattedCounterArrayW
  1151. #define PdhGetRawCounterArray       PdhGetRawCounterArrayW
  1152. #define PdhLookupPerfNameByIndex    PdhLookupPerfNameByIndexW
  1153. #define PdhLookupPerfIndexByName    PdhLookupPerfIndexByNameW
  1154. #define PdhOpenLog                  PdhOpenLogW
  1155. #define PdhUpdateLog                PdhUpdateLogW
  1156. #define PdhSelectDataSource         PdhSelectDataSourceW
  1157. #define PdhGetDataSourceTimeRange   PdhGetDataSourceTimeRangeW
  1158. #define PDH_LOG_SERVICE_QUERY_INFO  PDH_LOG_SERVICE_QUERY_INFO_W
  1159. #define PPDH_LOG_SERVICE_QUERY_INFO PPDH_LOG_SERVICE_QUERY_INFO_W
  1160. #define PdhLogServiceControl        PdhLogServiceControlW
  1161. #define PdhLogServiceQuery          PdhLogServiceQueryW
  1162. #define PdhExpandWildCardPath       PdhExpandWildCardPathW
  1163. #define PdhBindInputDataSource      PdhBindInputDataSourceW
  1164. #define PdhEnumMachinesH            PdhEnumMachinesHW
  1165. #define PdhEnumObjectsH             PdhEnumObjectsHW
  1166. #define PdhEnumObjectItemsH         PdhEnumObjectItemsHW
  1167. #define PdhExpandWildCardPathH      PdhExpandWildCardPathHW
  1168. #define PdhGetDefaultPerfObjectH    PdhGetDefaultPerfObjectHW
  1169. #define PdhGetDefaultPerfCounterH   PdhGetDefaultPerfCounterHW
  1170. #define PdhEnumLogSetNames     PdhEnumLogSetNamesW
  1171. #define PdhCreateSQLTables     PdhCreateSQLTablesW
  1172. #define PdhVerifySQLDB     PdhVerifySQLDBW
  1173. // end of UNICODE definitions
  1174. #else
  1175. // start of ANSI definitions
  1176. #define PdhOpenQuery                PdhOpenQueryA
  1177. #define PdhAddCounter               PdhAddCounterA
  1178. #define PdhGetCounterInfo           PdhGetCounterInfoA
  1179. #define PDH_COUNTER_INFO            PDH_COUNTER_INFO_A
  1180. #define PPDH_COUNTER_INFO           PPDH_COUNTER_INFO_A
  1181. #define PdhConnectMachine           PdhConnectMachineA
  1182. #define PdhEnumMachines             PdhEnumMachinesA
  1183. #define PdhEnumObjects              PdhEnumObjectsA
  1184. #define PdhEnumObjectItems          PdhEnumObjectItemsA
  1185. #define PdhMakeCounterPath          PdhMakeCounterPathA
  1186. #define PDH_COUNTER_PATH_ELEMENTS   PDH_COUNTER_PATH_ELEMENTS_A
  1187. #define PPDH_COUNTER_PATH_ELEMENTS  PPDH_COUNTER_PATH_ELEMENTS_A
  1188. #define PdhParseCounterPath         PdhParseCounterPathA
  1189. #define PdhParseInstanceName        PdhParseInstanceNameA
  1190. #define PdhValidatePath             PdhValidatePathA
  1191. #define PdhGetDefaultPerfObject     PdhGetDefaultPerfObjectA
  1192. #define PdhGetDefaultPerfCounter    PdhGetDefaultPerfCounterA
  1193. #define PdhBrowseCounters           PdhBrowseCountersA
  1194. #define PdhBrowseCountersH          PdhBrowseCountersHA
  1195. #define PDH_BROWSE_DLG_CONFIG       PDH_BROWSE_DLG_CONFIG_A
  1196. #define PPDH_BROWSE_DLG_CONFIG      PPDH_BROWSE_DLG_CONFIG_A
  1197. #define PDH_BROWSE_DLG_CONFIG_H     PDH_BROWSE_DLG_CONFIG_HA
  1198. #define PPDH_BROWSE_DLG_CONFIG_H    PPDH_BROWSE_DLG_CONFIG_HA
  1199. #define PdhExpandCounterPath        PdhExpandCounterPathA
  1200. // v2.0 functions
  1201. #define PDH_FMT_COUNTERVALUE_ITEM   PDH_FMT_COUNTERVALUE_ITEM_A
  1202. #define PPDH_FMT_COUNTERVALUE_ITEM  PPDH_FMT_COUNTERVALUE_ITEM_A
  1203. #define PDH_RAW_COUNTER_ITEM        PDH_RAW_COUNTER_ITEM_A
  1204. #define PPDH_RAW_COUNTER_ITEM       PPDH_RAW_COUNTER_ITEM_A
  1205. #define PdhGetFormattedCounterArray PdhGetFormattedCounterArrayA
  1206. #define PdhGetRawCounterArray       PdhGetRawCounterArrayA
  1207. #define PdhLookupPerfNameByIndex    PdhLookupPerfNameByIndexA
  1208. #define PdhLookupPerfIndexByName    PdhLookupPerfIndexByNameA
  1209. #define PdhOpenLog                  PdhOpenLogA
  1210. #define PdhUpdateLog                PdhUpdateLogA
  1211. #define PdhSelectDataSource         PdhSelectDataSourceA
  1212. #define PdhGetDataSourceTimeRange   PdhGetDataSourceTimeRangeA
  1213. #define PDH_LOG_SERVICE_QUERY_INFO  PDH_LOG_SERVICE_QUERY_INFO_A
  1214. #define PPDH_LOG_SERVICE_QUERY_INFO PPDH_LOG_SERVICE_QUERY_INFO_A
  1215. #define PdhLogServiceControl        PdhLogServiceControlA
  1216. #define PdhLogServiceQuery          PdhLogServiceQueryA
  1217. #define PdhExpandWildCardPath       PdhExpandWildCardPathA
  1218. #define PdhBindInputDataSource      PdhBindInputDataSourceA
  1219. #define PdhEnumMachinesH            PdhEnumMachinesHA
  1220. #define PdhEnumObjectsH             PdhEnumObjectsHA
  1221. #define PdhEnumObjectItemsH         PdhEnumObjectItemsHA
  1222. #define PdhExpandWildCardPathH      PdhExpandWildCardPathHA
  1223. #define PdhGetDefaultPerfObjectH    PdhGetDefaultPerfObjectHA
  1224. #define PdhGetDefaultPerfCounterH   PdhGetDefaultPerfCounterHA
  1225. #define PdhEnumLogSetNames     PdhEnumLogSetNamesA
  1226. #define PdhCreateSQLTables     PdhCreateSQLTablesA
  1227. #define PdhVerifySQLDB             PdhVerifySQLDBA
  1228. // end of ANSI definitions
  1229. #endif  // UNICODE
  1230. #if _MSC_VER >= 1200
  1231. #pragma warning(pop)
  1232. #else
  1233. #pragma warning ( default : 4201 )
  1234. #endif
  1235. #ifdef __cplusplus
  1236. }
  1237. #endif
  1238. #endif //_PDH_H_