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.

186 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. ulperf.h
  5. Abstract:
  6. This is the main header for the ul.sys performance counter support object
  7. Author:
  8. Paul McDaniel (paulmcd) 10-May-1999
  9. Revision History:
  10. --*/
  11. #ifndef __ULPERF_H_
  12. #define __ULPERF_H_
  13. #include <afxtempl.h>
  14. #include "resource.h"
  15. DEFINE_GUID(CLSID_UlPerfCounters, 0xe8833ce8,0x0722,0x11d3,0xa4,0x41,0x00,0x80,0xc7,0xe1,0x1d,0x99);
  16. //
  17. // CritSecLocker
  18. //
  19. class CritSecLocker
  20. {
  21. public:
  22. CritSecLocker(CComAutoCriticalSection *pCritSect)
  23. {
  24. this->pCritSect = pCritSect;
  25. if (pCritSect) pCritSect->Lock();
  26. }
  27. ~CritSecLocker()
  28. {
  29. if (this->pCritSect) this->pCritSect->Unlock();
  30. }
  31. private:
  32. CComAutoCriticalSection *pCritSect;
  33. };
  34. //
  35. // CUlPerfCounters
  36. //
  37. class ATL_NO_VTABLE CUlPerfCounters :
  38. public CComObjectRoot,
  39. public CComCoClass<CUlPerfCounters, &CLSID_UlPerfCounters>,
  40. public IWbemServices,
  41. public IWbemProviderInit
  42. {
  43. public:
  44. CUlPerfCounters();
  45. ~CUlPerfCounters();
  46. DECLARE_REGISTRY_RESOURCEID(IDR_ULPERF)
  47. DECLARE_NOT_AGGREGATABLE(CUlPerfCounters)
  48. BEGIN_COM_MAP(CUlPerfCounters)
  49. COM_INTERFACE_ENTRY(IWbemServices)
  50. COM_INTERFACE_ENTRY(IWbemProviderInit)
  51. END_COM_MAP()
  52. public:
  53. //
  54. // IWbemProviderInit
  55. //
  56. STDMETHOD(Initialize)(LPWSTR wszUser,LONG lFlags,LPWSTR wszNamespace,LPWSTR wszLocale,IWbemServices* pNamespace,IWbemContext* pCtx,IWbemProviderInitSink* pInitSink);
  57. //
  58. // IWbemServices
  59. //
  60. // Context.
  61. // ========
  62. STDMETHOD(OpenNamespace)(BSTR strNamespace, long lFlags, IWbemContext* pCtx, IWbemServices** ppWorkingNamespace, IWbemCallResult** ppResult);
  63. STDMETHOD(CancelAsyncCall)(IWbemObjectSink* pSink);
  64. STDMETHOD(QueryObjectSink)(long lFlags,IWbemObjectSink** ppResponseHandler);
  65. // Classes and instances.
  66. // ======================
  67. STDMETHOD(GetObject)(BSTR strObjectPath,long lFlags,IWbemContext* pCtx,IWbemClassObject** ppObject,IWbemCallResult** ppCallResult);
  68. STDMETHOD(GetObjectAsync)(BSTR strObjectPath,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  69. // Class manipulation.
  70. // ===================
  71. STDMETHOD(PutClass)(IWbemClassObject* pObject,long lFlags,IWbemContext* pCtx,IWbemCallResult** ppCallResult);
  72. STDMETHOD(PutClassAsync)(IWbemClassObject* pObject,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  73. STDMETHOD(DeleteClass)(BSTR strClass,long lFlags,IWbemContext* pCtx,IWbemCallResult** ppCallResult);
  74. STDMETHOD(DeleteClassAsync)(BSTR strClass,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  75. STDMETHOD(CreateClassEnum)(BSTR strSuperclass,long lFlags,IWbemContext* pCtx,IEnumWbemClassObject** ppEnum);
  76. STDMETHOD(CreateClassEnumAsync)(BSTR strSuperclass,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  77. // Instances.
  78. // ==========
  79. STDMETHOD(PutInstance)(IWbemClassObject* pInst,long lFlags,IWbemContext* pCtx,IWbemCallResult** ppCallResult);
  80. STDMETHOD(PutInstanceAsync)(IWbemClassObject* pInst,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  81. STDMETHOD(DeleteInstance)(BSTR strObjectPath,long lFlags,IWbemContext* pCtx,IWbemCallResult** ppCallResult);
  82. STDMETHOD(DeleteInstanceAsync)(BSTR strObjectPath,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  83. STDMETHOD(CreateInstanceEnum)(BSTR strClass,long lFlags,IWbemContext* pCtx,IEnumWbemClassObject** ppEnum);
  84. STDMETHOD(CreateInstanceEnumAsync)(BSTR strClass,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  85. // Queries.
  86. // ========
  87. STDMETHOD(ExecQuery)(BSTR strQueryLanguage,BSTR strQuery,long lFlags,IWbemContext* pCtx,IEnumWbemClassObject** ppEnum);
  88. STDMETHOD(ExecQueryAsync)(BSTR strQueryLanguage,BSTR strQuery,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  89. STDMETHOD(ExecNotificationQuery)(BSTR strQueryLanguage,BSTR strQuery,long lFlags,IWbemContext* pCtx,IEnumWbemClassObject** ppEnum);
  90. STDMETHOD(ExecNotificationQueryAsync)(BSTR strQueryLanguage,BSTR strQuery,long lFlags,IWbemContext* pCtx,IWbemObjectSink* pResponseHandler);
  91. // Methods
  92. // =======
  93. STDMETHOD(ExecMethod)(BSTR strObjectPath,BSTR strMethodName,long lFlags,IWbemContext* pCtx,IWbemClassObject* pInParams,IWbemClassObject** ppOutParams,IWbemCallResult** ppCallResult);
  94. STDMETHOD(ExecMethodAsync)(BSTR strObjectPath,BSTR strMethodName,long lFlags,IWbemContext* pCtx,IWbemClassObject* pInParams,IWbemObjectSink* pResponseHandler);
  95. public:
  96. CComAutoCriticalSection CritSect;
  97. };
  98. //
  99. // Globals
  100. //
  101. extern LONG g_lInit;
  102. extern HINSTANCE g_hInstance;
  103. typedef struct _UL_PERF_OBJECT_DEFINITION
  104. {
  105. PERF_OBJECT_TYPE ObjectType;
  106. PERF_COUNTER_DEFINITION BytesSent;
  107. PERF_COUNTER_DEFINITION BytesReceived;
  108. PERF_COUNTER_DEFINITION CurrentConnections;
  109. PERF_COUNTER_DEFINITION CurrentRequests;
  110. PERF_COUNTER_DEFINITION QueuedRequests;
  111. PERF_COUNTER_DEFINITION AttachedProcesses;
  112. } UL_PERF_OBJECT_DEFINITION;
  113. typedef struct _UL_COUNTER_BLOCK
  114. {
  115. PERF_COUNTER_BLOCK PerfCounterBlock;
  116. DWORD BytesSent;
  117. DWORD BytesReceived;
  118. DWORD CurrentConnections;
  119. DWORD CurrentRequests;
  120. DWORD QueuedRequests;
  121. DWORD AttachedProcesses;
  122. } UL_COUNTER_BLOCK;
  123. extern UL_PERF_OBJECT_DEFINITION PerfObjectDefinition;
  124. #endif // __ULPERF_H_