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.

866 lines
27 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. SVCQ.H
  5. Abstract:
  6. Declarations for asynchronous request queue classes.
  7. Classes defined:
  8. CAsyncReq and derivatives Asynchrnous requests to WINMGMT.
  9. CAsyncServiceQueue The queue of such requests.
  10. History:
  11. a-raymcc 16-Jul-96 Created.
  12. a-levn 12-Sep-96 Implemented a few requests.
  13. Added LoadProviders
  14. --*/
  15. #ifndef _ASYNC_Q_H_
  16. #define _ASYNC_Q_H_
  17. class CWbemNamespace;
  18. class CBasicObjectSink;
  19. class CStdSink;
  20. class CWbemObject;
  21. //******************************************************************************
  22. //******************************************************************************
  23. //
  24. // class CAsyncReq
  25. //
  26. // Represents an asynchrnous request to WINMGMT, such as GetObjectAsync.
  27. // This class is derived from CExecRequest (execq.h), a generic request for
  28. // execution queues. For more information on queues and requests, see execq.h
  29. //
  30. //******************************************************************************
  31. //
  32. // Contructor
  33. //
  34. // Every asynchrnous request has an IWbemObjectSink pointer associated with it.
  35. // In addition, assigns a unique integer to this object which becomes its
  36. // request handle.
  37. //
  38. // PARAMETERS:
  39. //
  40. // IWbemObjectSink* pHandler The handler associated with this request.
  41. // AddRefs and stores this pointer.
  42. //
  43. //******************************************************************************
  44. //
  45. // Destructor
  46. //
  47. // Releases the stored handler.
  48. //
  49. //******************************************************************************
  50. //
  51. // GetRequestHandle
  52. //
  53. // Returns the unique request handle assigned to this request in constructor.
  54. //
  55. // RETURN VALUES:
  56. //
  57. // long
  58. //
  59. //******************************************************************************
  60. class CAsyncReq : public CWbemRequest
  61. {
  62. protected:
  63. CStdSink *m_pHandler;
  64. long m_lRequestHandle;
  65. void SetRequestHandle(long lHandle) {m_lRequestHandle = lHandle;}
  66. void SetNoAuthentication(IWbemObjectSink* pHandler);
  67. public:
  68. CAsyncReq(IWbemObjectSink* pHandler, IWbemContext* pContext,
  69. bool bSeparatelyThreaded = false);
  70. virtual ~CAsyncReq();
  71. virtual HRESULT Execute() = 0;
  72. virtual CWbemQueue* GetQueue();
  73. virtual BOOL IsInternal() {return TRUE;}
  74. void TerminateRequest(HRESULT hRes);
  75. HRESULT SetTaskHandle(_IWmiCoreHandle *phTask);
  76. };
  77. //******************************************************************************
  78. //******************************************************************************
  79. //
  80. // class CAsyncServiceQueue
  81. //
  82. // This class represents the queue of asynchrnous requests into WINMGMT (every
  83. // request into WINMGMT becomes asynchronous, since synchronous methods call
  84. // asynchrnous ones and wait). There is almost no additional functionality
  85. // here, see CExecQueue in execq.h for all details
  86. //
  87. //******************************************************************************
  88. //
  89. // Constructor
  90. //
  91. // In addition to normal CExecQueue construction, launches the processing
  92. // thread by calling Run.
  93. //
  94. //******************************************************************************
  95. class CAsyncServiceQueue : public CWbemQueue
  96. {
  97. private:
  98. BOOL m_bInit;
  99. public:
  100. CAsyncServiceQueue(_IWmiArbitrator * pArb);
  101. HRESULT InitializeThread();
  102. void UninitializeThread();
  103. void IncThreadLimit();
  104. void DecThreadLimit();
  105. BOOL IsInit(){ return m_bInit; };
  106. };
  107. //******************************************************************************
  108. //******************************************************************************
  109. //
  110. // class CNamespaceReq
  111. //
  112. // Another abstract class, albeit derived from CAsyncReq. This one is for
  113. // asynchrnous requests to a particular namespace.
  114. //
  115. //******************************************************************************
  116. //
  117. // Constructor.
  118. //
  119. // In addition to the CAsyncReq's IWbemObjectSink*, takes the
  120. // namespace pointer against which the request is to be executed. Most of
  121. // the time, the execute function calls one of Exec_... members of
  122. // CWbemNamespace.
  123. //
  124. //******************************************************************************
  125. class CNamespaceReq : public CAsyncReq
  126. {
  127. protected:
  128. CWbemNamespace* m_pNamespace;
  129. public:
  130. CNamespaceReq(CWbemNamespace* pNamespace, IWbemObjectSink* pHandler,
  131. IWbemContext* pContext, bool bSeparatelyThreaded = false);
  132. virtual ~CNamespaceReq();
  133. virtual HRESULT Execute() = 0;
  134. static WCHAR s_DumpBuffer[128];
  135. };
  136. //******************************************************************************
  137. //******************************************************************************
  138. //
  139. // class CAsyncReq_DeleteClassAsync
  140. //
  141. // Encapsulates a request to execute DeleteClassAsync against a particular
  142. // namespace. Does it by calling Exec_DeleteClass and converting the
  143. // results to the asynchrnous format.
  144. //
  145. //******************************************************************************
  146. //
  147. // Constructor.
  148. //
  149. // PARAMETERS:
  150. //
  151. // IN CWbemNamespace* pNamespace The namespace to execute against.
  152. // IN LPWSTR wszClass The class to delete.
  153. // IN LONG lFlags Flags
  154. // IN IWbemObjectSink* pHandler The handler to put results in.
  155. //
  156. //******************************************************************************
  157. class CAsyncReq_DeleteClassAsync : public CNamespaceReq
  158. {
  159. WString m_wsClass;
  160. LONG m_lFlags;
  161. public:
  162. CAsyncReq_DeleteClassAsync(
  163. ADDREF CWbemNamespace *pNamespace,
  164. READONLY LPWSTR wszClass,
  165. LONG lFlags,
  166. ADDREF IWbemObjectSink *pHandler,
  167. IWbemContext* pContext
  168. ) : CNamespaceReq(pNamespace, pHandler, pContext),
  169. m_wsClass(wszClass), m_lFlags(lFlags)
  170. {}
  171. HRESULT Execute();
  172. void DumpError();
  173. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsClass; };
  174. };
  175. //******************************************************************************
  176. //******************************************************************************
  177. //
  178. // class CAsyncReq_DeleteInstanceAsync
  179. //
  180. // Encapsulates a request to execute DeleteInstanceAsync against a particular
  181. // namespace. Does it by calling Exec_DeleteInstance and converting the
  182. // results to the asynchrnous format.
  183. //
  184. //******************************************************************************
  185. //
  186. // Constructor.
  187. //
  188. // PARAMETERS:
  189. //
  190. // IN CWbemNamespace* pNamespace The namespace to execute against.
  191. // IN LPWSTR wszObjectPath The path to the instance to delete.
  192. // IN LONG lFlags Flags
  193. // IN IWbemObjectSink* pHandler The handler to put results in.
  194. //
  195. //******************************************************************************
  196. class CAsyncReq_DeleteInstanceAsync : public CNamespaceReq
  197. {
  198. WString m_wsPath;
  199. LONG m_lFlags;
  200. public:
  201. CAsyncReq_DeleteInstanceAsync(
  202. ADDREF CWbemNamespace *pNamespace,
  203. READONLY LPWSTR wszPath,
  204. LONG lFlags,
  205. ADDREF IWbemObjectSink *pHandler,
  206. IWbemContext* pContext
  207. ) : CNamespaceReq(pNamespace, pHandler, pContext), m_wsPath(wszPath),
  208. m_lFlags(lFlags)
  209. {}
  210. HRESULT Execute();
  211. void DumpError();
  212. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsPath; };
  213. };
  214. //******************************************************************************
  215. //******************************************************************************
  216. //
  217. // class CAsyncReq_PutClassAsync
  218. //
  219. // Encapsulates a request to execute PutClassAsync against a particular
  220. // namespace. Does it by calling Exec_PutClass and converting the
  221. // results to the asynchrnous format.
  222. //
  223. //******************************************************************************
  224. //
  225. // Constructor.
  226. //
  227. // PARAMETERS:
  228. //
  229. // IN CWbemNamespace* pNamespace The namespace to execute against.
  230. // IN IWbemClassObject* pClass The class to put.
  231. // IN LONG lFlags Flags
  232. // IN IWbemObjectSink* pHandler The handler to put results in.
  233. //
  234. //******************************************************************************
  235. class CAsyncReq_PutClassAsync : public CNamespaceReq
  236. {
  237. IWbemClassObject* m_pClass;
  238. LONG m_lFlags;
  239. public:
  240. CAsyncReq_PutClassAsync(
  241. ADDREF CWbemNamespace *pNamespace,
  242. ADDREF IWbemClassObject* pClass,
  243. LONG lFlags,
  244. ADDREF IWbemObjectSink *pHandler,
  245. ADDREF IWbemContext* pContext
  246. ) : CNamespaceReq(pNamespace, pHandler, pContext), m_pClass(pClass),
  247. m_lFlags(lFlags)
  248. {
  249. m_pClass->AddRef();
  250. }
  251. ~CAsyncReq_PutClassAsync()
  252. {
  253. m_pClass->Release();
  254. }
  255. HRESULT Execute();
  256. void DumpError();
  257. LPCWSTR GetReqInfo()
  258. {
  259. _variant_t varClass;
  260. if (FAILED(m_pClass->Get(L"__CLASS",0,&varClass,0,0))) return L"";
  261. if (VT_BSTR == V_VT(&varClass))
  262. {
  263. StringCchCopyW(CNamespaceReq::s_DumpBuffer,LENGTH_OF(CNamespaceReq::s_DumpBuffer)-1,V_BSTR(&varClass));
  264. return CNamespaceReq::s_DumpBuffer;
  265. }
  266. else return L"";
  267. };
  268. };
  269. //******************************************************************************
  270. //******************************************************************************
  271. //
  272. // class CAsyncReq_PutInstanceAsync
  273. //
  274. // Encapsulates a request to execute PutInstanceAsync against a particular
  275. // namespace. Does it by calling Exec_PutInstance and converting the
  276. // results to the asynchrnous format.
  277. //
  278. //******************************************************************************
  279. //
  280. // Constructor.
  281. //
  282. // PARAMETERS:
  283. //
  284. // IN CWbemNamespace* pNamespace The namespace to execute against.
  285. // IN IWbemClassObject* pInstance The instance to put.
  286. // IN LONG lFlags Flags
  287. // IN IWbemObjectSink* pHandler The handler to put results in.
  288. //
  289. //******************************************************************************
  290. class CAsyncReq_PutInstanceAsync : public CNamespaceReq
  291. {
  292. IWbemClassObject* m_pInstance;
  293. LONG m_lFlags;
  294. public:
  295. CAsyncReq_PutInstanceAsync(
  296. ADDREF CWbemNamespace *pNamespace,
  297. ADDREF IWbemClassObject* pInstance,
  298. LONG lFlags,
  299. ADDREF IWbemObjectSink *pHandler,
  300. ADDREF IWbemContext* pContext
  301. ) : CNamespaceReq(pNamespace, pHandler, pContext),
  302. m_pInstance(pInstance), m_lFlags(lFlags)
  303. {
  304. m_pInstance->AddRef();
  305. }
  306. ~CAsyncReq_PutInstanceAsync()
  307. {
  308. m_pInstance->Release();
  309. }
  310. HRESULT Execute();
  311. void DumpError();
  312. LPCWSTR GetReqInfo()
  313. {
  314. _variant_t varRelPath;
  315. if (FAILED(m_pInstance->Get(L"__RELPATH",0,&varRelPath,0,0))) return L"";
  316. if (VT_BSTR == V_VT(&varRelPath))
  317. {
  318. StringCchCopyW(CNamespaceReq::s_DumpBuffer,LENGTH_OF(CNamespaceReq::s_DumpBuffer)-1,V_BSTR(&varRelPath));
  319. return CNamespaceReq::s_DumpBuffer;
  320. }
  321. else return L"";
  322. };
  323. };
  324. //******************************************************************************
  325. //******************************************************************************
  326. //
  327. // class CAsyncReq_CreateClassEnumAsync
  328. //
  329. // Encapsulates a request to execute CreateClassEnumAsync against a particular
  330. // namespace. Does it by calling Exec_CreateClassEnum and converting the
  331. // results to the asynchrnous format.
  332. //
  333. //******************************************************************************
  334. //
  335. // Constructor.
  336. //
  337. // PARAMETERS:
  338. //
  339. // IN CWbemNamespace* pNamespace The namespace to execute against.
  340. // IN BSTR Parent The name of the parent class. If NULL,
  341. // start at the top level.
  342. // IN LONG lFlags Flags
  343. // IN IWbemObjectSink* pHandler The handler to put results in.
  344. //
  345. //******************************************************************************
  346. class CAsyncReq_CreateClassEnumAsync : public CNamespaceReq
  347. {
  348. WString m_wsParent;
  349. LONG m_lFlags;
  350. public:
  351. CAsyncReq_CreateClassEnumAsync(CWbemNamespace* pNamespace,
  352. BSTR Parent, LONG lFlags, ADDREF IWbemObjectSink* pHandler,
  353. ADDREF IWbemContext* pContext
  354. ) : CNamespaceReq(pNamespace, pHandler, pContext), m_wsParent(Parent),
  355. m_lFlags(lFlags)
  356. {}
  357. HRESULT Execute();
  358. virtual BOOL IsLongRunning() {return TRUE;}
  359. void DumpError();
  360. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsParent; };
  361. };
  362. //******************************************************************************
  363. //******************************************************************************
  364. //
  365. // class CAsyncReq_CreateInstanceEnumAsync
  366. //
  367. // Encapsulates a request to execute CreateInstanceEnumAsync against a
  368. // particular
  369. // namespace. Does it by calling Exec_CreateInstanceEnum and converting the
  370. // results to the asynchrnous format.
  371. //
  372. //******************************************************************************
  373. //
  374. // Constructor.
  375. //
  376. // PARAMETERS:
  377. //
  378. // IN CWbemNamespace* pNamespace The namespace to execute against.
  379. // IN BSTR Class The name of the class.
  380. // IN LONG lFlags Flags
  381. // IN IWbemObjectSink* pHandler The handler to put results in.
  382. //
  383. //******************************************************************************
  384. class CAsyncReq_CreateInstanceEnumAsync : public CNamespaceReq
  385. {
  386. WString m_wsClass;
  387. LONG m_lFlags;
  388. public:
  389. CAsyncReq_CreateInstanceEnumAsync(
  390. CWbemNamespace* pNamespace, BSTR Class, LONG lFlags,
  391. ADDREF IWbemObjectSink *pHandler,
  392. ADDREF IWbemContext* pContext)
  393. : CNamespaceReq(pNamespace, pHandler, pContext), m_wsClass(Class),
  394. m_lFlags(lFlags)
  395. {}
  396. HRESULT Execute();
  397. virtual BOOL IsLongRunning() {return TRUE;}
  398. void DumpError();
  399. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsClass; };
  400. };
  401. //******************************************************************************
  402. //******************************************************************************
  403. //
  404. // class CAsyncReq_GetObjectByPathAsync
  405. //
  406. // Encapsulates a request to execute GetObjectAsync against a
  407. // particular
  408. // namespace. Does it by calling Exec_GetObjectByPath and converting the
  409. // results to the asynchrnous format.
  410. //
  411. //******************************************************************************
  412. //
  413. // Constructor.
  414. //
  415. // PARAMETERS:
  416. //
  417. // IN CWbemNamespace* pNamespace The namespace to execute against.
  418. // IN BSTR ObjectPath The path to the object to get.
  419. // IN LONG lFlags Flags
  420. // IN IWbemObjectSink* pHandler The handler to put results in.
  421. //
  422. //******************************************************************************
  423. class CAsyncReq_GetObjectAsync : public CNamespaceReq
  424. {
  425. WString m_wsObjectPath;
  426. long m_lFlags;
  427. public:
  428. CAsyncReq_GetObjectAsync(
  429. CWbemNamespace* pNamespace, BSTR ObjectPath, long lFlags,
  430. ADDREF IWbemObjectSink *pHandler, ADDREF IWbemContext* pContext) :
  431. CNamespaceReq(pNamespace, pHandler, pContext),
  432. m_wsObjectPath(ObjectPath), m_lFlags(lFlags)
  433. {}
  434. HRESULT Execute();
  435. void DumpError();
  436. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsObjectPath; };
  437. };
  438. //******************************************************************************
  439. //******************************************************************************
  440. //
  441. // class CAsyncReq_ExecMethodAsync
  442. //
  443. // Encapsulates a request to execute ExecMethodAsync against a
  444. // particular
  445. // namespace. Does it by calling Exec_ExecMethodAsync and converting the
  446. // results to the asynchrnous format.
  447. //
  448. //******************************************************************************
  449. //
  450. // Constructor.
  451. //
  452. // PARAMETERS:
  453. //
  454. // IN CWbemNamespace* pNamespace The namespace to execute against.
  455. // IN BSTR ObjectPath The path to the object to get.
  456. // IN BSTR MethodName The name of the method
  457. // IN LONG lFlags Flags
  458. // IN IWbemClassObject* pInParams The in-parameter of the method
  459. // IN IWbemObjectSink* pHandler The handler to put results in.
  460. //
  461. //******************************************************************************
  462. class CAsyncReq_ExecMethodAsync : public CNamespaceReq
  463. {
  464. WString m_wsObjectPath;
  465. WString m_wsMethodName;
  466. IWbemClassObject* m_pInParams;
  467. long m_lFlags;
  468. public:
  469. CAsyncReq_ExecMethodAsync(
  470. CWbemNamespace* pNamespace,
  471. BSTR ObjectPath,
  472. BSTR MethodName,
  473. long lFlags,
  474. IWbemClassObject* pInParams,
  475. ADDREF IWbemObjectSink *pHandler,
  476. ADDREF IWbemContext* pContext)
  477. : CNamespaceReq(pNamespace, pHandler, pContext),
  478. m_wsObjectPath(ObjectPath), m_wsMethodName(MethodName),
  479. m_pInParams(pInParams), m_lFlags(lFlags)
  480. {
  481. if(m_pInParams)
  482. m_pInParams->AddRef();
  483. }
  484. ~CAsyncReq_ExecMethodAsync()
  485. {
  486. if(m_pInParams)
  487. m_pInParams->Release();
  488. }
  489. HRESULT Execute();
  490. void DumpError();
  491. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsMethodName; };
  492. };
  493. //******************************************************************************
  494. //******************************************************************************
  495. //
  496. // class CAsyncReq_ExecQueryAsync
  497. //
  498. // Encapsulates a request to execute ExecQueryAsync against a
  499. // particular
  500. // namespace. Does it by calling CQueryEngine::ExecQuery and converting the
  501. // results to the asynchrnous format.
  502. //
  503. //******************************************************************************
  504. //
  505. // Constructor.
  506. //
  507. // PARAMETERS:
  508. //
  509. // IN CWbemNamespace* pNamespace The namespace to execute against.
  510. // IN BSTR QueryFormat The query language
  511. // IN BSTR Query The query string.
  512. // IN LONG lFlags Flags
  513. // IN IWbemObjectSink* pHandler The handler to put results in.
  514. //
  515. //******************************************************************************
  516. class CAsyncReq_ExecQueryAsync : public CNamespaceReq
  517. {
  518. WString m_wsQueryFormat;
  519. WString m_wsQuery;
  520. long m_lFlags;
  521. public:
  522. CAsyncReq_ExecQueryAsync(CWbemNamespace* pNamespace,
  523. BSTR QueryFormat, BSTR Query, long lFlags,
  524. IWbemObjectSink *pHandler, IWbemContext* pContext) :
  525. CNamespaceReq(pNamespace, pHandler, pContext),
  526. m_wsQueryFormat(QueryFormat), m_wsQuery(Query), m_lFlags(lFlags)
  527. {}
  528. HRESULT Execute();
  529. virtual BOOL IsLongRunning() {return TRUE;}
  530. void DumpError();
  531. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsQuery; };
  532. };
  533. //******************************************************************************
  534. //
  535. //******************************************************************************
  536. //
  537. class CCallResult;
  538. class CAsyncReq_OpenNamespace : public CAsyncReq
  539. {
  540. CWbemNamespace* m_pParentNs;
  541. WString m_wsNamespace;
  542. long m_lSecurityFlags;
  543. DWORD m_dwPermission;
  544. CCallResult* m_pResult;
  545. bool m_bForClient;
  546. public:
  547. CAsyncReq_OpenNamespace(CWbemNamespace* pParentNs, LPWSTR wszNamespace,
  548. long lSecurityFlags, DWORD dwPermission,
  549. IWbemContext* pContext, CCallResult* pResult, bool bForClient);
  550. ~CAsyncReq_OpenNamespace();
  551. HRESULT Execute();
  552. void DumpError();
  553. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsNamespace; };
  554. };
  555. //******************************************************************************
  556. //******************************************************************************
  557. //
  558. // class CAsyncReq_ExecNotificationQueryAsync
  559. //
  560. // Encapsulates a request to execute ExecNotificationQueryAsync against a
  561. // particular
  562. // namespace. Does it by calling ESS RegisterNotificationSink.
  563. //
  564. //******************************************************************************
  565. //
  566. // Constructor.
  567. //
  568. // PARAMETERS:
  569. //
  570. // IN CWbemNamespace* pNamespace The namespace to execute against.
  571. // IN BSTR QueryFormat The query language
  572. // IN BSTR Query The query string.
  573. // IN LONG lFlags Flags
  574. // IN IWbemObjectSink* pHandler The handler to put results in.
  575. //
  576. //******************************************************************************
  577. class CAsyncReq_ExecNotificationQueryAsync : public CNamespaceReq
  578. {
  579. WString m_wsQueryFormat;
  580. WString m_wsQuery;
  581. long m_lFlags;
  582. HRESULT *m_phRes;
  583. IWbemEventSubsystem_m4* m_pEss;
  584. HANDLE m_hEssDoneEvent;
  585. public:
  586. CAsyncReq_ExecNotificationQueryAsync(CWbemNamespace* pNamespace,
  587. IWbemEventSubsystem_m4* pEss,
  588. BSTR QueryFormat, BSTR Query, long lFlags,
  589. IWbemObjectSink *pHandler, IWbemContext* pContext, HRESULT* phRes,
  590. HANDLE hEssApprovalEvent
  591. );
  592. ~CAsyncReq_ExecNotificationQueryAsync();
  593. HRESULT Execute();
  594. virtual BOOL IsLongRunning() {return TRUE;}
  595. void DumpError();
  596. LPCWSTR GetReqInfo(){ return (WCHAR *)m_wsQuery; };
  597. };
  598. //******************************************************************************
  599. //******************************************************************************
  600. //
  601. // class CAsyncReq_CancelAsyncCall
  602. //
  603. //
  604. //******************************************************************************
  605. //
  606. // Constructor.
  607. //
  608. // PARAMETERS:
  609. //
  610. //
  611. //******************************************************************************
  612. class CAsyncReq_CancelAsyncCall : public CAsyncReq
  613. {
  614. protected:
  615. HRESULT* m_phres;
  616. IWbemObjectSink* m_pSink;
  617. public:
  618. CAsyncReq_CancelAsyncCall(IWbemObjectSink* pSink, HRESULT* phres);
  619. ~CAsyncReq_CancelAsyncCall();
  620. HRESULT Execute();
  621. void DumpError(){ DEBUGTRACE((LOG_WBEMCORE,
  622. "CAsyncReq_CancelAsyncCall call failed\n"));};
  623. LPCWSTR GetReqInfo()
  624. {
  625. StringCchPrintfW(CNamespaceReq::s_DumpBuffer,LENGTH_OF(CNamespaceReq::s_DumpBuffer)-1,L"CancelAsyncCall for sink %p",m_pSink);
  626. return CNamespaceReq::s_DumpBuffer;
  627. };
  628. };
  629. //******************************************************************************
  630. //******************************************************************************
  631. //
  632. // class CAsyncReq_CancelProvAsyncCall
  633. //
  634. //
  635. //******************************************************************************
  636. //
  637. // Constructor.
  638. //
  639. // PARAMETERS:
  640. //
  641. //
  642. //******************************************************************************
  643. class CAsyncReq_CancelProvAsyncCall : public CAsyncReq
  644. {
  645. protected:
  646. IWbemServices* m_pProv;
  647. IWbemObjectSink* m_pSink;
  648. IWbemObjectSink* m_pStatusSink;
  649. public:
  650. CAsyncReq_CancelProvAsyncCall( IWbemServices* pProv, IWbemObjectSink* pSink,
  651. IWbemObjectSink* pStatusSink );
  652. ~CAsyncReq_CancelProvAsyncCall();
  653. HRESULT Execute();
  654. void DumpError(){ DEBUGTRACE((LOG_WBEMCORE,
  655. "CAsyncReq_CancelProvAsyncCall call failed\n"));};
  656. LPCWSTR GetReqInfo()
  657. {
  658. StringCchPrintfW(CNamespaceReq::s_DumpBuffer,LENGTH_OF(CNamespaceReq::s_DumpBuffer)-1,L"CancelProvAsyncCall for sink %p",m_pProv);
  659. return CNamespaceReq::s_DumpBuffer;
  660. };
  661. };
  662. //******************************************************************************
  663. //******************************************************************************
  664. //
  665. // class CAsyncReq_DynAux_GetInstances
  666. //
  667. //
  668. //******************************************************************************
  669. //
  670. // Constructor.
  671. //
  672. // PARAMETERS:
  673. //
  674. //
  675. // READONLY CWbemObject *pClassDef,
  676. // long lFlags,
  677. // IWbemContext* pCtx,
  678. // CBasicObjectSink* pSink
  679. //
  680. //******************************************************************************
  681. class CAsyncReq_DynAux_GetInstances : public CNamespaceReq
  682. {
  683. private:
  684. CWbemObject *m_pClassDef ;
  685. IWbemContext *m_pCtx ;
  686. long m_lFlags ;
  687. CBasicObjectSink *m_pSink ;
  688. public:
  689. CAsyncReq_DynAux_GetInstances (
  690. CWbemNamespace *pNamespace ,
  691. CWbemObject *pClassDef ,
  692. long lFlags ,
  693. IWbemContext *pCtx ,
  694. CBasicObjectSink *pSink);
  695. ~CAsyncReq_DynAux_GetInstances();
  696. HRESULT Execute ();
  697. virtual BOOL IsLongRunning() {return TRUE;}
  698. void DumpError();
  699. LPCWSTR GetReqInfo()
  700. {
  701. _variant_t varClass;
  702. if (FAILED(m_pClassDef->Get(L"__CLASS",0,&varClass,0,0))) return L"";
  703. if (VT_BSTR == V_VT(&varClass))
  704. {
  705. StringCchCopyW(CNamespaceReq::s_DumpBuffer,LENGTH_OF(CNamespaceReq::s_DumpBuffer)-1,V_BSTR(&varClass));
  706. return CNamespaceReq::s_DumpBuffer;
  707. }
  708. else return L"";
  709. };
  710. };
  711. //******************************************************************************
  712. //******************************************************************************
  713. //
  714. // class CAsyncReq_DynAux_ExecQueryAsync
  715. //
  716. //
  717. //******************************************************************************
  718. //
  719. // Constructor.
  720. //
  721. // PARAMETERS:
  722. //
  723. //
  724. // CWbemNamespace *pNamespace ,
  725. // CWbemObject *pClassDef ,
  726. // LPWSTR Query,
  727. // LPWSTR QueryFormat,
  728. // long lFlags ,
  729. // IWbemContext *pCtx ,
  730. // CBasicObjectSink *pSink
  731. //
  732. //******************************************************************************
  733. class CAsyncReq_DynAux_ExecQueryAsync : public CNamespaceReq
  734. {
  735. private:
  736. CWbemObject *m_pClassDef ;
  737. LPWSTR m_Query ;
  738. LPWSTR m_QueryFormat ;
  739. IWbemContext *m_pCtx ;
  740. long m_lFlags ;
  741. CBasicObjectSink *m_pSink ;
  742. HRESULT m_Result ;
  743. public:
  744. CAsyncReq_DynAux_ExecQueryAsync (CWbemNamespace *pNamespace ,
  745. CWbemObject *pClassDef ,
  746. LPWSTR Query,
  747. LPWSTR QueryFormat,
  748. long lFlags ,
  749. IWbemContext *pCtx ,
  750. CBasicObjectSink *pSink);
  751. ~CAsyncReq_DynAux_ExecQueryAsync();
  752. HRESULT Initialize ()
  753. {
  754. return m_Result ;
  755. }
  756. HRESULT Execute ();
  757. virtual BOOL IsLongRunning() {return TRUE;}
  758. void DumpError();
  759. LPCWSTR GetReqInfo()
  760. {
  761. return (WCHAR * )m_Query;
  762. };
  763. };
  764. class CAsyncReq_RemoveNotifySink : public CAsyncReq
  765. {
  766. private:
  767. IWbemObjectSink * m_pSink;
  768. IWbemObjectSink* m_pStatusSink;
  769. public:
  770. CAsyncReq_RemoveNotifySink(IWbemObjectSink* pSink, IWbemObjectSink* pStatusSink);
  771. ~CAsyncReq_RemoveNotifySink();
  772. HRESULT Execute();
  773. void DumpError(){};
  774. LPCWSTR GetReqInfo()
  775. {
  776. StringCchPrintfW(CNamespaceReq::s_DumpBuffer,LENGTH_OF(CNamespaceReq::s_DumpBuffer)-1,L"RemoveNotifySink for sink %p",m_pSink);
  777. return CNamespaceReq::s_DumpBuffer;
  778. };
  779. void SetStatusSink(IWbemObjectSink * pStatusSink)
  780. {
  781. if (m_pStatusSink) m_pStatusSink->Release();
  782. m_pStatusSink = pStatusSink;
  783. if (m_pStatusSink) m_pStatusSink->AddRef();
  784. }
  785. void SetSink(IWbemObjectSink * pSink)
  786. {
  787. if (m_pSink) m_pSink->Release();
  788. m_pSink = pSink;
  789. if (m_pSink) m_pSink->AddRef();
  790. }
  791. };
  792. #endif