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.

139 lines
3.6 KiB

  1. /*++
  2. Copyright (C) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. //////////////////////////////////////////////////////////////////////
  8. //
  9. // HiPerfProv.h
  10. //
  11. // Based on NTPerf by raymcc.
  12. //
  13. // Created by a-dcrews, Oct 15, 1998
  14. //
  15. //////////////////////////////////////////////////////////////////////
  16. #ifndef _HIPERFPROV_H_
  17. #define _HIPERFPROV_H_
  18. #include <unk.h>
  19. #define NUM_SAMPLE_INSTANCES 10
  20. #define SAMPLE_CLASS L"Win32_ContinuousCounter"
  21. // {49707B1E-74C3-11d2-B338-00105A1469B7}
  22. const IID IID_IHiPerfProvider = {0x49707b1e, 0x74c3, 0x11d2, 0xb3, 0x38, 0x0, 0x10, 0x5a, 0x14, 0x69, 0xb7};
  23. class CHiPerfProvider : public CUnk
  24. {
  25. protected:
  26. IWbemObjectAccess *m_aInstances[NUM_SAMPLE_INSTANCES];
  27. LONG m_hName;
  28. HRESULT SetHandles(IWbemClassObject* pSampleClass);
  29. friend class CRefresher;
  30. protected:
  31. class XProviderInit : public CImpl<IWbemProviderInit, CHiPerfProvider>
  32. {
  33. public:
  34. XProviderInit(CHiPerfProvider *pObject) :
  35. CImpl<IWbemProviderInit, CHiPerfProvider>(pObject)
  36. {}
  37. STDMETHOD(Initialize)(
  38. /* [unique][in] */ LPWSTR wszUser,
  39. /* [in] */ LONG lFlags,
  40. /* [in] */ LPWSTR wszNamespace,
  41. /* [unique][in] */ LPWSTR wszLocale,
  42. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  43. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  44. /* [in] */ IWbemProviderInitSink __RPC_FAR *pInitSink );
  45. } m_XProviderInit;
  46. friend XProviderInit;
  47. class XHiPerfProvider : public CImpl<IWbemHiPerfProvider, CHiPerfProvider>
  48. {
  49. public:
  50. XHiPerfProvider(CHiPerfProvider *pObject) :
  51. CImpl<IWbemHiPerfProvider, CHiPerfProvider>(pObject)
  52. {}
  53. STDMETHOD(QueryInstances)(
  54. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  55. /* [string][in] */ WCHAR __RPC_FAR *wszClass,
  56. /* [in] */ long lFlags,
  57. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  58. /* [in] */ IWbemObjectSink __RPC_FAR *pSink );
  59. STDMETHOD(CreateRefresher)(
  60. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  61. /* [in] */ long lFlags,
  62. /* [out] */ IWbemRefresher __RPC_FAR *__RPC_FAR *ppRefresher );
  63. STDMETHOD(CreateRefreshableObject)(
  64. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  65. /* [in] */ IWbemObjectAccess __RPC_FAR *pTemplate,
  66. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  67. /* [in] */ long lFlags,
  68. /* [in] */ IWbemContext __RPC_FAR *pContext,
  69. /* [out] */ IWbemObjectAccess __RPC_FAR *__RPC_FAR *ppRefreshable,
  70. /* [out] */ long __RPC_FAR *plId );
  71. STDMETHOD(StopRefreshing)(
  72. /* [in] */ IWbemRefresher __RPC_FAR *pRefresher,
  73. /* [in] */ long lId,
  74. /* [in] */ long lFlags );
  75. STDMETHOD(CreateRefreshableEnum)(
  76. /* [in] */ IWbemServices* pNamespace,
  77. /* [in, string] */ LPCWSTR wszClass,
  78. /* [in] */ IWbemRefresher* pRefresher,
  79. /* [in] */ long lFlags,
  80. /* [in] */ IWbemContext* pContext,
  81. /* [in] */ IWbemHiPerfEnum* pHiPerfEnum,
  82. /* [out] */ long* plId);
  83. STDMETHOD(GetObjects)(
  84. /* [in] */ IWbemServices* pNamespace,
  85. /* [in] */ long lNumObjects,
  86. /* [in,size_is(lNumObjects)] */ IWbemObjectAccess** apObj,
  87. /* [in] */ long lFlags,
  88. /* [in] */ IWbemContext* pContext);
  89. } m_XHiPerfProvider;
  90. friend XHiPerfProvider;
  91. class XRefresher : public CImpl<IWbemRefresher, CHiPerfProvider>
  92. {
  93. friend XHiPerfProvider;
  94. IWbemObjectAccess *m_aRefInstances[NUM_SAMPLE_INSTANCES];
  95. BOOL AddObject(IWbemObjectAccess *pObj, LONG *plId);
  96. BOOL RemoveObject(LONG lId);
  97. public:
  98. XRefresher(CHiPerfProvider *pObject);
  99. virtual ~XRefresher();
  100. STDMETHOD(Refresh)(/* [in] */ long lFlags);
  101. } m_XRefresher;
  102. friend XRefresher;
  103. public:
  104. CHiPerfProvider(CLifeControl *pControl);
  105. ~CHiPerfProvider();
  106. virtual void* GetInterface(REFIID riid);
  107. };
  108. #endif // _HIPERFPROV_H_