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.

928 lines
28 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. SVCQ.CPP
  5. Abstract:
  6. Implemntation of asynchronous request queue classes.
  7. Classes implemented:
  8. CAsyncReq and derivatives Asynchrnous requests to WINMGMT.
  9. CAsyncServiceQueue The queue of such requests.
  10. History:
  11. raymcc 16-Jul-96 Created.
  12. levn 12-Sep-96 Implemented a few requests.
  13. Added LoadProviders
  14. --*/
  15. #include "precomp.h"
  16. #include <wbemcore.h>
  17. #include <svcq.h>
  18. #include <oahelp.inl>
  19. WCHAR CNamespaceReq::s_DumpBuffer[128];
  20. CAsyncServiceQueue::CAsyncServiceQueue(_IWmiArbitrator * pArb)
  21. : m_bInit( FALSE )
  22. {
  23. m_lRef = 1;
  24. m_bInit = SetThreadLimits(50, 60, 0);
  25. CCoreQueue::SetArbitrator(pArb);
  26. }
  27. void CAsyncServiceQueue::IncThreadLimit()
  28. {
  29. InterlockedIncrement(&m_lMaxThreads);
  30. InterlockedIncrement(&m_lHiPriMaxThreads);
  31. }
  32. void CAsyncServiceQueue::DecThreadLimit()
  33. {
  34. InterlockedDecrement(&m_lMaxThreads);
  35. InterlockedDecrement(&m_lHiPriMaxThreads);
  36. }
  37. HRESULT CAsyncServiceQueue::InitializeThread()
  38. {
  39. DEBUGTRACE((LOG_WBEMCORE,
  40. "STARTING a main queue thread %d for a total of %d\n",
  41. GetCurrentThreadId(), m_lNumThreads));
  42. return CWbemQueue::InitializeThread();
  43. }
  44. void CAsyncServiceQueue::UninitializeThread()
  45. {
  46. DEBUGTRACE((LOG_WBEMCORE,
  47. "STOPPING a main queue thread %d for a total of %d\n",
  48. GetCurrentThreadId(), m_lNumThreads));
  49. CWbemQueue::UninitializeThread();
  50. }
  51. //***************************************************************************
  52. //
  53. // See svcq.h for documentation.
  54. //
  55. //***************************************************************************
  56. CAsyncReq::CAsyncReq(IWbemObjectSink* pHandler, IWbemContext* pContext,
  57. bool bSeparatelyThreaded)
  58. : CWbemRequest(pContext, bSeparatelyThreaded)
  59. {
  60. if(pHandler)
  61. {
  62. if(m_pContext == NULL)
  63. {
  64. // Oop!
  65. m_pHandler = NULL;
  66. m_fOk = false;
  67. return;
  68. }
  69. IWbemCausalityAccess* pCA = NULL;
  70. m_pContext->QueryInterface(IID_IWbemCausalityAccess, (void**)&pCA); // SEC:REVIEWED 2002-03-22 : Needs check, but highly reliable
  71. REQUESTID id;
  72. pCA->GetRequestId(&id);
  73. pCA->Release();
  74. m_pHandler = new CStdSink(pHandler);
  75. if (m_pHandler)
  76. {
  77. m_pHandler->AddRef();
  78. }
  79. else
  80. {
  81. m_fOk = false;
  82. }
  83. }
  84. else
  85. {
  86. m_pHandler = NULL;
  87. }
  88. }
  89. //***************************************************************************
  90. //
  91. // See svcq.h for documentation.
  92. //
  93. //***************************************************************************
  94. CAsyncReq::~CAsyncReq()
  95. {
  96. if(m_pHandler)
  97. m_pHandler->Release();
  98. }
  99. void CAsyncReq::TerminateRequest(HRESULT hRes)
  100. {
  101. if(m_pHandler)
  102. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  103. return;
  104. }
  105. /*
  106. * =============================================================================
  107. |
  108. | HRESULT CAsyncReq::SetTaskHandle ( _IWmiCoreHandle *phTask )
  109. | ------------------------------------------------------------
  110. |
  111. | Sets the task handle for the request. This is overrides the virtual
  112. | SetTaskHandle declared in CCoreExecReq. We need additional functionality,
  113. | specifically the ability to set the request sink. In order to do so, we first
  114. | need a valid request sink which we have at this level.
  115. |
  116. |
  117. * =============================================================================
  118. */
  119. HRESULT CAsyncReq::SetTaskHandle ( _IWmiCoreHandle *phTask )
  120. {
  121. HRESULT hRes = WBEM_S_NO_ERROR ;
  122. if (phTask)
  123. {
  124. phTask->AddRef();
  125. m_phTask = phTask;
  126. }
  127. if ( m_pHandler )
  128. {
  129. ((CWmiTask*)m_phTask)->SetRequestSink(m_pHandler) ;
  130. }
  131. return hRes ;
  132. }
  133. CWbemQueue* CAsyncReq::GetQueue()
  134. {
  135. return ConfigMgr::GetAsyncSvcQueue();
  136. }
  137. //*****************************************************************************
  138. //*****************************************************************************
  139. //*****************************************************************************
  140. //***************************************************************************
  141. //
  142. // See svcq.h for documentation.
  143. //
  144. //***************************************************************************
  145. CNamespaceReq::CNamespaceReq(CWbemNamespace* pNamespace,
  146. IWbemObjectSink* pHandler, IWbemContext* pContext,
  147. bool bSeparatelyThreaded)
  148. : CAsyncReq(pHandler, pContext, bSeparatelyThreaded)
  149. {
  150. m_pNamespace = pNamespace;
  151. pNamespace->AddRef();
  152. }
  153. //***************************************************************************
  154. //
  155. // See svcq.h for documentation.
  156. //
  157. //***************************************************************************
  158. CNamespaceReq::~CNamespaceReq()
  159. {
  160. m_pNamespace->Release();
  161. }
  162. //*****************************************************************************
  163. //*****************************************************************************
  164. //*****************************************************************************
  165. //***************************************************************************
  166. //
  167. // See svcq.h for documentation.
  168. //
  169. //***************************************************************************
  170. CAsyncReq_OpenNamespace::CAsyncReq_OpenNamespace(CWbemNamespace* pParentNs,
  171. LPWSTR wszNamespace,
  172. long lSecurityFlags,
  173. DWORD dwPermission,
  174. IWbemContext* pContext,
  175. CCallResult* pResult, bool bForClient)
  176. : CAsyncReq(NULL, pContext), m_wsNamespace(wszNamespace),
  177. m_lSecurityFlags(lSecurityFlags), m_dwPermission(dwPermission), m_pResult(pResult),
  178. m_pParentNs(pParentNs), m_bForClient(bForClient)
  179. {
  180. m_pResult->AddRef();
  181. m_pParentNs->AddRef();
  182. }
  183. //***************************************************************************
  184. //
  185. // See svcq.h for documentation.
  186. //
  187. //***************************************************************************
  188. CAsyncReq_OpenNamespace::~CAsyncReq_OpenNamespace()
  189. {
  190. m_pResult->Release();
  191. m_pParentNs->Release();
  192. }
  193. //***************************************************************************
  194. //
  195. // See svcq.h for documentation.
  196. //
  197. //***************************************************************************
  198. HRESULT CAsyncReq_OpenNamespace::Execute()
  199. {
  200. SCODE hres;
  201. BOOL bRepositoryOnly = (m_lSecurityFlags & WBEM_FLAG_CONNECT_REPOSITORY_ONLY);
  202. m_lSecurityFlags &= ~WBEM_FLAG_CONNECT_REPOSITORY_ONLY;
  203. CWbemNamespace* pNewNs = CWbemNamespace::CreateInstance();
  204. if (pNewNs == NULL)
  205. {
  206. m_pResult->SetStatus(WBEM_E_OUT_OF_MEMORY, NULL, NULL);
  207. return WBEM_E_OUT_OF_MEMORY;
  208. }
  209. hres = pNewNs->Initialize(m_wsNamespace,
  210. m_pParentNs->GetUserName(), // SEC:REVIEWED 2002-03-22 : OK
  211. m_lSecurityFlags, m_dwPermission, m_bForClient, bRepositoryOnly,
  212. m_pParentNs->GetClientMachine(), m_pParentNs->GetClientProcID(), FALSE, NULL);
  213. if (FAILED(hres))
  214. {
  215. m_pResult->SetStatus(hres, NULL, NULL);
  216. pNewNs->Release();
  217. return hres;
  218. }
  219. if (hres = pNewNs->GetStatus())
  220. {
  221. m_pResult->SetStatus(hres, NULL, NULL);
  222. pNewNs->Release();
  223. return hres;
  224. }
  225. // check for security if this isnt the local 9x case
  226. if((m_lSecurityFlags & SecFlagWin9XLocal) == 0)
  227. {
  228. DWORD dwAccess = pNewNs->GetUserAccess();
  229. if((dwAccess & WBEM_ENABLE) == 0)
  230. {
  231. pNewNs->Release();
  232. m_pResult->SetStatus(WBEM_E_ACCESS_DENIED, NULL, NULL);
  233. return WBEM_E_ACCESS_DENIED;
  234. }
  235. pNewNs->SetPermissions(dwAccess);
  236. }
  237. pNewNs->SetLocale(m_pParentNs->GetLocale());
  238. m_pResult->SetResultServices(pNewNs);
  239. pNewNs->Release();
  240. m_pResult->SetStatus(WBEM_S_NO_ERROR, NULL, NULL);
  241. return WBEM_NO_ERROR;
  242. }
  243. //******************************************************************************
  244. //
  245. //******************************************************************************
  246. //
  247. HRESULT CAsyncReq_DeleteClassAsync::Execute()
  248. {
  249. HRESULT hRes;
  250. try
  251. {
  252. hRes = m_pNamespace->Exec_DeleteClass(m_wsClass, m_lFlags, m_pContext,
  253. m_pHandler);
  254. }
  255. catch (...)
  256. {
  257. ExceptionCounter c;
  258. hRes = WBEM_E_CRITICAL_ERROR;
  259. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  260. }
  261. return hRes;
  262. }
  263. //******************************************************************************
  264. //
  265. //******************************************************************************
  266. //
  267. HRESULT CAsyncReq_ExecQueryAsync::Execute()
  268. {
  269. HRESULT hRes;
  270. //
  271. // the CQueryEngine::ExecQuery has a guard for calling SetStatus on the Sink
  272. //
  273. hRes = CQueryEngine::ExecQuery(m_pNamespace, m_wsQueryFormat, m_wsQuery,
  274. m_lFlags, m_pContext, m_pHandler);
  275. return hRes;
  276. }
  277. //******************************************************************************
  278. //
  279. //******************************************************************************
  280. //
  281. HRESULT CAsyncReq_PutClassAsync::Execute()
  282. {
  283. HRESULT hRes;
  284. try
  285. {
  286. hRes = m_pNamespace->Exec_PutClass(m_pClass, m_lFlags, m_pContext,m_pHandler);
  287. }
  288. catch (...)
  289. {
  290. ExceptionCounter c;
  291. hRes = WBEM_E_CRITICAL_ERROR;
  292. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  293. }
  294. return hRes;
  295. }
  296. //******************************************************************************
  297. //
  298. //******************************************************************************
  299. //
  300. HRESULT CAsyncReq_DeleteInstanceAsync::Execute()
  301. {
  302. HRESULT hRes;
  303. try
  304. {
  305. hRes = m_pNamespace->Exec_DeleteInstance(m_wsPath, m_lFlags, m_pContext,m_pHandler);
  306. }
  307. catch (...)
  308. {
  309. ExceptionCounter c;
  310. hRes = WBEM_E_CRITICAL_ERROR;
  311. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  312. }
  313. return hRes;
  314. }
  315. //******************************************************************************
  316. //
  317. //******************************************************************************
  318. //
  319. HRESULT CAsyncReq_PutInstanceAsync::Execute()
  320. {
  321. HRESULT hRes;
  322. try
  323. {
  324. hRes= m_pNamespace->Exec_PutInstance(m_pInstance, m_lFlags, m_pContext,m_pHandler);
  325. }
  326. catch (...)
  327. {
  328. ExceptionCounter c;
  329. hRes = WBEM_E_CRITICAL_ERROR;
  330. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  331. }
  332. return hRes;
  333. }
  334. //******************************************************************************
  335. //
  336. //******************************************************************************
  337. //
  338. HRESULT CAsyncReq_CreateClassEnumAsync::Execute()
  339. {
  340. HRESULT hRes;
  341. try
  342. {
  343. hRes = m_pNamespace->Exec_CreateClassEnum(m_wsParent, m_lFlags, m_pContext, m_pHandler);
  344. }
  345. catch (...)
  346. {
  347. ExceptionCounter c;
  348. hRes = WBEM_E_CRITICAL_ERROR;
  349. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  350. }
  351. return hRes;
  352. }
  353. //******************************************************************************
  354. //
  355. //******************************************************************************
  356. //
  357. HRESULT CAsyncReq_CreateInstanceEnumAsync::Execute()
  358. {
  359. HRESULT hRes;
  360. try
  361. {
  362. hRes = m_pNamespace->Exec_CreateInstanceEnum(m_wsClass, m_lFlags,m_pContext, m_pHandler);
  363. }
  364. catch (...)
  365. {
  366. ExceptionCounter c;
  367. hRes = WBEM_E_CRITICAL_ERROR;
  368. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  369. }
  370. return hRes;
  371. }
  372. //******************************************************************************
  373. //
  374. //******************************************************************************
  375. //
  376. HRESULT CAsyncReq_GetObjectAsync::Execute()
  377. {
  378. HRESULT hRes;
  379. try
  380. {
  381. hRes = m_pNamespace->Exec_GetObject(m_wsObjectPath, m_lFlags,m_pContext, m_pHandler);
  382. }
  383. catch (...)
  384. {
  385. ExceptionCounter c;
  386. hRes = WBEM_E_CRITICAL_ERROR;
  387. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  388. }
  389. return hRes;
  390. }
  391. //******************************************************************************
  392. //
  393. //******************************************************************************
  394. //
  395. HRESULT CAsyncReq_ExecMethodAsync::Execute()
  396. {
  397. HRESULT hRes;
  398. try
  399. {
  400. hRes = m_pNamespace->Exec_ExecMethod(m_wsObjectPath, m_wsMethodName,m_lFlags, m_pInParams, m_pContext, m_pHandler);
  401. }
  402. catch (...)
  403. {
  404. ExceptionCounter c;
  405. hRes = WBEM_E_CRITICAL_ERROR;
  406. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  407. }
  408. return hRes;
  409. }
  410. //******************************************************************************
  411. //
  412. //******************************************************************************
  413. //
  414. CAsyncReq_ExecNotificationQueryAsync::CAsyncReq_ExecNotificationQueryAsync(
  415. CWbemNamespace* pNamespace,
  416. IWbemEventSubsystem_m4* pEss,
  417. BSTR QueryFormat, BSTR Query, long lFlags,
  418. IWbemObjectSink *pHandler, IWbemContext* pContext, HRESULT* phRes,
  419. HANDLE hEssDoneEvent
  420. ) :
  421. CNamespaceReq(pNamespace, pHandler, pContext, false),// no threadswitch!
  422. m_wsQueryFormat(QueryFormat), m_wsQuery(Query), m_lFlags(lFlags),
  423. m_phRes(phRes), m_pEss(pEss), m_hEssDoneEvent(hEssDoneEvent)
  424. {
  425. if (m_pEss)
  426. m_pEss->AddRef();
  427. }
  428. //******************************************************************************
  429. //
  430. //******************************************************************************
  431. //
  432. CAsyncReq_ExecNotificationQueryAsync::~CAsyncReq_ExecNotificationQueryAsync()
  433. {
  434. if (m_pEss)
  435. m_pEss->Release();
  436. }
  437. //******************************************************************************
  438. //
  439. //******************************************************************************
  440. //
  441. HRESULT CAsyncReq_ExecNotificationQueryAsync::Execute()
  442. {
  443. _DBG_ASSERT(m_phTask);
  444. _DBG_ASSERT(m_hEssDoneEvent);
  445. HRESULT hRes;
  446. CAutoSignal SetMe(m_hEssDoneEvent);
  447. try
  448. {
  449. hRes = m_pEss->RegisterNotificationSink(m_pNamespace->GetNameFull(), m_wsQueryFormat, m_wsQuery, m_lFlags,
  450. m_pContext, m_pHandler);
  451. *m_phRes = hRes;
  452. }
  453. catch(...)
  454. {
  455. ExceptionCounter c;
  456. hRes = WBEM_E_CRITICAL_ERROR;
  457. m_pHandler->SetStatus( 0, hRes, NULL, NULL);
  458. }
  459. return hRes;
  460. }
  461. //******************************************************************************
  462. //
  463. //******************************************************************************
  464. //
  465. CAsyncReq_CancelAsyncCall::CAsyncReq_CancelAsyncCall(
  466. IWbemObjectSink* pSink, HRESULT* phres)
  467. : CAsyncReq(NULL, NULL), m_phres(phres), m_pSink(pSink)
  468. {
  469. if (m_pSink)
  470. m_pSink->AddRef();
  471. }
  472. //******************************************************************************
  473. //
  474. //******************************************************************************
  475. //
  476. CAsyncReq_CancelAsyncCall::~CAsyncReq_CancelAsyncCall()
  477. {
  478. if(m_pSink)
  479. m_pSink->Release();
  480. }
  481. //******************************************************************************
  482. //
  483. //******************************************************************************
  484. //
  485. HRESULT CAsyncReq_CancelAsyncCall::Execute()
  486. {
  487. HRESULT hres;
  488. try
  489. {
  490. hres = CWbemNamespace::Exec_CancelAsyncCall(m_pSink);
  491. if(m_phres)
  492. *m_phres = hres;
  493. }
  494. catch(...)
  495. {
  496. ExceptionCounter c;
  497. hres = WBEM_E_CRITICAL_ERROR;
  498. }
  499. return hres;
  500. }
  501. //******************************************************************************
  502. //
  503. //******************************************************************************
  504. //
  505. CAsyncReq_CancelProvAsyncCall::CAsyncReq_CancelProvAsyncCall(
  506. IWbemServices* pProv, IWbemObjectSink* pSink,
  507. IWbemObjectSink* pStatusSink )
  508. : CAsyncReq(NULL, NULL), m_pProv(pProv), m_pSink(pSink), m_pStatusSink( pStatusSink )
  509. {
  510. if (m_pProv) m_pProv->AddRef();
  511. if (m_pSink) m_pSink->AddRef();
  512. if (m_pStatusSink) m_pStatusSink->AddRef();
  513. SetForceRun(1);
  514. SetPriority(PriorityFreeMemRequests);
  515. }
  516. //******************************************************************************
  517. //
  518. //******************************************************************************
  519. //
  520. CAsyncReq_CancelProvAsyncCall::~CAsyncReq_CancelProvAsyncCall()
  521. {
  522. if ( NULL != m_pProv )
  523. m_pProv->Release();
  524. if ( NULL != m_pSink )
  525. m_pSink->Release();
  526. if ( NULL != m_pStatusSink )
  527. m_pStatusSink->Release();
  528. }
  529. //******************************************************************************
  530. //
  531. //******************************************************************************
  532. //
  533. HRESULT CAsyncReq_CancelProvAsyncCall::Execute()
  534. {
  535. HRESULT hres = CWbemNamespace::Exec_CancelProvAsyncCall( m_pProv, m_pSink );
  536. if ( NULL != m_pStatusSink )
  537. {
  538. m_pStatusSink->SetStatus( 0L, hres, NULL, NULL );
  539. }
  540. return hres;
  541. }
  542. //******************************************************************************
  543. //
  544. //******************************************************************************
  545. //
  546. CAsyncReq_RemoveNotifySink::CAsyncReq_RemoveNotifySink(
  547. IWbemObjectSink* pSink, IWbemObjectSink* pStatusSink)
  548. : CAsyncReq(NULL, NULL), m_pSink(pSink),m_pStatusSink( pStatusSink )
  549. {
  550. if (m_pSink) m_pSink->AddRef();
  551. if (m_pStatusSink) m_pStatusSink->AddRef();
  552. SetForceRun(1);
  553. SetPriority(PriorityFreeMemRequests);
  554. }
  555. //******************************************************************************
  556. //
  557. //******************************************************************************
  558. //
  559. CAsyncReq_RemoveNotifySink::~CAsyncReq_RemoveNotifySink()
  560. {
  561. if(m_pSink) m_pSink->Release();
  562. if (m_pStatusSink) m_pStatusSink->Release();
  563. }
  564. //******************************************************************************
  565. //
  566. //******************************************************************************
  567. //
  568. HRESULT CAsyncReq_RemoveNotifySink::Execute()
  569. {
  570. HRESULT hRes = WBEM_E_FAILED;
  571. IWbemEventSubsystem_m4* pEss = ConfigMgr::GetEssSink();
  572. if (pEss)
  573. {
  574. if (m_pSink)
  575. hRes = pEss->RemoveNotificationSink(m_pSink);
  576. pEss->Release();
  577. }
  578. if (m_pStatusSink) m_pStatusSink->SetStatus( 0L, hRes, NULL, NULL );
  579. return hRes;
  580. }
  581. //******************************************************************************
  582. //
  583. //******************************************************************************
  584. //
  585. void CAsyncReq_OpenNamespace::DumpError()
  586. { DEBUGTRACE((LOG_WBEMCORE,
  587. "CAsyncReq_OpenNamespace, Name= %S, in parent namespace %S\n", m_wsNamespace,
  588. m_pParentNs->GetName()));
  589. }
  590. //******************************************************************************
  591. //
  592. //******************************************************************************
  593. //
  594. void CAsyncReq_DeleteClassAsync::DumpError()
  595. { DEBUGTRACE((LOG_WBEMCORE,
  596. "CAsyncReq_DeleteClassAsync, class=%S in namespace %S using flags 0x%x\n", m_wsClass, m_pNamespace->GetName(), m_lFlags));
  597. };
  598. //******************************************************************************
  599. //
  600. //******************************************************************************
  601. //
  602. void CAsyncReq_ExecQueryAsync::DumpError()
  603. {
  604. DEBUGTRACE((LOG_WBEMCORE,
  605. "CAsyncReq_ExecQueryAsync, Query= %S in namespace %S using flags 0x%x\n", m_wsQuery,
  606. m_pNamespace->GetName(), m_lFlags));
  607. }
  608. //******************************************************************************
  609. //
  610. //******************************************************************************
  611. //
  612. void CAsyncReq_PutClassAsync::DumpError()
  613. {
  614. CVar var;
  615. CWbemClass * pCls = (CWbemClass *)m_pClass;
  616. if(0 == pCls->GetProperty(L"__class", &var))
  617. DEBUGTRACE((LOG_WBEMCORE,
  618. "CAsyncReq_PutClassAsync, class=%S in namespace %S using flags 0x%x\n", var.GetLPWSTR(),
  619. m_pNamespace->GetName(), m_lFlags));
  620. }
  621. //******************************************************************************
  622. //
  623. //******************************************************************************
  624. //
  625. void CAsyncReq_PutInstanceAsync::DumpError()
  626. {
  627. BSTR mof = 0;
  628. if(0 == m_pInstance->GetObjectText(0, &mof))
  629. {
  630. DEBUGTRACE((LOG_WBEMCORE,
  631. "CAsyncReq_PutInstanceAsync instance= %S in namespace %S using flags 0x%x\n", mof, m_pNamespace->GetName(), m_lFlags));
  632. SysFreeString(mof);
  633. }
  634. }
  635. //******************************************************************************
  636. //
  637. //******************************************************************************
  638. //
  639. void CAsyncReq_CreateClassEnumAsync::DumpError()
  640. {
  641. DEBUGTRACE((LOG_WBEMCORE,
  642. "CAsyncReq_CreateClassEnumAsync, Parent= %S in namespace %S using flags 0x%x\n",
  643. m_wsParent, m_pNamespace->GetName(), m_lFlags));
  644. }
  645. //******************************************************************************
  646. //
  647. //******************************************************************************
  648. //
  649. void CAsyncReq_CreateInstanceEnumAsync::DumpError()
  650. { DEBUGTRACE((LOG_WBEMCORE,
  651. "CAsyncReq_CreateInstanceEnumAsync, Class= %S in namespace %S using flags 0x%x\n",
  652. m_wsClass, m_pNamespace->GetName(), m_lFlags));
  653. }
  654. //******************************************************************************
  655. //
  656. //******************************************************************************
  657. //
  658. void CAsyncReq_GetObjectAsync::DumpError()
  659. { DEBUGTRACE((LOG_WBEMCORE,
  660. "CAsyncReq_GetObjectAsync, Path= %S in namespace %S using flags 0x%x\n", m_wsObjectPath,
  661. m_pNamespace->GetName(), m_lFlags));
  662. }
  663. //******************************************************************************
  664. //
  665. //******************************************************************************
  666. //
  667. void CAsyncReq_ExecMethodAsync::DumpError()
  668. {
  669. BSTR bstrArgs = NULL;
  670. if(m_pInParams)
  671. m_pInParams->GetObjectText(0, &bstrArgs);
  672. DEBUGTRACE((LOG_WBEMCORE,
  673. "CAsyncReq_ExecMethodAsync, Path= %S, Method=%S, args=%S in namespace %S using flags 0x%x\n",
  674. m_wsObjectPath, m_wsMethodName, (bstrArgs) ? bstrArgs : L"<no args>",
  675. m_pNamespace->GetName(), m_lFlags));
  676. if(bstrArgs)
  677. SysFreeString(bstrArgs);
  678. }
  679. //******************************************************************************
  680. //
  681. //******************************************************************************
  682. void CAsyncReq_ExecNotificationQueryAsync::DumpError()
  683. { DEBUGTRACE((LOG_WBEMCORE,
  684. "CAsyncReq_ExecNotificationQueryAsync, Query= %S in namespace %S using flags 0x%x\n", m_wsQuery,
  685. m_pNamespace->GetName(), m_lFlags));
  686. }
  687. //******************************************************************************
  688. //
  689. //******************************************************************************
  690. void CAsyncReq_DeleteInstanceAsync::DumpError()
  691. { DEBUGTRACE((LOG_WBEMCORE,
  692. "CAsyncReq_DeleteInstanceAsync, path=%S in namespace %S using flags 0x%x\n", m_wsPath, m_pNamespace->GetName(), m_lFlags));
  693. };
  694. //******************************************************************************
  695. //
  696. //******************************************************************************
  697. //
  698. CAsyncReq_DynAux_GetInstances::CAsyncReq_DynAux_GetInstances(CWbemNamespace *pNamespace,
  699. CWbemObject *pClassDef,
  700. long lFlags,
  701. IWbemContext *pCtx,
  702. CBasicObjectSink *pSink):
  703. CNamespaceReq (pNamespace,pSink,pCtx,true),
  704. m_pClassDef(pClassDef),
  705. m_pCtx(pCtx),
  706. m_pSink(pSink),
  707. m_lFlags(lFlags)
  708. {
  709. if (m_pClassDef) m_pClassDef->AddRef();
  710. if (m_pCtx) m_pCtx->AddRef();
  711. if (m_pSink) m_pSink->AddRef();
  712. }
  713. CAsyncReq_DynAux_GetInstances::~CAsyncReq_DynAux_GetInstances()
  714. {
  715. if (m_pClassDef) m_pClassDef->Release();
  716. if (m_pCtx) m_pCtx->Release();
  717. if (m_pSink) m_pSink->Release();
  718. }
  719. //******************************************************************************
  720. //
  721. //******************************************************************************
  722. //
  723. HRESULT CAsyncReq_DynAux_GetInstances :: Execute ()
  724. {
  725. HRESULT hRes = m_pNamespace->Exec_DynAux_GetInstances (
  726. m_pClassDef ,
  727. m_lFlags ,
  728. m_pContext ,
  729. m_pSink
  730. ) ;
  731. return hRes;
  732. }
  733. //******************************************************************************
  734. //
  735. //******************************************************************************
  736. //
  737. void CAsyncReq_DynAux_GetInstances ::DumpError()
  738. {
  739. // none
  740. }
  741. //******************************************************************************
  742. //
  743. //******************************************************************************
  744. //
  745. CAsyncReq_DynAux_ExecQueryAsync::CAsyncReq_DynAux_ExecQueryAsync(CWbemNamespace *pNamespace ,
  746. CWbemObject *pClassDef ,
  747. LPWSTR Query,
  748. LPWSTR QueryFormat,
  749. long lFlags ,
  750. IWbemContext *pCtx ,
  751. CBasicObjectSink *pSink):
  752. CNamespaceReq(pNamespace,pSink, pCtx, true),
  753. m_pClassDef(pClassDef),
  754. m_pCtx(pCtx),
  755. m_pSink(pSink),
  756. m_lFlags(lFlags),
  757. m_Query(NULL),
  758. m_QueryFormat(NULL),
  759. m_Result (S_OK)
  760. {
  761. if (m_pClassDef) m_pClassDef->AddRef () ;
  762. if (m_pCtx) m_pCtx->AddRef () ;
  763. if (m_pSink) m_pSink->AddRef () ;
  764. if (Query)
  765. {
  766. m_Query = SysAllocString ( Query ) ;
  767. if ( m_Query == NULL )
  768. {
  769. m_Result = WBEM_E_OUT_OF_MEMORY ;
  770. }
  771. }
  772. if (QueryFormat)
  773. {
  774. m_QueryFormat = SysAllocString ( QueryFormat ) ;
  775. if ( m_QueryFormat == NULL )
  776. {
  777. m_Result = WBEM_E_OUT_OF_MEMORY ;
  778. }
  779. }
  780. }
  781. CAsyncReq_DynAux_ExecQueryAsync :: ~CAsyncReq_DynAux_ExecQueryAsync ()
  782. {
  783. if (m_pClassDef) m_pClassDef->Release();
  784. if (m_pCtx) m_pCtx->Release();
  785. if (m_pSink) m_pSink->Release();
  786. SysFreeString(m_Query);
  787. SysFreeString(m_QueryFormat);
  788. }
  789. HRESULT CAsyncReq_DynAux_ExecQueryAsync :: Execute ()
  790. {
  791. HRESULT hRes = m_pNamespace->Exec_DynAux_ExecQueryAsync (
  792. m_pClassDef ,
  793. m_Query,
  794. m_QueryFormat,
  795. m_lFlags ,
  796. m_pContext ,
  797. m_pSink
  798. ) ;
  799. return hRes;
  800. }
  801. //******************************************************************************
  802. //
  803. //******************************************************************************
  804. //
  805. void CAsyncReq_DynAux_ExecQueryAsync ::DumpError()
  806. {
  807. // none
  808. }