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.

147 lines
6.3 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  4. //
  5. //***************************************************************************
  6. #ifndef _WDMSHELL_HEADER
  7. #define _WDMSHELL_HEADER
  8. #include "wmicom.h"
  9. //************************************************************************************************************
  10. //============================================================================================================
  11. //
  12. // The Standard WDM Shell
  13. //
  14. //============================================================================================================
  15. //************************************************************************************************************
  16. class CWMIClassType
  17. {
  18. public:
  19. CWMIClassType() {}
  20. ~CWMIClassType(){}
  21. BOOL IsHiPerfClass(WCHAR * wcsClass, IWbemServices * pServices);
  22. };
  23. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  24. class CWMIStandardShell
  25. {
  26. private:
  27. CWMIProcessClass * m_pClass;
  28. CProcessStandardDataBlock * m_pWDM;
  29. BOOL m_fInit;
  30. public:
  31. CWMIStandardShell();
  32. ~CWMIStandardShell();
  33. HRESULT Initialize(WCHAR * wcsClass, BOOL fInternalEvent, CHandleMap * pList,BOOL fUpdateNamespace, ULONG uDesiredAccess, IWbemServices __RPC_FAR * pServices,
  34. IWbemObjectSink __RPC_FAR * pHandler, IWbemContext __RPC_FAR *pCtx);
  35. inline BOOL HasMofChanged() { return m_pWDM->HasMofChanged(); }
  36. //=============================================
  37. // Process All and Single WMI Instances
  38. //=============================================
  39. HRESULT ProcessAllInstances();
  40. HRESULT ProcessSingleInstance( WCHAR * wcsInstanceName);
  41. //==========================================================
  42. // The put instance group
  43. //==========================================================
  44. HRESULT FillInAndSubmitWMIDataBlob( IWbemClassObject * pIClass, int nTypeOfPut, CVARIANT & vList);
  45. //=============================================
  46. // Event functions
  47. //=============================================
  48. HRESULT ProcessEvent(WORD wBinaryMofType, PWNODE_HEADER WnodeHeader);
  49. inline HRESULT RegisterWMIEvent( WCHAR * wcsGuid, ULONG_PTR uContext, CLSID & Guid, BOOL fRegistered)
  50. { return m_pWDM->RegisterWMIEvent(wcsGuid,uContext,Guid,fRegistered);}
  51. //=============================================
  52. // method functions
  53. //=============================================
  54. HRESULT ExecuteMethod( WCHAR * wcsInstance,
  55. WCHAR * MethodInstanceName,
  56. IWbemClassObject * pParentClass,
  57. IWbemClassObject * pInClassData,
  58. IWbemClassObject * pInClass,
  59. IWbemClassObject * pOutClass ) ;
  60. //=============================================
  61. // data processing functions
  62. //=============================================
  63. HRESULT GetGuid(WCHAR * pwcsGuid);
  64. HRESULT SetGuidForEvent( WORD wType,WCHAR * wcsGuid );
  65. HRESULT RegisterForWMIEvents( ULONG uContext, WCHAR * wcsGuid, BOOL fRegistered,CLSID & Guid );
  66. inline BOOL CancelWMIEventRegistration( GUID gGuid , ULONG_PTR uContext ) { return m_pClass->WMI()->CancelWMIEventRegistration(gGuid,uContext);}
  67. //=============================================
  68. // The binary mof groupg
  69. //=============================================
  70. HRESULT ProcessBinaryGuidsViaEvent( PWNODE_HEADER WnodeHeader,WORD wType );
  71. HRESULT QueryAndProcessAllBinaryGuidInstances(CNamespaceManagement & Namespace, BOOL & fMofHasChanged, KeyList * pArrDriversInRegistry);
  72. //=============================================
  73. // Misc
  74. //=============================================
  75. inline CLSID * GuidPtr() { return m_pClass->GuidPtr();}
  76. inline HRESULT SetErrorMessage(HRESULT hr){ return m_pClass->WMI()->SetErrorMessage(hr,m_pClass->GetClassName(),m_pWDM->GetMessage());}
  77. };
  78. //************************************************************************************************************
  79. //============================================================================================================
  80. //
  81. // The Hi Performance Shell
  82. //
  83. //============================================================================================================
  84. //************************************************************************************************************
  85. class CWMIHiPerfShell
  86. {
  87. private:
  88. CHiPerfHandleMap * m_pHiPerfMap;
  89. CProcessHiPerfDataBlock * m_pWDM;
  90. CWMIProcessClass * m_pClass;
  91. BOOL m_fAutoCleanup;
  92. BOOL m_fInit;
  93. HRESULT QueryAllInstances(HANDLE WMIHandle,IWbemHiPerfEnum* pHiPerfEnum);
  94. HRESULT QuerySingleInstance(HANDLE WMIHandle);
  95. public:
  96. CWMIHiPerfShell(BOOL fAuto);
  97. ~CWMIHiPerfShell();
  98. HRESULT Initialize(BOOL fUpdate, ULONG uDesiredAccess, CHandleMap * pList,WCHAR * wcs, IWbemServices __RPC_FAR * pServices,
  99. IWbemObjectSink __RPC_FAR * pHandler, IWbemContext __RPC_FAR *pCtx) ;
  100. inline void SetHiPerfHandleMap(CHiPerfHandleMap * p) { m_pHiPerfMap = p; }
  101. inline CCriticalSection * GetCriticalSection() { return m_pHiPerfMap->GetCriticalSection();}
  102. inline CHiPerfHandleMap * HiPerfHandleMap() { return m_pHiPerfMap;}
  103. HRESULT QueryAllHiPerfData();
  104. HRESULT HiPerfQuerySingleInstance(WCHAR * wcsInstance);
  105. HRESULT AddAccessObjectToRefresher(IWbemObjectAccess *pAccess, IWbemObjectAccess ** ppRefreshable, ULONG_PTR * plId);
  106. HRESULT AddEnumeratorObjectToRefresher(IWbemHiPerfEnum* pHiPerfEnum, ULONG_PTR * plId);
  107. HRESULT RemoveObjectFromHandleMap(ULONG_PTR lHiPerfId);
  108. HRESULT RefreshCompleteList();
  109. inline HRESULT SetErrorMessage(HRESULT hr){ return m_pClass->WMI()->SetErrorMessage(hr,m_pClass->GetClassName(),m_pWDM->GetMessage());}
  110. };
  111. #endif