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.

157 lines
4.5 KiB

  1. /*++
  2. Copyright (C) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. ntperf.h
  5. Abstract:
  6. NT5 Perf counter provider
  7. <abstract>
  8. --*/
  9. #ifndef _NTPERF_H_
  10. #define _NTPERF_H_
  11. #include "flexarry.h"
  12. #include "classmap.h"
  13. #include "perfacc.h"
  14. const DWORD cdwClassMapTimeout = 10000;
  15. //***************************************************************************
  16. //
  17. // class CNt5PerfProvider
  18. //
  19. //***************************************************************************
  20. class CNt5PerfProvider : public IWbemHiPerfProvider, public IWbemProviderInit
  21. {
  22. friend class CNt5Refresher;
  23. public:
  24. typedef enum {
  25. CLSID_SERVER,
  26. CLSID_CLIENT
  27. } enumCLSID;
  28. private:
  29. LONG m_lRef;
  30. enumCLSID m_OriginClsid;
  31. CFlexArray m_aCache; // Array of CClassMapInfo pointers
  32. CPerfObjectAccess m_PerfObject; // class to interface
  33. HANDLE m_hClassMapMutex; // Lock the provider's Class Map Cache
  34. protected:
  35. BOOL AddClassMap(CClassMapInfo *pCls);
  36. CClassMapInfo *FindClassMap(LPWSTR pszClassName);
  37. BOOL MapClass(
  38. IWbemServices *pNs,
  39. WCHAR *wszClass,
  40. IWbemContext *pCtx
  41. );
  42. public:
  43. static BOOL HasPermission (void);
  44. static HRESULT CheckImpersonationLevel (void);
  45. CNt5PerfProvider(enumCLSID OriginClsid);
  46. ~CNt5PerfProvider();
  47. // Interface members.
  48. // ==================
  49. ULONG STDMETHODCALLTYPE AddRef();
  50. ULONG STDMETHODCALLTYPE Release();
  51. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  52. // helper functions
  53. HRESULT CNt5PerfProvider::CreateRefresherObject(
  54. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  55. /* [in] */ IWbemObjectAccess __RPC_FAR *pTemplate,
  56. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  57. /* [in] */ long lFlags,
  58. /* [in] */ IWbemContext __RPC_FAR *pContext,
  59. /* [string][in] */ LPCWSTR wszClass,
  60. /* [in] */ IWbemHiPerfEnum __RPC_FAR *pHiPerfEnum,
  61. /* [out] */ IWbemObjectAccess __RPC_FAR *__RPC_FAR *ppRefreshable,
  62. /* [out] */ long __RPC_FAR *plId
  63. );
  64. // IWbemHiPerfProvider methods.
  65. // ============================
  66. virtual HRESULT STDMETHODCALLTYPE QueryInstances(
  67. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  68. /* [string][in] */ WCHAR __RPC_FAR *wszClass,
  69. /* [in] */ long lFlags,
  70. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  71. /* [in] */ IWbemObjectSink __RPC_FAR *pSink
  72. );
  73. virtual HRESULT STDMETHODCALLTYPE CreateRefresher(
  74. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  75. /* [in] */ long lFlags,
  76. /* [out] */ IWbemRefresher __RPC_FAR *__RPC_FAR *ppRefresher
  77. );
  78. virtual HRESULT STDMETHODCALLTYPE CreateRefreshableObject(
  79. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  80. /* [in] */ IWbemObjectAccess __RPC_FAR *pTemplate,
  81. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  82. /* [in] */ long lFlags,
  83. /* [in] */ IWbemContext __RPC_FAR *pContext,
  84. /* [out] */ IWbemObjectAccess __RPC_FAR *__RPC_FAR *ppRefreshable,
  85. /* [out] */ long __RPC_FAR *plId
  86. );
  87. virtual HRESULT STDMETHODCALLTYPE StopRefreshing(
  88. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  89. /* [in] */ long lId,
  90. /* [in] */ long lFlags
  91. );
  92. virtual HRESULT STDMETHODCALLTYPE CreateRefreshableEnum(
  93. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  94. /* [string][in] */ LPCWSTR wszClass,
  95. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  96. /* [in] */ long lFlags,
  97. /* [in] */ IWbemContext __RPC_FAR *pContext,
  98. /* [in] */ IWbemHiPerfEnum __RPC_FAR *pHiPerfEnum,
  99. /* [out] */ long __RPC_FAR *plId);
  100. virtual HRESULT STDMETHODCALLTYPE GetObjects(
  101. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  102. /* [in] */ long lNumObjects,
  103. /* [size_is][in] */ IWbemObjectAccess __RPC_FAR *__RPC_FAR *apObj,
  104. /* [in] */ long lFlags,
  105. /* [in] */ IWbemContext __RPC_FAR *pContext);
  106. // IWbemProviderInit method.
  107. // =========================
  108. virtual HRESULT STDMETHODCALLTYPE Initialize(
  109. /* [unique][in] */ LPWSTR wszUser,
  110. /* [in] */ LONG lFlags,
  111. /* [in] */ LPWSTR wszNamespace,
  112. /* [unique][in] */ LPWSTR wszLocale,
  113. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  114. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  115. /* [in] */ IWbemProviderInitSink __RPC_FAR *pInitSink
  116. );
  117. };
  118. // defined in server.cpp
  119. extern void ObjectCreated();
  120. extern void ObjectDestroyed();
  121. #endif