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.

311 lines
10 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 "ProvCntrs.h"
  14. #include "ProvCache.h"
  15. #include "ProvDcAggr.h"
  16. #include "StrobeThread.h"
  17. #include <lockst.h>
  18. /******************************************************************************
  19. *
  20. * Name:
  21. *
  22. *
  23. * Description:
  24. *
  25. *
  26. *****************************************************************************/
  27. enum Event_Identifier {
  28. Msft_WmiProvider_ComServerLoadOperationEvent = 0 ,
  29. Msft_WmiProvider_ComServerOperationFailureEvent ,
  30. Msft_WmiProvider_LoadOperationEvent ,
  31. Msft_WmiProvider_LoadOperationFailureEvent ,
  32. Msft_WmiProvider_InitializationOperationFailureEvent ,
  33. Msft_WmiProvider_InitializationOperationEvent ,
  34. Msft_WmiProvider_UnLoadOperationEvent ,
  35. #if 0
  36. Msft_WmiProvider_HostLoadOperationEvent ,
  37. Msft_WmiProvider_HostLoadFailureOperationEvent ,
  38. Msft_WmiProvider_HostUnLoadOperationEvent ,
  39. #endif
  40. Msft_WmiProvider_GetObjectAsyncEvent_Pre ,
  41. Msft_WmiProvider_PutClassAsyncEvent_Pre ,
  42. Msft_WmiProvider_DeleteClassAsyncEvent_Pre ,
  43. Msft_WmiProvider_CreateClassEnumAsyncEvent_Pre ,
  44. Msft_WmiProvider_PutInstanceAsyncEvent_Pre ,
  45. Msft_WmiProvider_DeleteInstanceAsyncEvent_Pre ,
  46. Msft_WmiProvider_CreateInstanceEnumAsyncEvent_Pre ,
  47. Msft_WmiProvider_ExecQueryAsyncEvent_Pre ,
  48. Msft_WmiProvider_ExecNotificationQueryAsyncEvent_Pre ,
  49. Msft_WmiProvider_ExecMethodAsyncEvent_Pre ,
  50. Msft_WmiProvider_ProvideEvents_Pre ,
  51. Msft_WmiProvider_AccessCheck_Pre ,
  52. Msft_WmiProvider_CancelQuery_Pre ,
  53. Msft_WmiProvider_NewQuery_Pre ,
  54. Msft_WmiProvider_GetObjectAsyncEvent_Post ,
  55. Msft_WmiProvider_PutClassAsyncEvent_Post ,
  56. Msft_WmiProvider_DeleteClassAsyncEvent_Post ,
  57. Msft_WmiProvider_CreateClassEnumAsyncEvent_Post ,
  58. Msft_WmiProvider_PutInstanceAsyncEvent_Post ,
  59. Msft_WmiProvider_DeleteInstanceAsyncEvent_Post ,
  60. Msft_WmiProvider_CreateInstanceEnumAsyncEvent_Post ,
  61. Msft_WmiProvider_ExecQueryAsyncEvent_Post ,
  62. Msft_WmiProvider_ExecNotificationQueryAsyncEvent_Post ,
  63. Msft_WmiProvider_ExecMethodAsyncEvent_Post ,
  64. Msft_WmiProvider_ProvideEvents_Post ,
  65. Msft_WmiProvider_AccessCheck_Post ,
  66. Msft_WmiProvider_CancelQuery_Post ,
  67. Msft_WmiProvider_NewQuery_Post
  68. } ;
  69. /******************************************************************************
  70. *
  71. * Name:
  72. *
  73. *
  74. * Description:
  75. *
  76. *
  77. *****************************************************************************/
  78. class ProviderSubSystem_Globals
  79. {
  80. public:
  81. static LONG s_Initialized ;
  82. static WmiAllocator *s_Allocator ;
  83. static CriticalSection s_DecoupledRegistrySection ;
  84. static HANDLE s_FileMapping ;
  85. static CServerObject_ProviderSubsystem_Counters *s_SharedCounters ;
  86. static CriticalSection s_GuidTagSection ;
  87. static CWbemGlobal_ComServerTagContainer *s_GuidTag ;
  88. static HostController *s_HostController ;
  89. static RefresherManagerController *s_RefresherManagerController ;
  90. static CWbemGlobal_HostedProviderController *s_HostedProviderController ;
  91. static CWbemGlobal_IWmiProvSubSysController *s_ProvSubSysController ;
  92. static CWbemGlobal_IWbemSyncProviderController *s_SyncProviderController ;
  93. static CDecoupled_ProviderSubsystemRegistrar *s_DecoupledRegistrar ;
  94. static StrobeThread *s_StrobeThread ;
  95. static LONG s_LocksInProgress ;
  96. static LONG s_ObjectsInProgress ;
  97. static HANDLE s_CoFreeUnusedLibrariesEvent ;
  98. static LPCWSTR s_HostJobObjectName ;
  99. static HANDLE s_HostJobObject ;
  100. static ULONG s_InternalCacheTimeout ;
  101. static ULONG s_ObjectCacheTimeout ;
  102. static ULONG s_EventCacheTimeout ;
  103. static ULONG s_StrobeTimeout ;
  104. static SIZE_T s_Quota_ProcessMemoryLimitCount ;
  105. static SIZE_T s_Quota_JobMemoryLimitCount ;
  106. static SIZE_T s_Quota_PrivatePageCount ;
  107. static ULONG s_Quota_ProcessLimitCount ;
  108. static ULONG s_Quota_HandleCount ;
  109. static ULONG s_Quota_NumberOfThreads ;
  110. static LONG s_CServerClassFactory_ObjectsInProgress ;
  111. static LONG s_CAggregator_IWbemProvider_ObjectsInProgress ;
  112. static LONG s_CInterceptor_IWbemObjectSink_ObjectsInProgress ;
  113. static LONG s_CInterceptor_IWbemObjectSinkEx_ObjectsInProgress ;
  114. static LONG s_CInterceptor_IWbemFilteringObjectSink_ObjectsInProgress ;
  115. static LONG s_CInterceptor_IWbemSyncObjectSink_ObjectsInProgress ;
  116. static LONG s_CInterceptor_IWbemSyncObjectSinkEx_ObjectsInProgress ;
  117. static LONG s_CInterceptor_IWbemSyncFilteringObjectSink_ObjectsInProgress ;
  118. static LONG s_CInterceptor_IWbemCombiningObjectSink_ObjectsInProgress ;
  119. static LONG s_CInterceptor_IWbemWaitingObjectSink_ObjectsInProgress ;
  120. static LONG s_CInterceptor_IWbemProviderInitSink_ObjectsInProgress ;
  121. static LONG s_CInterceptor_IWbemProvider_ObjectsInProgress ;
  122. static LONG s_CInterceptor_IWbemSyncProvider_ObjectsInProgress ;
  123. static LONG s_CInterceptor_IWbemServices_Stub_ObjectsInProgress ;
  124. static LONG s_CInterceptor_IWbemServices_Proxy_ObjectsInProgress ;
  125. static LONG s_CInterceptor_IWbemServices_Interceptor_ObjectsInProgress ;
  126. static LONG s_CInterceptor_IWbemServices_RestrictingInterceptor_ObjectsInProgress ;
  127. static LONG s_CInterceptor_IEnumWbemClassObject_Stub_ObjectsInProgress ;
  128. static LONG s_CInterceptor_IEnumWbemClassObject_Proxy_ObjectsInProgress ;
  129. static LONG s_CInterceptor_IWbemUnboundObjectSink_ObjectsInProgress ;
  130. static LONG s_CInterceptor_IWbemSyncUnboundObjectSink_ObjectsInProgress ;
  131. static LONG s_CInterceptor_IWbemDecoupledProvider_ObjectsInProgress ;
  132. static LONG s_CDecoupled_IWbemUnboundObjectSink_ObjectsInProgress ;
  133. static LONG s_CServerObject_Host_ObjectsInProgress ;
  134. static LONG s_CServerObject_HostInterceptor_ObjectsInProgress ;
  135. static LONG s_CServerObject_BindingFactory_ObjectsInProgress ;
  136. static LONG s_CServerObject_DynamicPropertyProviderResolver_ObjectsInProgress ;
  137. static LONG s_CServerObject_IWbemServices_ObjectsInProgress ;
  138. static LONG s_CServerObject_ProviderSubsystem_Counters_ObjectsInProgress ;
  139. static LONG s_CServerObject_ProviderSubSystem_ObjectsInProgress ;
  140. static LONG s_CServerObject_RawFactory_ObjectsInProgress ;
  141. static LONG s_CServerObject_StaThread_ObjectsInProgress ;
  142. static LONG s_StaTask_Create_ObjectsInProgress ;
  143. static LONG s_StrobeThread_ObjectsInProgress ;
  144. static LONG s_CDecoupledAggregator_IWbemProvider_ObjectsInProgress ;
  145. static LONG s_CDecoupled_ProviderSubsystemRegistrar_ObjectsInProgress ;
  146. static LONG s_CServerObject_ProviderRefresherManager_ObjectsInProgress ;
  147. static LONG s_CServerObject_InterceptorProviderRefresherManager_ObjectsInProgress ;
  148. static LONG s_CServerProvRefreshManagerClassFactory_ObjectsInProgress ;
  149. static HRESULT Global_Startup () ;
  150. static HRESULT Global_Shutdown () ;
  151. static LPCWSTR s_FileMappingName ;
  152. static LPCWSTR s_QueryPrefix ;
  153. static ULONG s_QueryPrefixLen ;
  154. static LPCWSTR s_QueryPostfix ;
  155. static ULONG s_QueryPostfixLen ;
  156. static ULONG s_QueryConstantsLen ;
  157. static LPCWSTR s_Provider ;
  158. static ULONG s_ProviderLen ;
  159. static LPCWSTR s_Class ;
  160. static ULONG s_ClassLen ;
  161. static LPCWSTR s_Wql ;
  162. static LPCWSTR s_DynProps ;
  163. static LPCWSTR s_ClassContext ;
  164. static LPCWSTR s_InstanceContext ;
  165. static LPCWSTR s_PropertyContext ;
  166. static LPCWSTR s_Dynamic ;
  167. static LPCWSTR s_ProviderSubsystemEventSourceName ;
  168. static HANDLE s_NtEventLogSource ;
  169. static HANDLE s_EventSource ;
  170. static LPWSTR s_EventPropertySources [] ;
  171. static HANDLE s_EventClassHandles [] ;
  172. static ULONG s_EventClassHandlesSize ;
  173. static HRESULT CreateJobObject () ;
  174. static HRESULT DeleteJobObject () ;
  175. static HRESULT AssignProcessToJobObject ( HANDLE a_Handle ) ;
  176. static HRESULT Initialize_Events () ;
  177. static HRESULT UnInitialize_Events () ;
  178. static HRESULT Initialize_SharedCounters () ;
  179. static HRESULT UnInitialize_SharedCounters () ;
  180. static CWbemGlobal_ComServerTagContainer *GetGuidTag () ;
  181. static CriticalSection *GetGuidTagCriticalSection () ;
  182. static CriticalSection *GetDecoupledRegistrySection () ;
  183. static CWbemGlobal_IWmiProvSubSysController *GetProvSubSysController () ;
  184. static CWbemGlobal_IWbemSyncProviderController *GetSyncProviderController () ;
  185. static CWbemGlobal_HostedProviderController *GetHostedProviderController () ;
  186. static RefresherManagerController *GetRefresherManagerController () ;
  187. static HostController *GetHostController () ;
  188. static CServerObject_ProviderSubsystem_Counters *GetSharedCounters () { return s_SharedCounters ; }
  189. static StrobeThread &GetStrobeThread () { return *s_StrobeThread ; }
  190. static HANDLE GetNtEventSource () { return s_NtEventLogSource ; }
  191. static HRESULT ForwardReload (
  192. long a_Flags ,
  193. IWbemContext *a_Context ,
  194. LPCWSTR a_Namespace ,
  195. LPCWSTR a_Provider
  196. ) ;
  197. static BOOL CheckGuidTag ( const GUID &a_Guid ) ;
  198. static void InsertGuidTag ( const GUID &a_Guid ) ;
  199. static void DeleteGuidTag ( const GUID &a_Guid ) ;
  200. static void ClearGuidTag ();
  201. static HRESULT BeginThreadImpersonation (
  202. IUnknown *&a_OldContext ,
  203. IServerSecurity *&a_OldSecurity ,
  204. BOOL &a_Impersonating
  205. ) ;
  206. static HRESULT EndThreadImpersonation (
  207. IUnknown *a_OldContext ,
  208. IServerSecurity *a_OldSecurity ,
  209. BOOL a_Impersonating
  210. ) ;
  211. static HRESULT Begin_IdentifyCall_PrvHost (
  212. WmiInternalContext a_InternalContext ,
  213. BOOL &a_Impersonating ,
  214. IUnknown *&a_OldContext ,
  215. IServerSecurity *&a_OldSecurity
  216. ) ;
  217. static HRESULT End_IdentifyCall_PrvHost (
  218. WmiInternalContext a_InternalContext ,
  219. IUnknown *&a_OldContext ,
  220. IServerSecurity *&a_OldSecurity ,
  221. BOOL &a_Impersonating
  222. ) ;
  223. static HRESULT Begin_IdentifyCall_SvcHost (
  224. WmiInternalContext a_InternalContext ,
  225. BOOL &a_Impersonating ,
  226. IUnknown *&a_OldContext ,
  227. IServerSecurity *&a_OldSecurity
  228. ) ;
  229. static HRESULT End_IdentifyCall_SvcHost (
  230. WmiInternalContext a_InternalContext ,
  231. IUnknown *&a_OldContext ,
  232. IServerSecurity *&a_OldSecurity ,
  233. BOOL &a_Impersonating
  234. ) ;
  235. static LONG Increment_Global_Object_Count () ;
  236. static LONG Decrement_Global_Object_Count () ;
  237. } ;
  238. #endif // _Globals_H