Leaked source code of windows server 2003
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.

148 lines
6.0 KiB

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