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.

238 lines
4.6 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. ProvSubS.h
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _Server_Host_H
  9. #define _Server_Host_H
  10. /******************************************************************************
  11. *
  12. * Name:
  13. *
  14. *
  15. * Description:
  16. *
  17. *
  18. *****************************************************************************/
  19. #define ProxyIndex_Host__IWmiProviderHost 0
  20. #define ProxyIndex_Host_IWbemShutdown 1
  21. /******************************************************************************
  22. *
  23. * Name:
  24. *
  25. *
  26. * Description:
  27. *
  28. *
  29. *****************************************************************************/
  30. #include "ProvCache.h"
  31. class CServerObject_HostInterceptor : public _IWmiProviderHost ,
  32. public IWbemShutdown ,
  33. public HostCacheElement
  34. {
  35. private:
  36. WmiAllocator &m_Allocator ;
  37. IUnknown *m_Unknown ;
  38. IWbemShutdown *m_Host_IWbemShutdown ;
  39. _IWmiProviderHost *m_Host_IWmiProviderHost ;
  40. ProxyContainer m_ProxyContainer ;
  41. LONG m_Initialized ;
  42. LONG m_UnInitialized ;
  43. HRESULT m_InitializeResult ;
  44. HANDLE m_InitializedEvent ;
  45. IWbemContext *m_InitializationContext ;
  46. DWORD m_ProcessIdentifier ;
  47. void CallBackInternalRelease () ;
  48. public:
  49. CServerObject_HostInterceptor (
  50. WmiAllocator &a_Allocator ,
  51. CWbemGlobal_IWmiHostController *a_Controller ,
  52. const HostCacheKey &a_Key ,
  53. const ULONG &a_Period ,
  54. IWbemContext *a_InitializationContext
  55. ) ;
  56. ~CServerObject_HostInterceptor () ;
  57. HRESULT Initialize (
  58. IWbemContext *a_Context ,
  59. IWbemProviderInitSink *a_Sink // For init signals
  60. ) ;
  61. HRESULT SetHost ( IUnknown *a_Unknown ) ;
  62. HRESULT IsIndependant ( IWbemContext *a_Context ) ;
  63. HRESULT SetInitialized ( HRESULT a_InitializeResult ) ;
  64. HRESULT WaitHost ( IWbemContext *a_Context , ULONG a_Timeout ) ;
  65. HRESULT GetInitializeResult ()
  66. {
  67. return m_InitializeResult ;
  68. }
  69. DWORD GetProcessIdentifier ()
  70. {
  71. return m_ProcessIdentifier ;
  72. }
  73. static HRESULT AbnormalShutdown (
  74. HostCacheKey &a_Key
  75. ) ;
  76. static HRESULT CreateUsingAccount (
  77. HostCacheKey &a_Key ,
  78. LPWSTR a_User ,
  79. LPWSTR a_Domain ,
  80. _IWmiProviderHost **a_Host ,
  81. _IWmiProviderFactory **a_Factory ,
  82. IWbemContext *a_Context
  83. ) ;
  84. static HRESULT CreateUsingToken (
  85. HostCacheKey &a_Key ,
  86. _IWmiProviderHost **a_Host ,
  87. _IWmiProviderFactory **a_Factory ,
  88. IWbemContext *a_Context
  89. ) ;
  90. static HRESULT CreateUsingToken (
  91. HostCacheKey &a_Key ,
  92. _IWmiProviderHost **a_Host ,
  93. _IWbemRefresherMgr **a_RefresherManager ,
  94. IWbemContext *a_Context
  95. ) ;
  96. static HRESULT CreateUsingAccount (
  97. HostCacheKey &a_Key ,
  98. LPWSTR a_User ,
  99. LPWSTR a_Domain ,
  100. _IWmiProviderHost **a_Host ,
  101. _IWbemRefresherMgr **a_RefresherManager ,
  102. IWbemContext *a_Context
  103. ) ;
  104. static HRESULT FindHost (
  105. IWbemContext *a_Context ,
  106. HostCacheKey &a_Key ,
  107. REFIID a_RIID ,
  108. void **a_Interface
  109. ) ;
  110. public:
  111. //Non-delegating object IUnknown
  112. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  113. STDMETHODIMP_( ULONG ) AddRef () ;
  114. STDMETHODIMP_( ULONG ) Release () ;
  115. HRESULT STDMETHODCALLTYPE GetObject (
  116. REFCLSID a_Clsid ,
  117. long a_Flags ,
  118. IWbemContext *a_Context ,
  119. REFIID a_Riid ,
  120. void **a_Interface
  121. ) ;
  122. HRESULT STDMETHODCALLTYPE GetProcessIdentifier ( DWORD *a_ProcessIdentifier ) ;
  123. // IWmi_UnInitialize members
  124. HRESULT STDMETHODCALLTYPE Shutdown (
  125. LONG a_Flags ,
  126. ULONG a_MaxMilliSeconds ,
  127. IWbemContext *a_Context
  128. ) ;
  129. } ;
  130. /******************************************************************************
  131. *
  132. * Name:
  133. *
  134. *
  135. * Description:
  136. *
  137. *
  138. *****************************************************************************/
  139. class CServerObject_Host : public _IWmiProviderHost ,
  140. public IWbemShutdown
  141. {
  142. private:
  143. LONG m_ReferenceCount ;
  144. WmiAllocator &m_Allocator ;
  145. protected:
  146. public:
  147. CServerObject_Host ( WmiAllocator &a_Allocator ) ;
  148. ~CServerObject_Host ( void ) ;
  149. //IUnknown members
  150. STDMETHODIMP QueryInterface ( REFIID , LPVOID FAR * ) ;
  151. STDMETHODIMP_( ULONG ) AddRef () ;
  152. STDMETHODIMP_( ULONG ) Release () ;
  153. //
  154. HRESULT STDMETHODCALLTYPE GetObject (
  155. REFCLSID a_Clsid ,
  156. long a_Flags ,
  157. IWbemContext *a_Context ,
  158. REFIID a_Riid ,
  159. void **a_Interface
  160. ) ;
  161. HRESULT STDMETHODCALLTYPE GetProcessIdentifier ( DWORD *a_ProcessIdentifier ) ;
  162. // IWmi_UnInitialize members
  163. HRESULT STDMETHODCALLTYPE Shutdown (
  164. LONG a_Flags ,
  165. ULONG a_MaxMilliSeconds ,
  166. IWbemContext *a_Context
  167. ) ;
  168. };
  169. #endif // _Server_Host_H