Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1464 lines
40 KiB

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