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.

155 lines
4.0 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. //***************************************************************************
  8. //
  9. // NTPERF.H
  10. //
  11. // NT5 Perf Counter Provider
  12. //
  13. // raymcc 02-Dec-97
  14. //
  15. //***************************************************************************
  16. #ifndef _NTPERF_H_
  17. #define _NTPERF_H_
  18. #include "flexarry.h"
  19. #include "classmap.h"
  20. #define NUM_SAMPLE_INSTANCES 10
  21. #define PROVIDER_NAME L"NT5_GenericPerfProvider_V1"
  22. inline wchar_t *Macro_CloneLPWSTR(LPCWSTR src)
  23. {
  24. if (!src)
  25. return 0;
  26. wchar_t *dest = new wchar_t[wcslen(src) + 1];
  27. if (!dest)
  28. return 0;
  29. return wcscpy(dest, src);
  30. }
  31. class CNt5PerfProvider;
  32. //***************************************************************************
  33. //
  34. // class CNt5PerfProvider
  35. //
  36. //***************************************************************************
  37. class CNt5PerfProvider : public IWbemHiPerfProvider, public IWbemProviderInit
  38. {
  39. LONG m_lRef;
  40. CFlexArray m_aCache; // Array of CClassMapInfo pointers
  41. friend class CNt5Refresher;
  42. public:
  43. CNt5PerfProvider();
  44. ~CNt5PerfProvider();
  45. BOOL MapClass(
  46. IWbemServices *pNs,
  47. WCHAR *wszClass,
  48. IWbemContext *pCtx
  49. );
  50. void AddClassMap(CClassMapInfo *pCls);
  51. CClassMapInfo *FindClassMap(LPWSTR pszClassName);
  52. // Interface members.
  53. // ==================
  54. ULONG STDMETHODCALLTYPE AddRef();
  55. ULONG STDMETHODCALLTYPE Release();
  56. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  57. // IWbemHiPerfProvider methods.
  58. // ============================
  59. virtual HRESULT STDMETHODCALLTYPE QueryInstances(
  60. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  61. /* [string][in] */ WCHAR __RPC_FAR *wszClass,
  62. /* [in] */ long lFlags,
  63. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  64. /* [in] */ IWbemObjectSink __RPC_FAR *pSink
  65. );
  66. virtual HRESULT STDMETHODCALLTYPE CreateRefresher(
  67. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  68. /* [in] */ long lFlags,
  69. /* [out] */ IWbemRefresher __RPC_FAR *__RPC_FAR *ppRefresher
  70. );
  71. virtual HRESULT STDMETHODCALLTYPE CreateRefreshableObject(
  72. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  73. /* [in] */ IWbemObjectAccess __RPC_FAR *pTemplate,
  74. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  75. /* [in] */ long lFlags,
  76. /* [in] */ IWbemContext __RPC_FAR *pContext,
  77. /* [out] */ IWbemObjectAccess __RPC_FAR *__RPC_FAR *ppRefreshable,
  78. /* [out] */ long __RPC_FAR *plId
  79. );
  80. virtual HRESULT STDMETHODCALLTYPE StopRefreshing(
  81. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  82. /* [in] */ long lId,
  83. /* [in] */ long lFlags
  84. );
  85. virtual HRESULT STDMETHODCALLTYPE CreateRefreshableEnum(
  86. /* [in] */ IWbemServices* pNamespace,
  87. /* [in, string] */ LPCWSTR wszClass,
  88. /* [in] */ IWbemRefresher* pRefresher,
  89. /* [in] */ long lFlags,
  90. /* [in] */ IWbemContext* pContext,
  91. /* [in] */ IWbemHiPerfEnum* pHiPerfEnum,
  92. /* [out] */ long* plId
  93. );
  94. virtual HRESULT STDMETHODCALLTYPE GetObjects(
  95. /* [in] */ IWbemServices* pNamespace,
  96. /* [in] */ long lNumObjects,
  97. /* [in,size_is(lNumObjects)] */ IWbemObjectAccess** apObj,
  98. /* [in] */ long lFlags,
  99. /* [in] */ IWbemContext* pContext);
  100. // IWbemProviderInit method.
  101. // =========================
  102. virtual HRESULT STDMETHODCALLTYPE Initialize(
  103. /* [unique][in] */ LPWSTR wszUser,
  104. /* [in] */ LONG lFlags,
  105. /* [in] */ LPWSTR wszNamespace,
  106. /* [unique][in] */ LPWSTR wszLocale,
  107. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  108. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  109. /* [in] */ IWbemProviderInitSink __RPC_FAR *pInitSink
  110. );
  111. };
  112. extern void ObjectCreated();
  113. extern void ObjectDestroyed();
  114. #endif
  115.