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.

337 lines
8.5 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. Globals.h
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _Globals_H
  9. #define _Globals_H
  10. #include <pssException.h>
  11. #include <Allocator.h>
  12. #include <BasicTree.h>
  13. #include "cglobals.h"
  14. #include "os.h"
  15. /******************************************************************************
  16. *
  17. * Name:
  18. *
  19. *
  20. * Description:
  21. *
  22. *
  23. *****************************************************************************/
  24. class DecoupledProviderSubSystem_Globals
  25. {
  26. public:
  27. static WmiAllocator *s_Allocator ;
  28. static LONG s_LocksInProgress ;
  29. static LONG s_ObjectsInProgress ;
  30. static LONG s_RegistrarUsers;
  31. static LONG s_CServerClassFactory_ObjectsInProgress ;
  32. static LONG s_CServerObject_ProviderRegistrar_ObjectsInProgress ;
  33. static LONG s_CServerObject_ProviderEvents_ObjectsInProgress ;
  34. static LONG s_CInterceptor_IWbemSyncProvider_ObjectsInProgress;
  35. static LONG s_CInterceptor_IWbemServices_Stub_ObjectsInProgress;
  36. static LONG s_CInterceptor_IWbemProviderInitSink_ObjectsInProgress;
  37. static LONG s_CInterceptor_IWbemWaitingObjectSink_ObjectsInProgress;
  38. static LONG s_CInterceptor_IWbemObjectSink_ObjectsInProgress;
  39. static LONG s_CInterceptor_IWbemSyncObjectSink_ObjectsInProgress;
  40. static LONG s_CInterceptor_IWbemFilteringObjectSink_ObjectsInProgress;
  41. static LONG s_CInterceptor_IWbemSyncFilteringObjectSink_ObjectsInProgress;
  42. static LONG s_CInterceptor_IWbemObjectSinkEx_ObjectsInProgress;
  43. static LONG s_CInterceptor_IWbemSyncObjectSinkEx_ObjectsInProgress;
  44. static LONG s_CInterceptor_IWbemCombiningObjectSink_ObjectsInProgress;
  45. static LONG s_CDecoupledAggregator_IWbemProvider_ObjectsInProgress;
  46. static LONG s_CInterceptor_IWbemDecoupledUnboundObjectSink_ObjectsInProgress;
  47. static LONG s_CDecoupled_Batching_IWbemSyncObjectSink_ObjectsInProgress;
  48. static LONG s_CDecoupled_IWbemSyncObjectSink_ObjectsInProgress;
  49. static LONG s_CInterceptor_DecoupledClient_ObjectsInProgress;
  50. static LONG s_CInterceptor_IWbemDecoupledProvider_ObjectsInProgress;
  51. static LONG s_CDecoupled_IWbemUnboundObjectSink_ObjectsInProgress;
  52. static HRESULT Global_Startup () ;
  53. static HRESULT Global_Shutdown () ;
  54. static HRESULT CreateSystemAces(void);
  55. static HRESULT DeleteSystemAces(void);
  56. static HRESULT CreateInstance (
  57. const CLSID &a_ReferenceClsid ,
  58. LPUNKNOWN a_OuterUnknown ,
  59. const DWORD &a_ClassContext ,
  60. const UUID &a_ReferenceInterfaceId ,
  61. void **a_ObjectInterface
  62. )
  63. {
  64. return ProviderSubSystem_Common_Globals::CreateInstance( a_ReferenceClsid, a_OuterUnknown, a_ClassContext, a_ReferenceInterfaceId, a_ObjectInterface);
  65. };
  66. static HRESULT IsDependantCall ( IWbemContext *a_Parent , IWbemContext *a_ChildContext , BOOL &a_DependantCall )
  67. {
  68. return ProviderSubSystem_Common_Globals::IsDependantCall ( a_Parent , a_ChildContext , a_DependantCall );
  69. } ;
  70. static HRESULT SetProxyState_SvcHost (
  71. ProxyContainer &a_Container ,
  72. ULONG a_ProxyIndex ,
  73. REFIID a_InterfaceId ,
  74. IUnknown *a_Interface ,
  75. IUnknown *&a_Proxy ,
  76. BOOL &a_Revert ,
  77. DWORD a_ProcessIdentifier ,
  78. HANDLE &a_IdentifyToken ,
  79. ACCESS_ALLOWED_ACE *a_Ace ,
  80. WORD a_AceSize,
  81. SECURITY_IMPERSONATION_LEVEL t_ImpersonationLevel
  82. ) ;
  83. static HRESULT RevertProxyState_SvcHost (
  84. ProxyContainer &a_Container ,
  85. ULONG a_ProxyIndex ,
  86. IUnknown *a_Proxy ,
  87. BOOL a_Revert ,
  88. DWORD a_ProcessIdentifier ,
  89. HANDLE a_IdentifyToken
  90. ) ;
  91. static HRESULT RevertProxyState_SvcHost (
  92. IUnknown *a_Proxy ,
  93. BOOL a_Revert ,
  94. DWORD a_ProcessIdentifier ,
  95. HANDLE a_IdentifyToken
  96. ) ;
  97. static HRESULT SetProxyState (
  98. REFIID a_InterfaceId ,
  99. IUnknown *a_Interface ,
  100. IUnknown *&a_Proxy ,
  101. BOOL &a_Revert
  102. )
  103. {
  104. if (OS::secureOS_)
  105. return ProviderSubSystem_Common_Globals::SetProxyState(a_InterfaceId, a_Interface, a_Proxy, a_Revert);
  106. else
  107. return WBEM_E_NOT_FOUND;
  108. }
  109. static HRESULT SinkAccessInitialize (SECURITY_DESCRIPTOR *a_RegistrationSecurityDescriptor ,
  110. SECURITY_DESCRIPTOR *&a_SinkSecurityDescriptor)
  111. {
  112. if (OS::secureOS_) return ProviderSubSystem_Common_Globals::SinkAccessInitialize(a_RegistrationSecurityDescriptor, a_SinkSecurityDescriptor);
  113. else
  114. {
  115. a_SinkSecurityDescriptor = 0;
  116. return S_OK;
  117. }
  118. }
  119. static HRESULT RevertProxyState (
  120. IUnknown *a_Proxy ,
  121. BOOL a_Revert
  122. )
  123. {
  124. if (OS::secureOS_)
  125. return ProviderSubSystem_Common_Globals::RevertProxyState(a_Proxy, a_Revert);
  126. else
  127. return S_OK;
  128. }
  129. static HRESULT Check_SecurityDescriptor_CallIdentity (
  130. SECURITY_DESCRIPTOR *a_SecurityDescriptor ,
  131. DWORD a_Access ,
  132. GENERIC_MAPPING *a_Mapping
  133. )
  134. {
  135. if (OS::secureOS_)
  136. return ProviderSubSystem_Common_Globals::Check_SecurityDescriptor_CallIdentity(a_SecurityDescriptor, a_Access, a_Mapping);
  137. else
  138. return S_OK;
  139. }
  140. static HRESULT UnMarshalRegistration (
  141. IUnknown **a_Unknown ,
  142. BYTE *a_MarshaledProxy ,
  143. DWORD a_MarshaledProxyLength
  144. )
  145. {
  146. return ProviderSubSystem_Common_Globals::UnMarshalRegistration(a_Unknown, a_MarshaledProxy, a_MarshaledProxyLength);
  147. };
  148. static HRESULT MarshalRegistration (
  149. IUnknown *a_Unknown ,
  150. BYTE *&a_MarshaledProxy ,
  151. DWORD &a_MarshaledProxyLength
  152. )
  153. {
  154. return ProviderSubSystem_Common_Globals::MarshalRegistration(a_Unknown, a_MarshaledProxy, a_MarshaledProxyLength);
  155. }
  156. static HRESULT SetCloaking ( IUnknown * proxy , DWORD authenticationLevel , DWORD impersonationLevel ) ;
  157. static HRESULT RevertProxyState (
  158. ProxyContainer &a_Container ,
  159. ULONG a_ProxyIndex ,
  160. IUnknown *a_Proxy ,
  161. BOOL a_Revert
  162. )
  163. {
  164. if (OS::secureOS_)
  165. return ProviderSubSystem_Common_Globals::RevertProxyState(a_Container, a_ProxyIndex, a_Proxy, a_Revert);
  166. else
  167. return S_OK;
  168. };
  169. static HRESULT BeginImpersonation (
  170. IUnknown *&a_OldContext ,
  171. IServerSecurity *&a_OldSecurity ,
  172. BOOL &a_Impersonating,
  173. DWORD *a_AuthenticationLevel = NULL
  174. ) ;
  175. static HRESULT EndImpersonation (
  176. IUnknown *a_OldContext ,
  177. IServerSecurity *a_OldSecurity ,
  178. BOOL a_Impersonating
  179. )
  180. {
  181. if (OS::secureOS_)
  182. return ProviderSubSystem_Common_Globals::EndImpersonation(a_OldContext, a_OldSecurity, a_Impersonating);
  183. else
  184. return S_OK;
  185. };
  186. static HRESULT SetProxyState (
  187. ProxyContainer &a_Container ,
  188. ULONG a_ProxyIndex ,
  189. REFIID a_InterfaceId ,
  190. IUnknown *a_Interface ,
  191. IUnknown *&a_Proxy ,
  192. BOOL &a_Revert
  193. )
  194. {
  195. if (OS::secureOS_)
  196. return ProviderSubSystem_Common_Globals::SetProxyState(a_Container, a_ProxyIndex, a_InterfaceId, a_Interface, a_Proxy, a_Revert);
  197. else
  198. return WBEM_E_NOT_FOUND;
  199. }
  200. static HRESULT GetAceWithProcessTokenUser (
  201. DWORD a_ProcessIdentifier ,
  202. WORD &a_AceSize ,
  203. ACCESS_ALLOWED_ACE *&a_Ace
  204. ) ;
  205. static HRESULT GetUserSid (
  206. HANDLE a_Token ,
  207. ULONG *a_Size ,
  208. PSID &a_Sid
  209. ) ;
  210. static DWORD GetCurrentImpersonationLevel ()
  211. {
  212. if (OS::secureOS_)
  213. return ProviderSubSystem_Common_Globals:: GetCurrentImpersonationLevel();
  214. else
  215. return RPC_C_IMP_LEVEL_ANONYMOUS;
  216. }
  217. static HRESULT BeginCallbackImpersonation (
  218. IUnknown *&a_OldContext ,
  219. IServerSecurity *&a_OldSecurity ,
  220. BOOL &a_Impersonating
  221. );
  222. static HRESULT CheckAccess (
  223. SECURITY_DESCRIPTOR *a_SecurityDescriptor ,
  224. DWORD a_Access ,
  225. GENERIC_MAPPING *a_Mapping)
  226. {
  227. if (OS::secureOS_)
  228. return ProviderSubSystem_Common_Globals::CheckAccess(a_SecurityDescriptor, a_Access, a_Mapping);
  229. else
  230. return S_OK;
  231. }
  232. static HRESULT BeginThreadImpersonation (
  233. IUnknown *&a_OldContext ,
  234. IServerSecurity *&a_OldSecurity ,
  235. BOOL &a_Impersonating
  236. ) ;
  237. static HRESULT EndThreadImpersonation (
  238. IUnknown *a_OldContext ,
  239. IServerSecurity *a_OldSecurity ,
  240. BOOL a_Impersonating
  241. ) ;
  242. static HRESULT Begin_IdentifyCall_PrvHost (
  243. WmiInternalContext a_InternalContext ,
  244. BOOL &a_Impersonating ,
  245. IUnknown *&a_OldContext ,
  246. IServerSecurity *&a_OldSecurity
  247. ) ;
  248. static HRESULT End_IdentifyCall_PrvHost (
  249. WmiInternalContext a_InternalContext ,
  250. IUnknown *&a_OldContext ,
  251. IServerSecurity *&a_OldSecurity ,
  252. BOOL &a_Impersonating
  253. ) ;
  254. static HRESULT Begin_IdentifyCall_SvcHost (
  255. WmiInternalContext a_InternalContext ,
  256. BOOL &a_Impersonating ,
  257. IUnknown *&a_OldContext ,
  258. IServerSecurity *&a_OldSecurity
  259. ) ;
  260. static HRESULT End_IdentifyCall_SvcHost (
  261. WmiInternalContext a_InternalContext ,
  262. IUnknown *&a_OldContext ,
  263. IServerSecurity *&a_OldSecurity ,
  264. BOOL &a_Impersonating
  265. ) ;
  266. } ;
  267. #endif // _Globals_H