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.

129 lines
2.6 KiB

  1. /*
  2. WBEMUtil.H
  3. utilities & definitions for use with WBEM perf counters
  4. */
  5. #ifndef __CNTRTEXT_WBEMUTIL_H_
  6. #define __CNTRTEXT_WBEMUTIL_H_
  7. #include <winperf.h>
  8. #ifdef __cplusplus
  9. extern "c" {
  10. #endif
  11. typedef struct _PERFTYPE_LOOKUP {
  12. LONG PerfType;
  13. LPWSTR RawType;
  14. LPWSTR FmtType;
  15. } PERFTYPE_LOOKUP, *PPERFTYPE_LOOKUP;
  16. typedef struct _PERFOBJECT_LOOKUP {
  17. LONG PerfObjectId;
  18. LPWSTR GuidString;
  19. } PERFOBJECT_LOOKUP, *PPERFOBJECT_LOOKUP;
  20. typedef struct _PERF_COUNTER_DLL_INFO {
  21. LPWSTR szWbemProviderName;
  22. LPWSTR szClassGuid;
  23. LPWSTR szRegistryKey;
  24. } PERF_COUNTER_DLL_INFO, *PPERF_COUNTER_DLL_INFO;
  25. extern const PPERFTYPE_LOOKUP PerfTypes;
  26. extern const DWORD dwNumPerfTypes;
  27. extern const PPERFOBJECT_LOOKUP PerfObjectGuids;
  28. extern const DWORD dwNumPerfObjectGuids;
  29. extern LPCWSTR szRawClass;
  30. extern LPCWSTR szFmtClass;
  31. extern LPCWSTR szGenericProviderName;
  32. extern LPCWSTR szGenericProviderGuid;
  33. __inline
  34. BOOL
  35. IsDisplayableType (
  36. DWORD dwCounterType
  37. )
  38. {
  39. if ((dwCounterType & PERF_DISPLAY_NOSHOW) &&
  40. (dwCounterType != PERF_AVERAGE_BULK)) {
  41. return FALSE;
  42. } else {
  43. return TRUE;
  44. }
  45. }
  46. LPCWSTR
  47. GetPerfObjectGuid (
  48. DWORD dwObjectId
  49. );
  50. PERFTYPE_LOOKUP *
  51. GetPerfTypeInfo (
  52. DWORD dwType
  53. );
  54. LPCWSTR
  55. FormatPerfName (
  56. LPWSTR szNameIn,
  57. BOOL bHiddenCounter
  58. );
  59. DWORD
  60. GenerateMofHeader (
  61. LPWSTR szBuffer, // string buffer
  62. LPCWSTR szComputerName,
  63. LPDWORD pcchBufferSize
  64. );
  65. // dwFlags values
  66. #define WM_GMO_RAW_DEFINITION ((DWORD)0x00000001)
  67. #define WM_GMO_COSTLY_OBJECT ((DWORD)0x00000002)
  68. #define WM_GMO_DEFAULT_OBJECT ((DWORD)0x00000004)
  69. #define WM_GMO_DEFAULT_COUNTER ((DWORD)0x00000008)
  70. DWORD
  71. GenerateMofObject (
  72. LPWSTR szBuffer,
  73. LPDWORD pcchBufferSize,
  74. PPERF_COUNTER_DLL_INFO pPcDllInfo,
  75. PERF_OBJECT_TYPE *pPerfObject,
  76. LPWSTR *lpCounterText,
  77. LPWSTR *lpDisplayText, // Localized name strings array
  78. DWORD dwFlags
  79. );
  80. DWORD
  81. GenerateMofCounter (
  82. LPWSTR szBuffer,
  83. LPDWORD pcchBufferSize,
  84. PERF_COUNTER_DEFINITION *pPerfCounter,
  85. LPWSTR *lpCounterText, // ENGLISH name strings array
  86. LPWSTR *lpDisplayText, // Localized name strings array
  87. DWORD dwFlags
  88. );
  89. DWORD
  90. GenerateMofObjectTail (
  91. LPWSTR szBuffer,
  92. LPDWORD pcchBufferSize
  93. );
  94. DWORD
  95. GenerateMofInstances (
  96. LPWSTR szBuffer,
  97. LPDWORD pcchBufferSize,
  98. PERF_DATA_BLOCK * pPerfDataBlock,
  99. PERF_OBJECT_TYPE * pPerfObject,
  100. LPWSTR * lpCounterText, // ENGLISH name strings array
  101. LPWSTR * lpDisplayText, // Localized name strings array
  102. DWORD dwFlags
  103. );
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif //__CNTRTEXT_WBEMUTIL_H_