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.

611 lines
24 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. sysclass.CPP
  5. Abstract:
  6. System class generation function.
  7. History:
  8. --*/
  9. #include "precomp.h"
  10. #include "wbemcore.h"
  11. HRESULT GetSystemStdObjects(CFlexArray * pResults)
  12. {
  13. HRESULT hr = S_OK;
  14. // Create system classes
  15. // =====================
  16. CSystemClass * pSystemClass = new CSystemClass;
  17. if(pSystemClass) pSystemClass->Init();
  18. if(pSystemClass == NULL || CFlexArray::no_error != pResults->Add(pSystemClass))
  19. return WBEM_E_OUT_OF_MEMORY;
  20. CNamespaceClass * pNamespaceClass = new CNamespaceClass;
  21. if(pNamespaceClass) pNamespaceClass->Init();
  22. if(pNamespaceClass == NULL || CFlexArray::no_error != pResults->Add(pNamespaceClass))
  23. return WBEM_E_OUT_OF_MEMORY;
  24. CThisNamespaceClass * pThisNamespaceClass = new CThisNamespaceClass;
  25. if(pThisNamespaceClass) pThisNamespaceClass->Init();
  26. if(pThisNamespaceClass == NULL || CFlexArray::no_error != pResults->Add(pThisNamespaceClass))
  27. return WBEM_E_OUT_OF_MEMORY;
  28. CProviderClass * pProviderClass = new CProviderClass;
  29. if(pProviderClass) pProviderClass->Init();
  30. if(pProviderClass == NULL || CFlexArray::no_error != pResults->Add(pProviderClass))
  31. return WBEM_E_OUT_OF_MEMORY;
  32. CWin32ProviderClass * pWin32Prov = new CWin32ProviderClass;
  33. if(pWin32Prov) pWin32Prov->Init();
  34. if(pWin32Prov == NULL || CFlexArray::no_error != pResults->Add(pWin32Prov))
  35. return WBEM_E_OUT_OF_MEMORY;
  36. CProviderRegistrationClass * pProvRegistration = new CProviderRegistrationClass;
  37. if(pProvRegistration) pProvRegistration->Init();
  38. if(pProvRegistration == NULL || CFlexArray::no_error != pResults->Add(pProvRegistration))
  39. return WBEM_E_OUT_OF_MEMORY;
  40. CObjectProviderRegistrationClass * pObjectProvReg = new CObjectProviderRegistrationClass;
  41. if(pObjectProvReg) pObjectProvReg->Init();
  42. if(pObjectProvReg == NULL || CFlexArray::no_error != pResults->Add(pObjectProvReg))
  43. return WBEM_E_OUT_OF_MEMORY;
  44. CClassProviderRegistrationClass * pClassProvReg = new CClassProviderRegistrationClass;
  45. if(pClassProvReg) pClassProvReg->Init();
  46. if(pClassProvReg == NULL || CFlexArray::no_error != pResults->Add(pClassProvReg))
  47. return WBEM_E_OUT_OF_MEMORY;
  48. CInstanceProviderRegistrationClass * pInstProvReg = new CInstanceProviderRegistrationClass;
  49. if(pInstProvReg) pInstProvReg->Init();
  50. if(pInstProvReg == NULL || CFlexArray::no_error != pResults->Add(pInstProvReg))
  51. return WBEM_E_OUT_OF_MEMORY;
  52. CPropertyProviderRegistrationClass * pPropProvReg = new CPropertyProviderRegistrationClass;
  53. if(pPropProvReg) pPropProvReg->Init();
  54. if(pPropProvReg == NULL || CFlexArray::no_error != pResults->Add(pPropProvReg))
  55. return WBEM_E_OUT_OF_MEMORY;
  56. CMethodProviderRegistrationClass * pMethodProvReg = new CMethodProviderRegistrationClass;
  57. if(pMethodProvReg) pMethodProvReg->Init();
  58. if(pMethodProvReg == NULL || CFlexArray::no_error != pResults->Add(pMethodProvReg))
  59. return WBEM_E_OUT_OF_MEMORY;
  60. CEventProviderRegistrationClass *pEventProvReg = new CEventProviderRegistrationClass;
  61. if(pEventProvReg) pEventProvReg->Init();
  62. if(pEventProvReg == NULL || CFlexArray::no_error != pResults->Add(pEventProvReg))
  63. return WBEM_E_OUT_OF_MEMORY;
  64. CEventConsumerProviderRegistrationClass * pEventConsumer = new CEventConsumerProviderRegistrationClass;
  65. if(pEventConsumer) pEventConsumer->Init();
  66. if(pEventConsumer == NULL || CFlexArray::no_error != pResults->Add(pEventConsumer))
  67. return WBEM_E_OUT_OF_MEMORY;
  68. CNotifyStatusClass * pNotifyStatusClass = new CNotifyStatusClass;
  69. if(pNotifyStatusClass) pNotifyStatusClass->Init();
  70. if(pNotifyStatusClass == NULL || CFlexArray::no_error != pResults->Add(pNotifyStatusClass))
  71. return WBEM_E_OUT_OF_MEMORY;
  72. CErrorObjectClass * pErrorObjectClass = new CErrorObjectClass;
  73. if(pErrorObjectClass) pErrorObjectClass->Init();
  74. if(pErrorObjectClass == NULL || CFlexArray::no_error != pResults->Add(pErrorObjectClass))
  75. return WBEM_E_OUT_OF_MEMORY;
  76. CSecurityBaseClass * pSecurityBaseClass = new CSecurityBaseClass;
  77. if(pSecurityBaseClass) pSecurityBaseClass->Init();
  78. if(pSecurityBaseClass == NULL || CFlexArray::no_error != pResults->Add(pSecurityBaseClass))
  79. return WBEM_E_OUT_OF_MEMORY;
  80. CNTLM9XUserClass * pNTLM9XUser = new CNTLM9XUserClass;
  81. if(pNTLM9XUser) pNTLM9XUser->Init();
  82. if(pNTLM9XUser == NULL || CFlexArray::no_error != pResults->Add(pNTLM9XUser))
  83. return WBEM_E_OUT_OF_MEMORY;
  84. // Create event classes
  85. // ====================
  86. CIndicationRelatedClass * IndicationRelated = new CIndicationRelatedClass;
  87. if(IndicationRelated)IndicationRelated->Init();
  88. if(IndicationRelated == NULL || CFlexArray::no_error != pResults->Add(IndicationRelated))
  89. return WBEM_E_OUT_OF_MEMORY;
  90. CEventClass * Event = new CEventClass;
  91. if(Event)Event->Init();
  92. if(Event == NULL || CFlexArray::no_error != pResults->Add(Event))
  93. return WBEM_E_OUT_OF_MEMORY;
  94. CParametersClass * Parameters = new CParametersClass;
  95. if(Parameters)Parameters->Init();
  96. if(Parameters == NULL || CFlexArray::no_error != pResults->Add(Parameters))
  97. return WBEM_E_OUT_OF_MEMORY;
  98. CEmptyEventClass * pExtrinsicEvent = new CEmptyEventClass;
  99. if(pExtrinsicEvent)pExtrinsicEvent->Init(L"__ExtrinsicEvent");
  100. if(pExtrinsicEvent == NULL ||
  101. CFlexArray::no_error != pResults->Add(pExtrinsicEvent))
  102. return WBEM_E_OUT_OF_MEMORY;
  103. CGenericDataEventClass * NamespaceEvent = new CGenericDataEventClass;
  104. if(NamespaceEvent)NamespaceEvent->Init(L"object:__Namespace", L"Namespace");
  105. if(NamespaceEvent == NULL || CFlexArray::no_error != pResults->Add(NamespaceEvent))
  106. return WBEM_E_OUT_OF_MEMORY;
  107. CNamespaceEventClass * E1 = new CNamespaceEventClass;
  108. if(E1)E1->Init(*NamespaceEvent, CDataEventClass::type_create);
  109. if(E1 == NULL || CFlexArray::no_error != pResults->Add(E1))
  110. return WBEM_E_OUT_OF_MEMORY;
  111. CNamespaceEventClass * E2 = new CNamespaceEventClass;
  112. if(E2)E2->Init(*NamespaceEvent, CDataEventClass::type_delete);
  113. if(E2 == NULL || CFlexArray::no_error != pResults->Add(E2))
  114. return WBEM_E_OUT_OF_MEMORY;
  115. CNamespaceEventClass * E3 = new CNamespaceEventClass;
  116. E3->Init(*NamespaceEvent, CDataEventClass::type_change);
  117. if(E3 == NULL || CFlexArray::no_error != pResults->Add(E3))
  118. return WBEM_E_OUT_OF_MEMORY;
  119. CGenericDataEventClass * ClassEvent = new CGenericDataEventClass;
  120. if(ClassEvent)ClassEvent->Init(L"object", L"Class");
  121. if(ClassEvent == NULL || CFlexArray::no_error != pResults->Add(ClassEvent))
  122. return WBEM_E_OUT_OF_MEMORY;
  123. CClassEventClass * E4 = new CClassEventClass;
  124. if(E4)E4->Init(*ClassEvent, CDataEventClass::type_create);
  125. if(E4 == NULL || CFlexArray::no_error != pResults->Add(E4))
  126. return WBEM_E_OUT_OF_MEMORY;
  127. CClassEventClass * E5 = new CClassEventClass;
  128. if(E5)E5->Init(*ClassEvent, CDataEventClass::type_delete);
  129. if(E5 == NULL || CFlexArray::no_error != pResults->Add(E5))
  130. return WBEM_E_OUT_OF_MEMORY;
  131. CClassEventClass * E6 = new CClassEventClass;
  132. if(E6)E6->Init(*ClassEvent, CDataEventClass::type_change);
  133. if(E6 == NULL || CFlexArray::no_error != pResults->Add(E6))
  134. return WBEM_E_OUT_OF_MEMORY;
  135. CGenericDataEventClass * InstanceEvent = new CGenericDataEventClass;
  136. if(InstanceEvent)InstanceEvent->Init(L"object", L"Instance");
  137. if(InstanceEvent == NULL || CFlexArray::no_error != pResults->Add(InstanceEvent))
  138. return WBEM_E_OUT_OF_MEMORY;
  139. CInstanceEventClass * E7 = new CInstanceEventClass;
  140. if(E7)E7->Init(*InstanceEvent, CDataEventClass::type_create);
  141. if(E7 == NULL || CFlexArray::no_error != pResults->Add(E7))
  142. return WBEM_E_OUT_OF_MEMORY;
  143. CInstanceEventClass * E8 = new CInstanceEventClass;
  144. if(E8)E8->Init(*InstanceEvent, CDataEventClass::type_delete);
  145. if(E8 == NULL || CFlexArray::no_error != pResults->Add(E8))
  146. return WBEM_E_OUT_OF_MEMORY;
  147. CInstanceEventClass * E9 = new CInstanceEventClass;
  148. if(E9)E9->Init(*InstanceEvent, CDataEventClass::type_change);
  149. if(E9 == NULL || CFlexArray::no_error != pResults->Add(E9))
  150. return WBEM_E_OUT_OF_MEMORY;
  151. CMethodEventClass * EE9 = new CMethodEventClass;
  152. if(EE9)EE9->Init();
  153. if(EE9 == NULL || CFlexArray::no_error != pResults->Add(EE9))
  154. return WBEM_E_OUT_OF_MEMORY;
  155. CTimerEventClass * Event14 = new CTimerEventClass;
  156. if(Event14)Event14->Init();
  157. if(Event14 == NULL || CFlexArray::no_error != pResults->Add(Event14))
  158. return WBEM_E_OUT_OF_MEMORY;
  159. CAggregateEventClass * Event15 = new CAggregateEventClass;
  160. if(Event15)Event15->Init();
  161. if(Event15 == NULL || CFlexArray::no_error != pResults->Add(Event15))
  162. return WBEM_E_OUT_OF_MEMORY;
  163. #ifdef __WHISTLER_UNCUT
  164. // Add monitor events
  165. // ==================
  166. CMonitorEventClass* pMonitorEvent = new CMonitorEventClass;
  167. if(pMonitorEvent) pMonitorEvent->Init(*pExtrinsicEvent, L"__MonitorEvent");
  168. if(pMonitorEvent == NULL ||
  169. CFlexArray::no_error != pResults->Add(pMonitorEvent))
  170. return WBEM_E_OUT_OF_MEMORY;
  171. CMonitorEventClass* pMEUp = new CMonitorEventClass;
  172. if(pMEUp) pMEUp->Init(*pMonitorEvent, L"__MonitorUpEvent");
  173. if(pMEUp == NULL || CFlexArray::no_error != pResults->Add(pMEUp))
  174. return WBEM_E_OUT_OF_MEMORY;
  175. CMonitorEventClass* pMEDown = new CMonitorEventClass;
  176. if(pMEDown) pMEDown->Init(*pMonitorEvent, L"__MonitorDownEvent");
  177. if(pMEDown == NULL || CFlexArray::no_error != pResults->Add(pMEDown))
  178. return WBEM_E_OUT_OF_MEMORY;
  179. CMonitorEventClass* pMEError = new CMonitorEventClass;
  180. if(pMEError) pMEError->Init(*pMonitorEvent, L"__MonitorErrorEvent");
  181. if(pMEError == NULL || CFlexArray::no_error != pResults->Add(pMEError))
  182. return WBEM_E_OUT_OF_MEMORY;
  183. CMonitorDataEventClass* pMEData = new CMonitorDataEventClass;
  184. if(pMEData) pMEData->Init(*pMonitorEvent, L"__MonitorDataEvent");
  185. if(pMEData == NULL || CFlexArray::no_error != pResults->Add(pMEData))
  186. return WBEM_E_OUT_OF_MEMORY;
  187. CMonitorDataEventClass* pMEAssert = new CMonitorDataEventClass;
  188. if(pMEAssert) pMEAssert->Init(*pMEData, L"__MonitorAssertEvent");
  189. if(pMEAssert == NULL || CFlexArray::no_error != pResults->Add(pMEAssert))
  190. return WBEM_E_OUT_OF_MEMORY;
  191. CMonitorDataEventClass* pMERetract = new CMonitorDataEventClass;
  192. if(pMERetract) pMERetract->Init(*pMEData, L"__MonitorRetractEvent");
  193. if(pMERetract == NULL || CFlexArray::no_error != pResults->Add(pMERetract))
  194. return WBEM_E_OUT_OF_MEMORY;
  195. #endif
  196. // Create event consumer class
  197. // ===========================
  198. CEventConsumerClass * Consumer = new CEventConsumerClass;
  199. if(Consumer)Consumer->Init();
  200. if(Consumer == NULL || CFlexArray::no_error != pResults->Add(Consumer))
  201. return WBEM_E_OUT_OF_MEMORY;
  202. // Create event filter classes
  203. // ===========================
  204. #ifdef __WHISTLER_UNCUT
  205. CConditionalInstructionClass * CondInst = new CConditionalInstructionClass;
  206. if(CondInst)CondInst->Init();
  207. if(CondInst == NULL || CFlexArray::no_error != pResults->Add(CondInst))
  208. return WBEM_E_OUT_OF_MEMORY;
  209. CEventMonitorClass * EventMonitor = new CEventMonitorClass;
  210. if(EventMonitor)EventMonitor->Init();
  211. if(EventMonitor == NULL ||
  212. CFlexArray::no_error != pResults->Add(EventMonitor))
  213. return WBEM_E_OUT_OF_MEMORY;
  214. #endif
  215. CEventFilterClass * Filter = new CEventFilterClass;
  216. if(Filter)Filter->Init();
  217. if(Filter == NULL || CFlexArray::no_error != pResults->Add(Filter))
  218. return WBEM_E_OUT_OF_MEMORY;
  219. // Create the binding class
  220. // ========================
  221. CFilterConsumerBindingClass * Binding = new CFilterConsumerBindingClass;
  222. if(Binding)Binding->Init();
  223. if(Binding == NULL || CFlexArray::no_error != pResults->Add(Binding))
  224. return WBEM_E_OUT_OF_MEMORY;
  225. // Create timer generators
  226. // =======================
  227. CEventGeneratorClass * Generator = new CEventGeneratorClass;
  228. if(Generator)Generator->Init();
  229. if(Generator == NULL || CFlexArray::no_error != pResults->Add(Generator))
  230. return WBEM_E_OUT_OF_MEMORY;
  231. CTimerInstructionClass * TI = new CTimerInstructionClass;
  232. if(TI)TI->Init();
  233. if(TI == NULL || CFlexArray::no_error != pResults->Add(TI))
  234. return WBEM_E_OUT_OF_MEMORY;
  235. CAbsoluteTimerInstructionClass * ATI = new CAbsoluteTimerInstructionClass;
  236. if(ATI)ATI->Init();
  237. if(ATI == NULL || CFlexArray::no_error != pResults->Add(ATI))
  238. return WBEM_E_OUT_OF_MEMORY;
  239. CIntervalTimerInstructionClass * ITI = new CIntervalTimerInstructionClass;
  240. if(ITI)ITI->Init();
  241. if(ITI == NULL || CFlexArray::no_error != pResults->Add(ITI))
  242. return WBEM_E_OUT_OF_MEMORY;
  243. CTimerNextFiringClass * TNF = new CTimerNextFiringClass;
  244. if(TNF)TNF->Init();
  245. if(TNF == NULL || CFlexArray::no_error != pResults->Add(TNF))
  246. return WBEM_E_OUT_OF_MEMORY;
  247. // Create error event classes
  248. // ==========================
  249. CSystemEventClass * Event16 = new CSystemEventClass;
  250. if(Event16)Event16->Init();
  251. if(Event16 == NULL || CFlexArray::no_error != pResults->Add(Event16))
  252. return WBEM_E_OUT_OF_MEMORY;
  253. CEventDroppedEventClass * Event17 = new CEventDroppedEventClass;
  254. if(Event17)Event17->Init();
  255. if(Event17 == NULL || CFlexArray::no_error != pResults->Add(Event17))
  256. return WBEM_E_OUT_OF_MEMORY;
  257. CQueueOverflowEventClass * Event18 = new CQueueOverflowEventClass;
  258. if(Event18)Event18->Init();
  259. if(Event18 == NULL || CFlexArray::no_error != pResults->Add(Event18))
  260. return WBEM_E_OUT_OF_MEMORY;
  261. CConsumerFailureEventClass * Event19 = new CConsumerFailureEventClass;
  262. if(Event19)Event19->Init();
  263. if(Event19 == NULL || CFlexArray::no_error != pResults->Add(Event19))
  264. return WBEM_E_OUT_OF_MEMORY;
  265. CQoSFailureEventClass * Event20 = new CQoSFailureEventClass;
  266. if(Event20)Event20->Init();
  267. if(Event20 == NULL || CFlexArray::no_error != pResults->Add(Event20))
  268. return WBEM_E_OUT_OF_MEMORY;
  269. /*
  270. CTransactionClass * TransactionClass = new CTransactionClass;
  271. if(TransactionClass)TransactionClass->Init();
  272. if(TransactionClass == NULL || CFlexArray::no_error != pResults->Add(TransactionClass))
  273. return WBEM_E_OUT_OF_MEMORY;
  274. CUncommittedEventClass * UncommittedEventClass = new CUncommittedEventClass;
  275. if(UncommittedEventClass)UncommittedEventClass->Init();
  276. if(UncommittedEventClass == NULL || CFlexArray::no_error != pResults->Add(UncommittedEventClass))
  277. return WBEM_E_OUT_OF_MEMORY;
  278. CClassSecurity * ClassSecurity = new CClassSecurity;
  279. if(ClassSecurity)ClassSecurity->Init();
  280. if(ClassSecurity == NULL || CFlexArray::no_error != pResults->Add(ClassSecurity))
  281. return WBEM_E_OUT_OF_MEMORY;
  282. CClassInstanceSecurity * ClassInstanceSecurity = new CClassInstanceSecurity;
  283. if(ClassInstanceSecurity)ClassInstanceSecurity->Init();
  284. if(ClassInstanceSecurity == NULL || CFlexArray::no_error != pResults->Add(ClassInstanceSecurity))
  285. return WBEM_E_OUT_OF_MEMORY;
  286. CClasses * Classes = new CClasses;
  287. if(Classes)Classes->Init();
  288. if(Classes == NULL || CFlexArray::no_error != pResults->Add(Classes))
  289. return WBEM_E_OUT_OF_MEMORY;
  290. */
  291. // Add the security object which provides methods for getting/setting
  292. // the security descriptor
  293. // ==================================================================
  294. CSystemConfigClass * pConfigClass = new CSystemConfigClass;
  295. pConfigClass->Init();
  296. if(pConfigClass == NULL || CFlexArray::no_error != pResults->Add(pConfigClass))
  297. return WBEM_E_OUT_OF_MEMORY;
  298. // Add in namespace mapping classes.
  299. // =================================
  300. /*
  301. CNamespaceMapClass *pNsClass = new CNamespaceMapClass;
  302. pNsClass->Init();
  303. if (pNsClass == NULL || CFlexArray::no_error != pResults->Add(pNsClass))
  304. return WBEM_E_OUT_OF_MEMORY;
  305. */
  306. // New Class Vector class
  307. /* Removed for Whistler
  308. CClassVectorClass *pClassVectorClass = new CClassVectorClass;
  309. pClassVectorClass->Init();
  310. if (pClassVectorClass == NULL || CFlexArray::no_error != pResults->Add(pClassVectorClass))
  311. return WBEM_E_OUT_OF_MEMORY;
  312. // COM Taxonomy classes
  313. CComTaxonomyClass *pComTaxonomyClass = new CComTaxonomyClass;
  314. pComTaxonomyClass->Init();
  315. if (pComTaxonomyClass == NULL || CFlexArray::no_error != pResults->Add(pComTaxonomyClass))
  316. return WBEM_E_OUT_OF_MEMORY;
  317. CComInterfaceSetClass *pComInterfaceSetClass = new CComInterfaceSetClass;
  318. pComInterfaceSetClass->Init();
  319. if (pComInterfaceSetClass == NULL || CFlexArray::no_error != pResults->Add(pComInterfaceSetClass))
  320. return WBEM_E_OUT_OF_MEMORY;
  321. CComDispatchElementClass *pComDispatchElementClass = new CComDispatchElementClass;
  322. pComDispatchElementClass->Init();
  323. if (pComDispatchElementClass == NULL || CFlexArray::no_error != pResults->Add(pComDispatchElementClass))
  324. return WBEM_E_OUT_OF_MEMORY;
  325. CComDispatchInfoClass *pComDispatchInfoClass = new CComDispatchInfoClass;
  326. pComDispatchInfoClass->Init();
  327. if (pComDispatchInfoClass == NULL || CFlexArray::no_error != pResults->Add(pComDispatchInfoClass))
  328. return WBEM_E_OUT_OF_MEMORY;
  329. CComBindingClass *pComBindingClass = new CComBindingClass;
  330. pComBindingClass->Init();
  331. if (pComBindingClass == NULL || CFlexArray::no_error != pResults->Add(pComBindingClass))
  332. return WBEM_E_OUT_OF_MEMORY;
  333. CComInterfaceSetBindingClass *pComInterfaceSetBindingClass = new CComInterfaceSetBindingClass;
  334. pComInterfaceSetBindingClass->Init();
  335. if (pComInterfaceSetBindingClass == NULL || CFlexArray::no_error != pResults->Add(pComInterfaceSetBindingClass))
  336. return WBEM_E_OUT_OF_MEMORY;
  337. CComDispatchElementBindingClass *pComDispatchElementBindingClass = new CComDispatchElementBindingClass;
  338. pComDispatchElementBindingClass->Init();
  339. if (pComDispatchElementBindingClass == NULL || CFlexArray::no_error != pResults->Add(pComDispatchElementBindingClass))
  340. return WBEM_E_OUT_OF_MEMORY;
  341. */
  342. return 0;
  343. }
  344. HRESULT GetSystemSecurityObjects(CFlexArray * pResults)
  345. {
  346. HRESULT hr = S_OK;
  347. CSubjectClass * pSubject = new CSubjectClass;
  348. if(pSubject)pSubject->Init();
  349. if(pSubject == NULL || CFlexArray::no_error != pResults->Add(pSubject))
  350. return WBEM_E_OUT_OF_MEMORY;
  351. CUserClass * pUser = new CUserClass;
  352. if(pUser)pUser->Init();
  353. if(pUser == NULL || CFlexArray::no_error != pResults->Add(pUser))
  354. return WBEM_E_OUT_OF_MEMORY;
  355. CNTLMUserClass * pNTLMUser = new CNTLMUserClass;
  356. if(pNTLMUser)pNTLMUser->Init();
  357. if(pNTLMUser == NULL || CFlexArray::no_error != pResults->Add(pNTLMUser))
  358. return WBEM_E_OUT_OF_MEMORY;
  359. CGroupClass * pGroup = new CGroupClass;
  360. if(pGroup)pGroup->Init();
  361. if(pGroup == NULL || CFlexArray::no_error != pResults->Add(pGroup))
  362. return WBEM_E_OUT_OF_MEMORY;
  363. CNtlmGroupClass * pNtlmGroup = new CNtlmGroupClass;
  364. if(pNtlmGroup)pNtlmGroup->Init();
  365. if(pNtlmGroup == NULL || CFlexArray::no_error != pResults->Add(pNtlmGroup))
  366. return WBEM_E_OUT_OF_MEMORY;
  367. return S_OK;
  368. }
  369. HRESULT GetStandardInstances(CFlexArray * pResults)
  370. {
  371. HRESULT hr = S_OK;
  372. // Create the __systemsecurity=@ instance
  373. CSystemConfigClass * pConfigClass = new CSystemConfigClass;
  374. if(pConfigClass == NULL)
  375. return WBEM_E_OUT_OF_MEMORY;
  376. CDeleteMe<CSystemConfigClass> dm(pConfigClass);
  377. pConfigClass->Init();
  378. CSystemConfigInstance * pConfigInstance = new CSystemConfigInstance;
  379. if(pConfigInstance == NULL)
  380. return WBEM_E_OUT_OF_MEMORY;
  381. pConfigInstance->Init(pConfigClass);
  382. if(CFlexArray::no_error != pResults->Add(pConfigInstance))
  383. return WBEM_E_OUT_OF_MEMORY;
  384. CThisNamespaceClass * pThisNamespaceClass = new CThisNamespaceClass;
  385. if(pThisNamespaceClass == NULL)
  386. return WBEM_E_OUT_OF_MEMORY;
  387. CDeleteMe<CThisNamespaceClass> dm2(pThisNamespaceClass);
  388. pThisNamespaceClass->Init();
  389. CThisNamespaceInstance * pThisNamespaceInstance = new CThisNamespaceInstance;
  390. if(pThisNamespaceInstance == NULL)
  391. return WBEM_E_OUT_OF_MEMORY;
  392. pThisNamespaceInstance->Init(pThisNamespaceClass);
  393. if(CFlexArray::no_error != pResults->Add(pThisNamespaceInstance))
  394. return WBEM_E_OUT_OF_MEMORY;
  395. return 0;
  396. }
  397. HRESULT CreateCacheControl2(CFlexArray * pResults, LPCWSTR wszClassName, DWORD dwSeconds)
  398. {
  399. CSpecificCacheControlClass * ControlClass = new CSpecificCacheControlClass;
  400. if(ControlClass)ControlClass->Init(wszClassName);
  401. if(ControlClass == NULL || CFlexArray::no_error != pResults->Add(ControlClass))
  402. return WBEM_E_OUT_OF_MEMORY;
  403. CCacheControlInstance * ControlInstance = new CCacheControlInstance;
  404. if(ControlInstance)ControlInstance->Init(ControlClass, dwSeconds);
  405. if(ControlInstance == NULL || CFlexArray::no_error != pResults->Add(ControlInstance))
  406. return WBEM_E_OUT_OF_MEMORY;
  407. return 0;
  408. }
  409. HRESULT GetSystemRootObjects(CFlexArray * pResults)
  410. {
  411. CCacheControlClass * pCacheControlCache = new CCacheControlClass;
  412. if(pCacheControlCache) pCacheControlCache->Init();
  413. if(pCacheControlCache == NULL || CFlexArray::no_error != pResults->Add(pCacheControlCache))
  414. return WBEM_E_OUT_OF_MEMORY;
  415. BOOL t_ShortTimeout = TRUE ;
  416. OSVERSIONINFOEX t_VersionInfo ;
  417. t_VersionInfo.dwOSVersionInfoSize = sizeof ( t_VersionInfo ) ;
  418. BOOL t_Status = GetVersionEx ( ( OSVERSIONINFO * ) & t_VersionInfo ) ;
  419. if ( t_Status )
  420. {
  421. if ( t_VersionInfo.wProductType != VER_NT_WORKSTATION )
  422. {
  423. t_ShortTimeout = FALSE ;
  424. }
  425. }
  426. HRESULT hr;
  427. hr = CreateCacheControl2(pResults, L"__ObjectProviderCacheControl", t_ShortTimeout ? 30 : 300 );
  428. if(FAILED(hr))
  429. return hr;
  430. hr = CreateCacheControl2(pResults, L"__PropertyProviderCacheControl", t_ShortTimeout ? 30 : 300 );
  431. if(FAILED(hr))
  432. return hr;
  433. hr = CreateCacheControl2(pResults, L"__EventProviderCacheControl", t_ShortTimeout ? 30 : 300 );
  434. if(FAILED(hr))
  435. return hr;
  436. hr = CreateCacheControl2(pResults, L"__EventConsumerProviderCacheControl", t_ShortTimeout ? 30 : 300 );
  437. if(FAILED(hr))
  438. return hr;
  439. hr = CreateCacheControl2(pResults, L"__EventSinkCacheControl", t_ShortTimeout ? 15 : 150 );
  440. if(FAILED(hr))
  441. return hr;
  442. //Provider Host class
  443. CProviderHostQuotaConfiguration *pProviderHostQuotaConfigurationClass = new CProviderHostQuotaConfiguration;
  444. if (pProviderHostQuotaConfigurationClass == NULL)
  445. return WBEM_E_OUT_OF_MEMORY;
  446. pProviderHostQuotaConfigurationClass->Init();
  447. if (CFlexArray::no_error != pResults->Add(pProviderHostQuotaConfigurationClass))
  448. return WBEM_E_OUT_OF_MEMORY;
  449. //Provider Host class
  450. CProviderHostQuotaConfigurationInstance *pProviderHostQuotaConfigurationInstance = new CProviderHostQuotaConfigurationInstance;
  451. if (pProviderHostQuotaConfigurationInstance == NULL)
  452. return WBEM_E_OUT_OF_MEMORY;
  453. pProviderHostQuotaConfigurationInstance->Init(pProviderHostQuotaConfigurationClass);
  454. if (CFlexArray::no_error != pResults->Add(pProviderHostQuotaConfigurationInstance))
  455. return WBEM_E_OUT_OF_MEMORY;
  456. CActiveNamespacesClass * pActiveNSClass = new CActiveNamespacesClass;
  457. if(pActiveNSClass) pActiveNSClass->Init();
  458. if(pActiveNSClass == NULL || CFlexArray::no_error != pResults->Add(pActiveNSClass))
  459. return WBEM_E_OUT_OF_MEMORY;
  460. //Arbitrator class
  461. CArbitratorConfiguration *pArbClass = new CArbitratorConfiguration;
  462. if (pArbClass == NULL)
  463. return WBEM_E_OUT_OF_MEMORY;
  464. pArbClass->Init();
  465. if (CFlexArray::no_error != pResults->Add(pArbClass))
  466. return WBEM_E_OUT_OF_MEMORY;
  467. //Arbitrator instance
  468. CArbitratorConfigurationInstance *pArbInstance = new CArbitratorConfigurationInstance;
  469. if (pArbInstance == NULL)
  470. return WBEM_E_OUT_OF_MEMORY;
  471. pArbInstance->Init(pArbClass);
  472. if (CFlexArray::no_error != pResults->Add(pArbInstance))
  473. return WBEM_E_OUT_OF_MEMORY;
  474. CCIMOMIdentificationClass * pIdentClass = new CCIMOMIdentificationClass;
  475. if(pIdentClass) pIdentClass->Init();
  476. if(pIdentClass == NULL || CFlexArray::no_error != pResults->Add(pIdentClass))
  477. return WBEM_E_OUT_OF_MEMORY;
  478. return 0;
  479. }