Source code of Windows XP (NT5)
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.

573 lines
20 KiB

  1. /*++
  2. Copyright (C) 2000-2001 Microsoft Corporation
  3. --*/
  4. #ifndef __A51PROV__H_
  5. #define __A51PROV__H_
  6. #include <windows.h>
  7. #include <wbemidl.h>
  8. #include <stdio.h>
  9. #include <unk.h>
  10. #include <wbemcomn.h>
  11. #include <sync.h>
  12. #include <reposit.h>
  13. #include <wmiutils.h>
  14. #include <objpath.h>
  15. #include <filecach.h>
  16. #include <hiecache.h>
  17. #include <corex.h>
  18. #include "a51fib.h"
  19. extern long g_lRootDirLen;
  20. extern WCHAR g_wszRootDir[MAX_PATH];
  21. class CDbIterator;
  22. class CRepEvent
  23. {
  24. public:
  25. DWORD m_dwType;
  26. LPWSTR m_wszArg1;
  27. LPWSTR m_wszNamespace;
  28. _IWmiObject* m_pObj1;
  29. _IWmiObject* m_pObj2;
  30. CRepEvent(DWORD dwType, LPCWSTR wszNamespace, LPCWSTR wszArg1,
  31. _IWmiObject* pObj1, _IWmiObject* pObj2);
  32. ~CRepEvent();
  33. void* operator new(size_t) {return TempAlloc(sizeof(CRepEvent));}
  34. void operator delete(void* p) {return TempFree(p, sizeof(CRepEvent));}
  35. };
  36. class CEventCollector
  37. {
  38. protected:
  39. CUniquePointerArray<CRepEvent> m_apEvents;
  40. bool m_bNamespaceOnly;
  41. CRITICAL_SECTION m_csLock;
  42. public:
  43. CEventCollector() : m_bNamespaceOnly(false){ InitializeCriticalSection(&m_csLock);}
  44. ~CEventCollector() { DeleteCriticalSection(&m_csLock); }
  45. bool AddEvent(CRepEvent* pEvent);
  46. void SetNamespaceOnly(bool bNamespaceOnly)
  47. {m_bNamespaceOnly = bNamespaceOnly;}
  48. bool IsNamespaceOnly() {return m_bNamespaceOnly;}
  49. HRESULT SendEvents(_IWmiCoreServices* pCore);
  50. void DeleteAllEvents();
  51. void TransferEvents(CEventCollector &aEventsToTransfer);
  52. int GetSize() { return m_apEvents.GetSize(); }
  53. };
  54. class CNamespaceHandle;
  55. class CRepository : public CUnkBase<IWmiDbController, &IID_IWmiDbController>
  56. {
  57. protected:
  58. HRESULT Initialize();
  59. public:
  60. HRESULT STDMETHODCALLTYPE Logon(
  61. WMIDB_LOGON_TEMPLATE *pLogonParms,
  62. DWORD dwFlags,
  63. DWORD dwRequestedHandleType,
  64. IWmiDbSession **ppSession,
  65. IWmiDbHandle **ppRootNamespace
  66. );
  67. HRESULT STDMETHODCALLTYPE GetLogonTemplate(
  68. LCID lLocale,
  69. DWORD dwFlags,
  70. WMIDB_LOGON_TEMPLATE **ppLogonTemplate
  71. );
  72. HRESULT STDMETHODCALLTYPE FreeLogonTemplate(
  73. WMIDB_LOGON_TEMPLATE **ppTemplate
  74. );
  75. HRESULT STDMETHODCALLTYPE Shutdown(
  76. DWORD dwFlags
  77. );
  78. HRESULT STDMETHODCALLTYPE SetCallTimeout(
  79. DWORD dwMaxTimeout
  80. );
  81. HRESULT STDMETHODCALLTYPE SetCacheValue(
  82. DWORD dwMaxBytes
  83. );
  84. HRESULT STDMETHODCALLTYPE FlushCache(
  85. DWORD dwFlags
  86. );
  87. HRESULT STDMETHODCALLTYPE GetStatistics(
  88. DWORD dwParameter,
  89. DWORD *pdwValue
  90. );
  91. HRESULT STDMETHODCALLTYPE Backup(
  92. LPCWSTR wszBackupFile,
  93. long lFlags
  94. );
  95. HRESULT STDMETHODCALLTYPE Restore(
  96. LPCWSTR wszBackupFile,
  97. long lFlags
  98. );
  99. public:
  100. CRepository(CLifeControl* pControl) : TUnkBase(pControl)
  101. {}
  102. ~CRepository()
  103. {
  104. }
  105. INTERNAL CForestCache* GetForestCache();
  106. INTERNAL _IWmiCoreServices* GetCoreServices();
  107. HRESULT GetNamespaceHandle(LPCWSTR wszNamespaceName,
  108. CNamespaceHandle** ppHandle);
  109. LPCWSTR GetRootDir() {return g_wszRootDir;}
  110. int GetRootDirLen() {return g_lRootDirLen;}
  111. };
  112. class CSession : public CUnkBase<IWmiDbSessionEx, &IID_IWmiDbSessionEx>
  113. {
  114. private:
  115. CEventCollector m_aTransactedEvents;
  116. bool m_bInWriteTransaction;
  117. public:
  118. CSession(CLifeControl* pControl = NULL) : TUnkBase(pControl), m_bInWriteTransaction(false) {}
  119. virtual ~CSession();
  120. ULONG STDMETHODCALLTYPE Release();
  121. HRESULT STDMETHODCALLTYPE GetObject(
  122. IWmiDbHandle *pScope,
  123. IWbemPath *pPath,
  124. DWORD dwFlags,
  125. DWORD dwRequestedHandleType,
  126. IWmiDbHandle **ppResult
  127. );
  128. HRESULT STDMETHODCALLTYPE GetObjectDirect(
  129. IWmiDbHandle *pScope,
  130. IWbemPath *pPath,
  131. DWORD dwFlags,
  132. REFIID riid,
  133. LPVOID *pObj
  134. );
  135. HRESULT STDMETHODCALLTYPE PutObject(
  136. IWmiDbHandle *pScope,
  137. REFIID riid,
  138. LPVOID pObj,
  139. DWORD dwFlags,
  140. DWORD dwRequestedHandleType,
  141. IWmiDbHandle **ppResult
  142. );
  143. HRESULT STDMETHODCALLTYPE DeleteObject(
  144. IWmiDbHandle *pScope,
  145. DWORD dwFlags,
  146. REFIID riid,
  147. LPVOID pObj
  148. );
  149. HRESULT STDMETHODCALLTYPE ExecQuery(
  150. IWmiDbHandle *pScope,
  151. IWbemQuery *pQuery,
  152. DWORD dwFlags,
  153. DWORD dwRequestedHandleType,
  154. DWORD *dwMessageFlags,
  155. IWmiDbIterator **ppQueryResult
  156. );
  157. HRESULT STDMETHODCALLTYPE RenameObject(
  158. IWbemPath *pOldPath,
  159. IWbemPath *pNewPath,
  160. DWORD dwFlags,
  161. DWORD dwRequestedHandleType,
  162. IWmiDbHandle **ppResult
  163. );
  164. HRESULT STDMETHODCALLTYPE Enumerate(
  165. IWmiDbHandle *pScope,
  166. DWORD dwFlags,
  167. DWORD dwRequestedHandleType,
  168. IWmiDbIterator **ppQueryResult
  169. );
  170. HRESULT STDMETHODCALLTYPE AddObject(
  171. IWmiDbHandle *pScope,
  172. IWbemPath *pPath,
  173. DWORD dwFlags,
  174. DWORD dwRequestedHandleType,
  175. IWmiDbHandle **ppResult
  176. );
  177. HRESULT STDMETHODCALLTYPE RemoveObject (
  178. IWmiDbHandle *pScope,
  179. IWbemPath *pPath,
  180. DWORD dwFlags
  181. );
  182. HRESULT STDMETHODCALLTYPE SetDecoration(
  183. LPWSTR lpMachineName,
  184. LPWSTR lpNamespacePath
  185. );
  186. HRESULT STDMETHODCALLTYPE SupportsQueries(
  187. DWORD *dwQuerySupportLevel
  188. ) {return WBEM_E_FAILED;};
  189. HRESULT STDMETHODCALLTYPE GetObjectByPath(
  190. IWmiDbHandle *pScope,
  191. LPCWSTR wszPath,
  192. DWORD dwFlags,
  193. REFIID riid,
  194. LPVOID *pObj
  195. );
  196. HRESULT STDMETHODCALLTYPE DeleteObjectByPath(
  197. IWmiDbHandle *pScope,
  198. LPCWSTR wszObjectPath,
  199. DWORD dwFlags
  200. );
  201. HRESULT STDMETHODCALLTYPE ExecQuerySink(
  202. IWmiDbHandle *pScope,
  203. IWbemQuery *pQuery,
  204. DWORD dwFlags,
  205. DWORD dwRequestedHandleType,
  206. IWbemObjectSink* pSink,
  207. DWORD *dwMessageFlags
  208. );
  209. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv);
  210. HRESULT STDMETHODCALLTYPE BeginWriteTransaction(DWORD dwFlags);
  211. HRESULT STDMETHODCALLTYPE BeginReadTransaction(DWORD dwFlags);
  212. HRESULT STDMETHODCALLTYPE CommitTransaction(DWORD dwFlags);
  213. HRESULT STDMETHODCALLTYPE AbortTransaction(DWORD dwFlags);
  214. protected:
  215. };
  216. class CNamespaceHandle : public CUnkBase<IWmiDbHandle, &IID_IWmiDbHandle>
  217. {
  218. protected:
  219. CRepository* m_pRepository;
  220. WString m_wsNamespace;
  221. WString m_wsScope;
  222. WString m_wsFullNamespace;
  223. WCHAR m_wszMachineName[MAX_COMPUTERNAME_LENGTH+1];
  224. WCHAR m_wszClassRootDir[MAX_PATH];
  225. long m_lClassRootDirLen;
  226. WCHAR m_wszInstanceRootDir[MAX_PATH];
  227. long m_lInstanceRootDirLen;
  228. CHierarchyCache* m_pClassCache;
  229. CForestCache* m_ForestCache;
  230. _IWmiObject* m_pNullClass;
  231. bool m_bCached;
  232. public:
  233. CNamespaceHandle(CLifeControl* pControl, CRepository* pRepository);
  234. ~CNamespaceHandle();
  235. STDMETHOD(GetHandleType)(DWORD* pdwType) {*pdwType = 0; return S_OK;}
  236. HRESULT Initialize(LPCWSTR wszNamespace, LPCWSTR wszScope = NULL);
  237. HRESULT GetObject(
  238. IWbemPath *pPath,
  239. DWORD dwFlags,
  240. DWORD dwRequestedHandleType,
  241. IWmiDbHandle **ppResult
  242. );
  243. HRESULT GetObjectDirect(
  244. IWbemPath *pPath,
  245. DWORD dwFlags,
  246. REFIID riid,
  247. LPVOID *pObj
  248. );
  249. HRESULT PutObject(
  250. REFIID riid,
  251. LPVOID pObj,
  252. DWORD dwFlags,
  253. DWORD dwRequestedHandleType,
  254. IWmiDbHandle **ppResult,
  255. CEventCollector &aEvents
  256. );
  257. HRESULT DeleteObject(
  258. DWORD dwFlags,
  259. REFIID riid,
  260. LPVOID pObj,
  261. CEventCollector &aEvents
  262. );
  263. HRESULT ExecQuery(
  264. IWbemQuery *pQuery,
  265. DWORD dwFlags,
  266. DWORD dwRequestedHandleType,
  267. DWORD *dwMessageFlags,
  268. IWmiDbIterator **ppQueryResult
  269. );
  270. HRESULT GetObjectByPath(
  271. LPWSTR wszPath,
  272. DWORD dwFlags,
  273. REFIID riid,
  274. LPVOID *pObj
  275. );
  276. HRESULT ExecQuerySink(
  277. IWbemQuery *pQuery,
  278. DWORD dwFlags,
  279. DWORD dwRequestedHandleType,
  280. IWbemObjectSink* pSink,
  281. DWORD *dwMessageFlags
  282. );
  283. HRESULT DeleteObjectByPath(DWORD dwFlags, LPWSTR wszPath, CEventCollector &aEvents);
  284. HRESULT SendEvents(CEventCollector &aEvents);
  285. HRESULT GetErrorStatus();
  286. void SetErrorStatus(HRESULT hres);
  287. protected:
  288. HRESULT GetObjectHandleByPath(LPWSTR wszBuffer, DWORD dwFlags,
  289. DWORD dwRequestedHandleType, IWmiDbHandle **ppResult);
  290. HRESULT PutInstance(_IWmiObject* pInst, DWORD dwFlags, CEventCollector &aEvents);
  291. HRESULT PutClass(_IWmiObject* pClass, DWORD dwFlags, CEventCollector &aEvents);
  292. HRESULT ConstructClassRelationshipsDir(LPCWSTR wszClassName,
  293. LPWSTR wszDirPath);
  294. HRESULT WriteParentChildRelationship(LPCWSTR wszChildFileName,
  295. LPCWSTR wszParentName);
  296. HRESULT WriteClassReferences(_IWmiObject* pClass, LPCWSTR wszFileName);
  297. HRESULT ExecClassQuery(QL_LEVEL_1_RPN_EXPRESSION* pQuery,
  298. IWbemObjectSink* pSink);
  299. HRESULT ExecInstanceQuery(QL_LEVEL_1_RPN_EXPRESSION* pQuery,
  300. LPCWSTR wszClassName, bool bDeep,
  301. IWbemObjectSink* pSink);
  302. HRESULT GetClassDirect(LPCWSTR wszClassName, REFIID riid, void** ppObj,
  303. bool bClone, __int64* pnTime = NULL,
  304. bool* pbRead = NULL);
  305. HRESULT GetInstanceDirect(ParsedObjectPath* pPath,
  306. REFIID riid, void** ppObj);
  307. HRESULT DeleteInstance(LPCWSTR wszClassName, LPCWSTR wszKey, CEventCollector &aEvents);
  308. HRESULT DeleteInstanceByFile(LPCWSTR wszFilePath, _IWmiObject* pClass,
  309. bool bClassDeletion, CEventCollector &aEvents);
  310. HRESULT DeleteClass(LPCWSTR wszClassName, CEventCollector &aEvents);
  311. HRESULT DeleteClassInstances(LPCWSTR wszClassName, _IWmiObject* pClass, CEventCollector &aEvents);
  312. HRESULT FileToClass(LPCWSTR wszFileName, _IWmiObject** ppClass,
  313. bool bClone, __int64* pnTime = NULL);
  314. HRESULT FileToInstance(LPCWSTR wszFileName, _IWmiObject** ppInstance,
  315. bool bMustBeThere = false);
  316. HRESULT WriteInstanceReferences(_IWmiObject* pInst, LPCWSTR wszClassName,
  317. LPCWSTR wszFilePath);
  318. HRESULT WriteInstanceReference(LPCWSTR wszReferringFile,
  319. LPCWSTR wszReferringClass,
  320. LPCWSTR wszReferringProp, LPWSTR wszReference);
  321. HRESULT CalculateInstanceFileBase(LPCWSTR wszInstancePath,
  322. LPWSTR wszFilePath);
  323. HRESULT ExecClassRefQuery(LPCWSTR wszQuery, LPCWSTR wszClassName,
  324. IWbemObjectSink* pSink);
  325. HRESULT ExecReferencesQuery(LPCWSTR wszQuery, IWbemObjectSink* pSink);
  326. HRESULT ExecInstanceRefQuery(LPCWSTR wszQuery, LPCWSTR wszClassName,
  327. LPCWSTR wszKey, IWbemObjectSink* pSink);
  328. HRESULT GetReferrerFromFile(LPCWSTR wszReferenceFile,
  329. LPWSTR wszReferrerRelFile,
  330. LPWSTR* pwszReferrerNamespace,
  331. LPWSTR* pwszReferrerClass,
  332. LPWSTR* pwszReferrerProp);
  333. HRESULT DeleteInstanceReference(LPCWSTR wszOurFilePath,
  334. LPWSTR wszReference);
  335. HRESULT DeleteInstanceReferences(_IWmiObject* pInst, LPCWSTR wszFilePath);
  336. HRESULT EnumerateClasses(IWbemObjectSink* pSink,
  337. LPCWSTR wszSuperClass, LPCWSTR wszAncestor,
  338. bool bClone, bool bDontIncludeAncestorInResultSet);
  339. HRESULT ListToEnum(CWStringArray& wsClasses,
  340. IWbemObjectSink* pSink, bool bClone);
  341. bool Hash(LPCWSTR wszName, LPWSTR wszHash);
  342. HRESULT InstanceToFile(IWbemClassObject* pInst, LPCWSTR wszClassName,
  343. LPCWSTR wszFileName, __int64 nClassTime);
  344. HRESULT ConstructInstanceDefName(LPWSTR wszInstanceDefName, LPCWSTR wszKey);
  345. HRESULT ClassToFile(_IWmiObject* pSuperClass, _IWmiObject* pClass,
  346. LPCWSTR wszFileName, __int64 nFakeUpdateTime = 0);
  347. HRESULT ConstructClassName(LPCWSTR wszClassName,
  348. LPWSTR wszFileName);
  349. HRESULT TryGetShortcut(LPWSTR wszPath, DWORD dwFlags, REFIID riid,
  350. LPVOID *pObj);
  351. HRESULT ComputeKeyFromPath(LPWSTR wszPath, LPWSTR wszKey,
  352. LPWSTR* pwszClassName, bool* pbIsClass,
  353. LPWSTR* pwszNamespace = NULL);
  354. HRESULT ParseKey(LPWSTR wszKeyStart, LPWSTR* pwcRealStart,
  355. LPWSTR* pwcNextKey);
  356. HRESULT GetInstanceByKey(LPCWSTR wszClassName, LPCWSTR wszKey,
  357. REFIID riid, void** ppObj);
  358. HRESULT WriteClassRelationships(_IWmiObject* pClass, LPCWSTR wszFileName);
  359. HRESULT ConstructParentChildFileName(LPCWSTR wszChildFileName,
  360. LPCWSTR wszParentName,
  361. LPWSTR wszParentChildFileName);
  362. HRESULT DeleteDerivedClasses(LPCWSTR wszClassName, CEventCollector &aEvents);
  363. HRESULT EraseParentChildRelationship(LPCWSTR wszChildFileName,
  364. LPCWSTR wszParentName);
  365. HRESULT EraseClassRelationships(LPCWSTR wszClassName,
  366. _IWmiObject* pClass, LPCWSTR wszFileName);
  367. HRESULT GetClassByHash(LPCWSTR wszHash, bool bClone, _IWmiObject** ppClass,
  368. __int64* pnTime = NULL, bool* pbRead = NULL);
  369. HRESULT DeleteClassByHash(LPCWSTR wszHash, CEventCollector &aEvents);
  370. HRESULT DeleteClassInternal(LPCWSTR wszClassName, _IWmiObject* pClass,
  371. LPCWSTR wszFileName, CEventCollector &aEvents);
  372. HRESULT GetChildHashes(LPCWSTR wszClassName, CWStringArray& wsChildHashes);
  373. HRESULT GetChildDefs(LPCWSTR wszClassName, bool bRecursive,
  374. IWbemObjectSink* pSink, bool bClone);
  375. HRESULT ConstructClassDefFileName(LPCWSTR wszClassName, LPWSTR wszFileName);
  376. HRESULT ConstructClassDefFileNameFromHash(LPCWSTR wszHash,
  377. LPWSTR wszFileName);
  378. HRESULT ConstructClassRelationshipsDirFromHash(LPCWSTR wszHash,
  379. LPWSTR wszDirPath);
  380. HRESULT GetChildHashesByHash(LPCWSTR wszHash, CWStringArray& wsChildHashes);
  381. HRESULT GetChildDefsByHash(LPCWSTR wszHash, bool bRecursive,
  382. IWbemObjectSink* pSink, bool bClone);
  383. HRESULT FireEvent(CEventCollector &aEvents, DWORD dwType, LPCWSTR wszArg1, _IWmiObject* pObj1,
  384. _IWmiObject* pObj2 = NULL);
  385. HRESULT DeleteSelf(CEventCollector &aEvents);
  386. HRESULT DeleteInstanceAsScope(_IWmiObject* pInst, CEventCollector &aEvents);
  387. HRESULT DeleteInstanceSelf(LPCWSTR wszFilePath, _IWmiObject* pInst,
  388. bool bClassDeletion);
  389. HRESULT ConstructReferenceDir(LPWSTR wszTargetPath, LPWSTR wszDir);
  390. HRESULT ConstructReferenceDirFromKey(LPCWSTR wszClassName,
  391. LPCWSTR wszKey, LPWSTR wszReferenceDir);
  392. HRESULT ConstructReferenceFileName(LPWSTR wszReference,
  393. LPCWSTR wszReferringFile, LPWSTR wszReferenceFile);
  394. HRESULT ConstructKeyRootDirFromClass(LPWSTR wszDir, LPCWSTR wszClassName);
  395. HRESULT ConstructKeyRootDirFromKeyRoot(LPWSTR wszDir,
  396. LPCWSTR wszKeyRootClass);
  397. HRESULT ConstructLinkDirFromClass(LPWSTR wszDir, LPCWSTR wszClassName);
  398. HRESULT WriteInstanceLinkByHash(LPCWSTR wszClassName,
  399. LPCWSTR wszInstanceHash);
  400. HRESULT DeleteInstanceLink(_IWmiObject* pInst,
  401. LPCWSTR wszInstanceDefFilePath);
  402. HRESULT GetKeyRoot(LPCWSTR wszClass,
  403. TEMPFREE_ME LPWSTR* pwszKeyRootClass);
  404. HRESULT ConstructInstDefNameFromLinkName(LPWSTR wszInstanceDefName,
  405. LPCWSTR wszInstanceLinkName);
  406. HRESULT ExecDeepInstanceQuery(QL_LEVEL_1_RPN_EXPRESSION* pQuery,
  407. LPCWSTR wszClassHash,
  408. IWbemObjectSink* pSink);
  409. HRESULT ExecShallowInstanceQuery(QL_LEVEL_1_RPN_EXPRESSION* pQuery,
  410. LPCWSTR wszClassHash,
  411. IWbemObjectSink* pSink);
  412. HRESULT GetKeyRootByHash(LPCWSTR wszClassHash,
  413. TEMPFREE_ME LPWSTR* pwszKeyRootClass);
  414. HRESULT ConstructKeyRootDirFromClassHash(LPWSTR wszDir,
  415. LPCWSTR wszClassHash);
  416. HRESULT ConstructLinkDirFromClassHash(LPWSTR wszDir, LPCWSTR wszClassHash);
  417. HRESULT ConstructClassReferenceFileName(LPCWSTR wszReferredToClass,
  418. LPCWSTR wszReferringFile,
  419. LPCWSTR wszReferringProp,
  420. LPWSTR wszFieName);
  421. HRESULT WriteClassReference(_IWmiObject* pReferringClass,
  422. LPCWSTR wszReferringFile,
  423. LPCWSTR wszReferringProp);
  424. HRESULT EraseClassReference(_IWmiObject* pReferringClass,
  425. LPCWSTR wszReferringFile,
  426. LPCWSTR wszReferringProp);
  427. CFileCache* GetFileCache();
  428. HRESULT CanClassBeUpdatedCompatible(DWORD dwFlags, LPCWSTR wszClassName,
  429. _IWmiObject *pOldClass, _IWmiObject *pNewClass);
  430. HRESULT DeleteInstanceBackReferences(LPCWSTR wszFilePath);
  431. HRESULT ConstructReferenceDirFromFilePath(LPCWSTR wszFilePath,
  432. LPWSTR wszReferenceDir);
  433. HRESULT ClassHasChildren(LPCWSTR wszClassName);
  434. HRESULT ClassHasInstances(LPCWSTR wszClassName);
  435. HRESULT ClassHasInstancesFromClassHash(LPCWSTR wszClassHash);
  436. HRESULT ClassHasInstancesInScopeFromClassHash(
  437. LPCWSTR wszInstanceRootDir, LPCWSTR wszClassHash);
  438. HRESULT UpdateClassCompatible(_IWmiObject* pSuperClass,
  439. LPCWSTR wszClassName, _IWmiObject *pNewClass,
  440. _IWmiObject *pOldClass, __int64 nFakeUpdateTime = 0);
  441. HRESULT UpdateClassCompatibleHash(_IWmiObject* pSuperClass,
  442. LPCWSTR wszClassHash, _IWmiObject *pClass,
  443. _IWmiObject *pOldClass, __int64 nFakeUpdateTime = 0);
  444. HRESULT UpdateClassSafeForce(_IWmiObject* pSuperClass, DWORD dwFlags,
  445. LPCWSTR wcsClassName, _IWmiObject *pOldClass,
  446. _IWmiObject *pNewClass, CEventCollector &aEvents);
  447. HRESULT UpdateClassAggressively(_IWmiObject* pSuperClass, DWORD dwFlags,
  448. LPCWSTR wszClassName, _IWmiObject *pNewClass,
  449. _IWmiObject *pOldClass, bool bValidateOnly,
  450. CEventCollector &aEvents);
  451. HRESULT UpdateChildClassAggressively(DWORD dwFlags, LPCWSTR wszClassHash,
  452. _IWmiObject *pNewClass, bool bValidateOnly,
  453. CEventCollector &aEvents);
  454. };
  455. class CDbIterator : public CUnkBase2<IWmiDbIterator, &IID_IWmiDbIterator,
  456. IWbemObjectSink, &IID_IWbemObjectSink>
  457. {
  458. protected:
  459. CCritSec m_cs;
  460. CRefedPointerQueue<IWbemClassObject> m_qObjects;
  461. long m_lCurrentIndex;
  462. void* m_pExecFiber;
  463. CFiberTask* m_pExecReq;
  464. HRESULT m_hresStatus;
  465. void* m_pMainFiber;
  466. DWORD m_dwNumRequested;
  467. HRESULT m_hresCancellationStatus;
  468. bool m_bExecFiberRunning;
  469. public:
  470. CDbIterator(CLifeControl* pControl);
  471. ~CDbIterator();
  472. STDMETHOD(Cancel) (DWORD dwFlags);
  473. STDMETHOD(NextBatch)(
  474. DWORD dwNumRequested,
  475. DWORD dwTimeOutSeconds,
  476. DWORD dwFlags,
  477. DWORD dwRequestedHandleType,
  478. REFIID riid,
  479. DWORD *pdwNumReturned,
  480. LPVOID *ppObjects
  481. );
  482. void SetExecFiber(void* pFiber, CFiberTask* pReq);
  483. STDMETHOD(Indicate)(long lNumObjects, IWbemClassObject** apObjects);
  484. STDMETHOD(SetStatus)(long lFlags, HRESULT hresResult,
  485. BSTR, IWbemClassObject*);
  486. };
  487. #endif