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.

1562 lines
40 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ClusterService.cpp
  7. //
  8. // Description:
  9. // Implementation of CClusterService class
  10. //
  11. // Author:
  12. // Henry Wang (HenryWa) 19-JAN-2000
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #include "Pch.h"
  16. #include "EventProv.h"
  17. #include "EventProv.tmh"
  18. #include "clustergroup.h"
  19. //****************************************************************************
  20. //
  21. // CEventProv
  22. //
  23. //****************************************************************************
  24. //////////////////////////////////////////////////////////////////////////////
  25. //++
  26. //
  27. // CEventProv::CEventProv( void )
  28. //
  29. // Description:
  30. // Constructor.
  31. //
  32. // Arguments:
  33. // None.
  34. //
  35. // Return Values:
  36. // None.
  37. //
  38. //--
  39. //////////////////////////////////////////////////////////////////////////////
  40. CEventProv::CEventProv( void )
  41. : m_pNs( 0 )
  42. , m_pSink( 0 )
  43. , m_cRef( 0 )
  44. , m_pEventAdd( 0 )
  45. , m_pEventRemove( 0 )
  46. , m_pEventState( 0 )
  47. , m_pEventGroupState( 0 )
  48. , m_pEventResourceState( 0 )
  49. , m_pEventProperty( 0 )
  50. , m_hThread( 0 )
  51. , m_esStatus( esPENDING )
  52. {
  53. UINT idx;
  54. for ( idx = 0; idx < EVENT_TABLE_SIZE ; idx++ )
  55. {
  56. m_EventTypeTable[ idx ].m_pwco = NULL;
  57. m_EventTypeTable[ idx ].m_pfn = NULL;
  58. }
  59. InterlockedIncrement( &g_cObj );
  60. } //*** CEventProv::CEventProv()
  61. //////////////////////////////////////////////////////////////////////////////
  62. //++
  63. //
  64. // CEventProv::!CEventProv( void )
  65. //
  66. // Description:
  67. // Destructor.
  68. //
  69. // Arguments:
  70. // None.
  71. //
  72. // Return Values:
  73. // None.
  74. //
  75. //--
  76. //////////////////////////////////////////////////////////////////////////////
  77. CEventProv::~CEventProv( void )
  78. {
  79. InterlockedDecrement( &g_cObj );
  80. if ( m_hThread != NULL )
  81. {
  82. CloseHandle( m_hThread );
  83. }
  84. if ( m_pNs != NULL )
  85. {
  86. m_pNs->Release();
  87. }
  88. if ( m_pSink != NULL )
  89. {
  90. m_pSink->Release();
  91. }
  92. if ( m_pEventAdd != NULL )
  93. {
  94. m_pEventAdd->Release();
  95. }
  96. if ( m_pEventRemove != NULL )
  97. {
  98. m_pEventRemove->Release();
  99. }
  100. if ( m_pEventState != NULL )
  101. {
  102. m_pEventState->Release();
  103. }
  104. if ( m_pEventGroupState != NULL )
  105. {
  106. m_pEventGroupState->Release();
  107. }
  108. if ( m_pEventResourceState != NULL )
  109. {
  110. m_pEventResourceState->Release();
  111. }
  112. if ( m_pEventProperty != NULL )
  113. {
  114. m_pEventProperty->Release();
  115. }
  116. } //*** CEventProv::~CEventProv()
  117. //////////////////////////////////////////////////////////////////////////////
  118. //++
  119. //
  120. // STDMETHODIMP
  121. // CEventProv::QueryInterface(
  122. // REFIID riid,
  123. // LPVOID * ppv
  124. // )
  125. //
  126. // Description:
  127. // Query for interfaces supported by this COM object.
  128. //
  129. // Arguments:
  130. // riid -- Interface being queried for.
  131. // ppv -- Pointer in which to return interface pointer.
  132. //
  133. // Return Values:
  134. // NOERROR
  135. // E_NOINTERFACE
  136. //
  137. //--
  138. //////////////////////////////////////////////////////////////////////////////
  139. STDMETHODIMP
  140. CEventProv::QueryInterface(
  141. REFIID riid,
  142. LPVOID * ppv
  143. )
  144. {
  145. *ppv = 0;
  146. if ( IID_IUnknown == riid || IID_IWbemEventProvider == riid )
  147. {
  148. *ppv = (IWbemEventProvider *) this;
  149. AddRef();
  150. return NOERROR;
  151. }
  152. if ( IID_IWbemProviderInit == riid )
  153. {
  154. *ppv = (IWbemProviderInit *) this;
  155. AddRef();
  156. return NOERROR;
  157. }
  158. return E_NOINTERFACE;
  159. } //*** CEventProv::QueryInterface()
  160. //////////////////////////////////////////////////////////////////////////////
  161. //++
  162. //
  163. // STDMETHODIMP_( ULONG )
  164. // CEventProv::AddRef( void )
  165. //
  166. // Description:
  167. // Add a reference to the COM object.
  168. //
  169. // Arguments:
  170. // None.
  171. //
  172. // Return Values:
  173. // New reference count.
  174. //
  175. //--
  176. //////////////////////////////////////////////////////////////////////////////
  177. STDMETHODIMP_( ULONG )
  178. CEventProv::AddRef( void )
  179. {
  180. return InterlockedIncrement( (LONG *) &m_cRef );
  181. } //*** CEventProv::AddRef()
  182. //////////////////////////////////////////////////////////////////////////////
  183. //++
  184. //
  185. // STDMETHODIMP_( ULONG )
  186. // CEventProv::Release( void )
  187. //
  188. // Description:
  189. // Release a reference on the COM object.
  190. //
  191. // Arguments:
  192. // None.
  193. //
  194. // Return Values:
  195. // New reference count.
  196. //
  197. //--
  198. //////////////////////////////////////////////////////////////////////////////
  199. STDMETHODIMP_( ULONG )
  200. CEventProv::Release( void )
  201. {
  202. LONG cRef = InterlockedDecrement( (LONG *) &m_cRef );
  203. if ( 0L == cRef )
  204. {
  205. m_esStatus = esPENDING_STOP;
  206. CancelIo( m_hChange );
  207. //
  208. // wait for the thread completely stopped
  209. //
  210. while ( ! m_fStopped )
  211. {
  212. Sleep( 100 );
  213. }
  214. delete this;
  215. }
  216. return cRef;
  217. } //*** CEventProv::Release()
  218. //////////////////////////////////////////////////////////////////////////////
  219. //++
  220. //
  221. // HRESULT
  222. // CEventProv::ProvideEvents(
  223. // IWbemObjectSink * pSinkIn,
  224. // long lFlagsIn
  225. // )
  226. //
  227. // Description:
  228. // Start the provider to generate event
  229. // Called by wmi
  230. //
  231. // Arguments:
  232. // pSinkIn -- WMI sink pointer to send event back
  233. // lFlagsIn -- WMI flag
  234. //
  235. // Return Values:
  236. // WBEM_NO_ERROR
  237. //
  238. //--
  239. //////////////////////////////////////////////////////////////////////////////
  240. HRESULT
  241. CEventProv::ProvideEvents(
  242. IWbemObjectSink * pSinkIn,
  243. long lFlagsIn
  244. )
  245. {
  246. // Copy the sink.
  247. // ==============
  248. m_pSink = pSinkIn;
  249. m_pSink->AddRef();
  250. // Create the event thread.
  251. // ========================
  252. DWORD dwTID;
  253. m_hThread = CreateThread(
  254. 0,
  255. 0,
  256. CEventProv::S_EventThread,
  257. this,
  258. 0,
  259. &dwTID
  260. );
  261. // Wait for provider to be 'ready'.
  262. // ================================
  263. while ( m_esStatus != esRUNNING )
  264. {
  265. Sleep( 100 );
  266. }
  267. return WBEM_NO_ERROR;
  268. } //*** CEventProv::ProvideEvents
  269. //////////////////////////////////////////////////////////////////////////////
  270. //++
  271. //
  272. // static
  273. // DWORD
  274. // WINAPI
  275. // CEventProv::S_EventThread(
  276. // LPVOID pArgIn
  277. // )
  278. //
  279. // Description:
  280. // Event thread proc.
  281. //
  282. // Arguments:
  283. // pArgIn --
  284. //
  285. // Return Values:
  286. // Any return values from CEventProv::InstanceThread().
  287. //
  288. //--
  289. //////////////////////////////////////////////////////////////////////////////
  290. DWORD
  291. WINAPI
  292. CEventProv::S_EventThread(
  293. LPVOID pArgIn
  294. )
  295. {
  296. // Make transition to the per-instance method.
  297. // ===========================================
  298. ((CEventProv *) pArgIn)->InstanceThread();
  299. return 0;
  300. } //*** CEventProv::S_EventThread()
  301. //////////////////////////////////////////////////////////////////////////////
  302. //++
  303. //
  304. // void
  305. // CEventProv::InstanceThread( void )
  306. //
  307. // Description:
  308. // This function is started as seperated thread, waiting for cluster
  309. // event notification and then send event back to wmi
  310. //
  311. // Arguments:
  312. // None.
  313. //
  314. // Return Values:
  315. // None.
  316. //
  317. //--
  318. //////////////////////////////////////////////////////////////////////////////
  319. void
  320. CEventProv::InstanceThread( void )
  321. {
  322. SAFECLUSTER shCluster;
  323. //SAFECHANGE shChange;
  324. DWORD dwError;
  325. DWORD_PTR dwpNotifyKey;
  326. DWORD cchName = MAX_PATH;
  327. DWORD dwFilterType;
  328. HRESULT hr = S_OK;
  329. CWstrBuf wsbName;
  330. CError er;
  331. DWORD cchReturnedName;
  332. try
  333. {
  334. m_esStatus = esRUNNING;
  335. m_fStopped = FALSE;
  336. shCluster = OpenCluster( NULL );
  337. m_hChange = CreateClusterNotifyPort(
  338. (HCHANGE) INVALID_HANDLE_VALUE,
  339. shCluster,
  340. ( cntCLUSTER_STATE_CHANGE | cntOBJECT_ADD | cntOBJECT_REMOVE
  341. | cntPROPERTY_CHANGE | cntGROUP_STATE_CHANGE
  342. | cntRESOURCE_STATE_CHANGE ),
  343. 1
  344. );
  345. wsbName.SetSize( cchName );
  346. while ( m_esStatus == esRUNNING )
  347. {
  348. cchReturnedName = cchName;
  349. wsbName.Empty(); // Null out the name field
  350. //TracePrint(("Call GetClusterNotify to get next notification event\n"));
  351. dwError = GetClusterNotify(
  352. m_hChange,
  353. &dwpNotifyKey,
  354. &dwFilterType,
  355. wsbName,
  356. &cchReturnedName,
  357. 400
  358. );
  359. if ( dwError == ERROR_MORE_DATA )
  360. {
  361. cchName = ++cchReturnedName;
  362. wsbName.SetSize( cchName );
  363. dwError = GetClusterNotify(
  364. m_hChange,
  365. &dwpNotifyKey,
  366. &dwFilterType,
  367. wsbName,
  368. &cchReturnedName,
  369. 400
  370. );
  371. } // if: more data
  372. if ( dwError == ERROR_SUCCESS )
  373. {
  374. CWbemClassObject wco;
  375. UINT idx;
  376. DWORD dwType;
  377. SEventTypeTable * pTypeEntry = NULL;
  378. //
  379. // locate table index for the event type
  380. //
  381. dwType = dwFilterType;
  382. for ( idx = 0 ; (idx < EVENT_TABLE_SIZE) && ! ( dwType & 0x01 ) ; idx++ )
  383. {
  384. dwType = dwType >> 1;
  385. }
  386. TracePrint(("Received <%ws> event, ChangeEvent = %!EventIdx!", wsbName, dwFilterType));
  387. pTypeEntry = &m_EventTypeTable[ idx ];
  388. if ( pTypeEntry->m_pwco != NULL )
  389. {
  390. pTypeEntry->m_pwco->SpawnInstance( 0, &wco );
  391. try {
  392. pTypeEntry->m_pfn(
  393. wco,
  394. pTypeEntry->m_pwszMof,
  395. //pwszName,
  396. wsbName,
  397. pTypeEntry->m_eotObjectType,
  398. dwFilterType
  399. );
  400. } // try
  401. catch ( ... )
  402. {
  403. TracePrint((" **** Exception on last Event call\n"));
  404. } // catch
  405. } // if:
  406. er = m_pSink->Indicate( 1, &wco );
  407. } // if: success
  408. } // while: running
  409. } // try
  410. catch( ... )
  411. {
  412. TracePrint(("Exiting event provider loop! %lx\n", m_esStatus));
  413. // bugbug: when error occured, event provider should be shut down,
  414. // the provider should notify wmi and clean up.
  415. // wmi doesn't handle this release call correctly.
  416. m_pSink->Release();
  417. //
  418. // set it to null to provent being released again by destructor
  419. //
  420. m_pSink = NULL;
  421. } // catch
  422. m_fStopped = TRUE;
  423. } //*** CEventProv::InstanceThread()
  424. //////////////////////////////////////////////////////////////////////////////
  425. //++
  426. //
  427. // static
  428. // void
  429. // CEventProv::S_SetEventProperty(
  430. // CWbemClassObject & pwcoInout,
  431. // LPCWSTR pwszMofClassNameIn,
  432. // LPCWSTR pwszObjectNameIn,
  433. // EEventObjectType eotObjectTypeIn,
  434. // DWORD dwEventMinorIn
  435. // )
  436. //
  437. // Description:
  438. // Set an event property.
  439. //
  440. // Arguments:
  441. // pwcoInout --
  442. // pwszMofClassNameIn --
  443. // pwszObjectNameIn --
  444. // eotObjectTypeIn --
  445. // dwEventMinorIn --
  446. //
  447. // Return Values:
  448. // None.
  449. //
  450. //--
  451. //////////////////////////////////////////////////////////////////////////////
  452. void
  453. CEventProv::S_SetEventProperty(
  454. CWbemClassObject & pwcoInout,
  455. LPCWSTR pwszMofClassNameIn,
  456. LPCWSTR pwszObjectNameIn,
  457. EEventObjectType eotObjectTypeIn,
  458. DWORD dwEventMinorIn
  459. )
  460. {
  461. CObjPath op;
  462. TracePrint(("Set event property for <%ws>:<%ws>, Event = %!EventIdx!", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  463. pwcoInout.SetProperty( pwszObjectNameIn, PVD_PROP_EVENT_NAME );
  464. pwcoInout.SetProperty( static_cast< DWORD >( eotObjectTypeIn ), PVD_PROP_EVENT_TYPE );
  465. pwcoInout.SetProperty( static_cast< DWORD >( 0 ), PVD_PROP_EVENT_TYPEMAJOR );
  466. pwcoInout.SetProperty( dwEventMinorIn, PVD_PROP_EVENT_TYPEMINOR );
  467. //
  468. // setting object path
  469. //
  470. if ( ! op.Init( NULL ) )
  471. {
  472. TracePrint((" **** Out of memory! Throwing exception.\n"));
  473. throw WBEM_E_OUT_OF_MEMORY;
  474. }
  475. op.SetClass( pwszMofClassNameIn );
  476. //
  477. // net interface objectpath is different from all the other objects
  478. //
  479. if ( eotObjectTypeIn == eotNET_INTERFACE )
  480. {
  481. SAFECLUSTER shCluster;
  482. SAFENETINTERFACE shNetInterface;
  483. DWORD cbName = MAX_PATH;
  484. CWstrBuf wsbName;
  485. DWORD cbReturn;
  486. CError er;
  487. shCluster = OpenCluster( NULL );
  488. wsbName.SetSize( cbName );
  489. shNetInterface = OpenClusterNetInterface( shCluster, pwszObjectNameIn );
  490. //
  491. // NOTE - I didn't handle error_more_data, since max_path should be
  492. // large enough for node name
  493. //
  494. er = ClusterNetInterfaceControl(
  495. shNetInterface,
  496. NULL,
  497. CLUSCTL_NETINTERFACE_GET_NODE,
  498. NULL,
  499. 0,
  500. wsbName,
  501. cbName,
  502. &cbReturn
  503. );
  504. op.AddProperty( PVD_PROP_NETINTERFACE_SYSTEMNAME, wsbName );
  505. op.AddProperty( PVD_PROP_NETINTERFACE_DEVICEID, pwszObjectNameIn );
  506. } //if: event is net interface
  507. else
  508. {
  509. op.AddProperty( PVD_PROP_NAME, pwszObjectNameIn );
  510. }
  511. pwcoInout.SetProperty(
  512. static_cast< LPCWSTR >( op.GetObjectPathString() ),
  513. PVD_PROP_EVENT_PATH
  514. );
  515. } //*** CEventProv::S_SetEventProperty()
  516. //////////////////////////////////////////////////////////////////////////////
  517. //++
  518. //
  519. // static
  520. // void
  521. // CEventProv::S_AddEvent(
  522. // CWbemClassObject & pwcoInout,
  523. // LPCWSTR pwszMofClassNameIn,
  524. // LPCWSTR pwszObjectNameIn,
  525. // EEventObjectType eotObjectTypeIn,
  526. // DWORD dwEventMinorIn
  527. // )
  528. //
  529. // Description:
  530. // Set an event property.
  531. //
  532. // Arguments:
  533. // pwcoInout --
  534. // pwszMofClassNameIn --
  535. // pwszObjectNameIn --
  536. // eotObjectTypeIn --
  537. // dwEventMinorIn --
  538. //
  539. // Return Values:
  540. // None.
  541. //
  542. //--
  543. //////////////////////////////////////////////////////////////////////////////
  544. void
  545. CEventProv::S_AddEvent(
  546. CWbemClassObject & pwcoInout,
  547. LPCWSTR pwszMofClassNameIn,
  548. LPCWSTR pwszObjectNameIn,
  549. EEventObjectType eotObjectTypeIn,
  550. DWORD dwEventMinorIn
  551. )
  552. {
  553. //CObjPath op;
  554. //SAFECLUSTER shCluster;
  555. switch ( eotObjectTypeIn )
  556. {
  557. case eotGROUP:
  558. {
  559. //SAFEGROUP shGroup;
  560. TracePrint(("Add group event for <%ws>:<%ws>, Event = %!EventIdx!\n", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  561. break;
  562. }
  563. case eotRESOURCE:
  564. {
  565. TracePrint(("Add resource event for <%ws>:<%ws>, Event = %!EventIdx!\n", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  566. break;
  567. }
  568. default:
  569. TracePrint(("Add object event for <%ws>:<%ws>, Event = %!EventIdx!\n", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  570. TracePrint((" **** Unknown Object Type!\n"));
  571. throw WBEM_E_INVALID_PARAMETER;
  572. }
  573. } //*** CEventProv::S_AddEvent()
  574. //////////////////////////////////////////////////////////////////////////////
  575. //++
  576. //
  577. // static
  578. // void
  579. // CEventProv::S_DeleteEvent(
  580. // CWbemClassObject & pwcoInout,
  581. // LPCWSTR pwszMofClassNameIn,
  582. // LPCWSTR pwszObjectNameIn,
  583. // EEventObjectType eotObjectTypeIn,
  584. // DWORD dwEventMinorIn
  585. // )
  586. //
  587. // Description:
  588. // Set an event property.
  589. //
  590. // Arguments:
  591. // pwcoInout --
  592. // pwszMofClassNameIn --
  593. // pwszObjectNameIn --
  594. // eotObjectTypeIn --
  595. // dwEventMinorIn --
  596. //
  597. // Return Values:
  598. // None.
  599. //
  600. //--
  601. //////////////////////////////////////////////////////////////////////////////
  602. void
  603. CEventProv::S_DeleteEvent(
  604. CWbemClassObject & pwcoInout,
  605. LPCWSTR pwszMofClassNameIn,
  606. LPCWSTR pwszObjectNameIn,
  607. EEventObjectType eotObjectTypeIn,
  608. DWORD dwEventMinorIn
  609. )
  610. {
  611. //CObjPath op;
  612. //SAFECLUSTER shCluster;
  613. switch ( eotObjectTypeIn )
  614. {
  615. case eotGROUP:
  616. {
  617. //SAFEGROUP shGroup;
  618. TracePrint(("Delete group event for <%ws>:<%ws>, Event = %!EventIdx!\n", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  619. break;
  620. }
  621. case eotRESOURCE:
  622. {
  623. TracePrint(("Delete resource event for <%ws>:<%ws>, Event = %!EventIdx!\n", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  624. break;
  625. }
  626. default:
  627. TracePrint(("Delete object event for <%ws>:<%ws>, Event = %!EventIdx!\n", pwszMofClassNameIn, pwszObjectNameIn, dwEventMinorIn ));
  628. TracePrint((" **** Unknown Object Type!\n"));
  629. throw WBEM_E_INVALID_PARAMETER;
  630. }
  631. } //*** CEventProv::S_DeleteEvent()
  632. #if 0
  633. //////////////////////////////////////////////////////////////////////////////
  634. //++
  635. //
  636. // static
  637. // void
  638. // CEventProv::S_SetClusterStateProperty(
  639. // CWbemClassObject & pwcoInout,
  640. // LPCWSTR pwszMofClassNameIn,
  641. // LPCWSTR pwszObjectNameIn,
  642. // EEventObjectType eotObjectTypeIn,
  643. // DWORD dwEventMinorIn
  644. // )
  645. //
  646. // Description:
  647. // Set a node state property.
  648. //
  649. // Arguments:
  650. // pwcoInout --
  651. // pwszMofClassNameIn --
  652. // pwszObjectNameIn --
  653. // eotObjectTypeIn --
  654. // dwEventMinorIn --
  655. //
  656. // Return Values:
  657. // None.
  658. //
  659. //--
  660. //////////////////////////////////////////////////////////////////////////////
  661. void
  662. CEventProv::S_SetClusterStateProperty(
  663. CWbemClassObject & pwcoInout,
  664. LPCWSTR pwszMofClassNameIn,
  665. LPCWSTR pwszObjectNameIn,
  666. EEventObjectType eotObjectTypeIn,
  667. DWORD dwEventMinorIn
  668. )
  669. {
  670. DWORD dwState;
  671. DWORD dwError;
  672. dwError = GetNodeClusterState( NULL, &dwState );
  673. if ( dwError != ERROR_SUCCESS )
  674. {
  675. TracePrint((" **** Failed to get the node cluster state. Throwing exception!\n"));
  676. throw CProvException( dwError );
  677. }
  678. pwcoInout.SetProperty( dwState, PVD_PROP_EVENT_NEWSTATE );
  679. S_SetEventProperty(
  680. pwcoInout,
  681. pwszMofClassNameIn,
  682. pwszObjectNameIn,
  683. eotObjectTypeIn,
  684. dwEventMinorIn
  685. );
  686. return;
  687. } //*** CEventProv::S_SetClusterStateProperty()
  688. #endif
  689. //////////////////////////////////////////////////////////////////////////////
  690. //++
  691. //
  692. // static
  693. // void
  694. // CEventProv::S_SetNodeStateProperty(
  695. // CWbemClassObject & pwcoInout,
  696. // LPCWSTR pwszMofClassNameIn,
  697. // LPCWSTR pwszObjectNameIn,
  698. // EEventObjectType eotObjectTypeIn,
  699. // DWORD dwEventMinorIn
  700. // )
  701. //
  702. // Description:
  703. // Set a node state property.
  704. //
  705. // Arguments:
  706. // pwcoInout --
  707. // pwszMofClassNameIn --
  708. // pwszObjectNameIn --
  709. // eotObjectTypeIn --
  710. // dwEventMinorIn --
  711. //
  712. // Return Values:
  713. // None.
  714. //
  715. //--
  716. //////////////////////////////////////////////////////////////////////////////
  717. void
  718. CEventProv::S_SetNodeStateProperty(
  719. CWbemClassObject & pwcoInout,
  720. LPCWSTR pwszMofClassNameIn,
  721. LPCWSTR pwszObjectNameIn,
  722. EEventObjectType eotObjectTypeIn,
  723. DWORD dwEventMinorIn
  724. )
  725. {
  726. SAFECLUSTER shCluster;
  727. SAFENODE shNode;
  728. DWORD dwState;
  729. shCluster = OpenCluster( NULL );
  730. shNode = OpenClusterNode( shCluster, pwszObjectNameIn );
  731. dwState = GetClusterNodeState( shNode );
  732. if ( dwState == ClusterNodeStateUnknown )
  733. {
  734. TracePrint((" **** SetNodeStateProperty... node state unknown. Throwing exception!\n"));
  735. throw CProvException( GetLastError() );
  736. }
  737. pwcoInout.SetProperty( dwState, PVD_PROP_EVENT_NEWSTATE );
  738. S_SetEventProperty(
  739. pwcoInout,
  740. pwszMofClassNameIn,
  741. pwszObjectNameIn,
  742. eotObjectTypeIn,
  743. dwEventMinorIn
  744. );
  745. return;
  746. } //*** CEventProv::S_SetNodeStateProperty()
  747. //////////////////////////////////////////////////////////////////////////////
  748. //++
  749. //
  750. // static
  751. // void
  752. // CEventProv::S_SetNetworkStateProperty(
  753. // CWbemClassObject & pwcoInout,
  754. // LPCWSTR pwszMofClassNameIn,
  755. // LPCWSTR pwszObjectNameIn,
  756. // EEventObjectType eotObjectTypeIn,
  757. // DWORD dwEventMinorIn
  758. // )
  759. //
  760. // Description:
  761. // Set a network state property.
  762. //
  763. // Arguments:
  764. // pwcoInout --
  765. // pwszMofClassNameIn --
  766. // pwszObjectNameIn --
  767. // eotObjectTypeIn --
  768. // dwEventMinorIn --
  769. //
  770. // Return Values:
  771. // None.
  772. //
  773. //--
  774. //////////////////////////////////////////////////////////////////////////////
  775. void
  776. CEventProv::S_SetNetworkStateProperty(
  777. CWbemClassObject & pwcoInout,
  778. LPCWSTR pwszMofClassNameIn,
  779. LPCWSTR pwszObjectNameIn,
  780. EEventObjectType eotObjectTypeIn,
  781. DWORD dwEventMinorIn
  782. )
  783. {
  784. SAFECLUSTER shCluster;
  785. SAFENETWORK shNetwork;
  786. DWORD dwState;
  787. shCluster = OpenCluster( NULL );
  788. shNetwork = OpenClusterNetwork( shCluster, pwszObjectNameIn );
  789. dwState = GetClusterNetworkState( shNetwork );
  790. if ( dwState == ClusterNetworkStateUnknown )
  791. {
  792. TracePrint((" **** SetNetworkStateProperty... network state unknown. Throwing exception!\n"));
  793. throw CProvException( GetLastError() );
  794. }
  795. pwcoInout.SetProperty( dwState, PVD_PROP_EVENT_NEWSTATE );
  796. S_SetEventProperty(
  797. pwcoInout,
  798. pwszMofClassNameIn,
  799. pwszObjectNameIn,
  800. eotObjectTypeIn,
  801. dwEventMinorIn
  802. );
  803. return;
  804. } //*** CEventProv::S_SetNetworkStateProperty()
  805. //////////////////////////////////////////////////////////////////////////////
  806. //++
  807. //
  808. // static
  809. // void
  810. // CEventProv::S_SetNetInterfaceStateProperty(
  811. // CWbemClassObject & pwcoInout,
  812. // LPCWSTR pwszMofClassNameIn,
  813. // LPCWSTR pwszObjectNameIn,
  814. // EEventObjectType eotObjectTypeIn,
  815. // DWORD dwEventMinorIn
  816. // )
  817. //
  818. // Description:
  819. // Set a network interface state property.
  820. //
  821. // Arguments:
  822. // pwcoInout --
  823. // pwszMofClassNameIn --
  824. // pwszObjectNameIn --
  825. // eotObjectTypeIn --
  826. // dwEventMinorIn --
  827. //
  828. // Return Values:
  829. // None.
  830. //
  831. //--
  832. //////////////////////////////////////////////////////////////////////////////
  833. void
  834. CEventProv::S_SetNetInterfaceStateProperty(
  835. CWbemClassObject & pwcoInout,
  836. LPCWSTR pwszMofClassNameIn,
  837. LPCWSTR pwszObjectNameIn,
  838. EEventObjectType eotObjectTypeIn,
  839. DWORD dwEventMinorIn
  840. )
  841. {
  842. SAFECLUSTER shCluster;
  843. SAFENETINTERFACE shNetInterface;
  844. DWORD dwState;
  845. shCluster = OpenCluster( NULL );
  846. shNetInterface = OpenClusterNetInterface( shCluster, pwszObjectNameIn );
  847. dwState = GetClusterNetInterfaceState( shNetInterface );
  848. if ( dwState == ClusterNetInterfaceStateUnknown )
  849. {
  850. TracePrint((" **** SetNetInterfaceStateProperty... network interface state unknown. Throwing exception!\n"));
  851. throw CProvException( GetLastError() );
  852. }
  853. pwcoInout.SetProperty( dwState, PVD_PROP_EVENT_NEWSTATE );
  854. S_SetEventProperty(
  855. pwcoInout,
  856. pwszMofClassNameIn,
  857. pwszObjectNameIn,
  858. eotObjectTypeIn,
  859. dwEventMinorIn
  860. );
  861. return;
  862. } //*** CEventProv::S_SetNetInterfaceStateProperty()
  863. //////////////////////////////////////////////////////////////////////////////
  864. //++
  865. //
  866. // static
  867. // void
  868. // CEventProv::S_SetGroupStateProperty(
  869. // CWbemClassObject & pwcoInout,
  870. // LPCWSTR pwszMofClassNameIn,
  871. // LPCWSTR pwszObjectNameIn,
  872. // EEventObjectType eotObjectTypeIn,
  873. // DWORD dwEventMinorIn
  874. // )
  875. //
  876. // Description:
  877. // Set a group state property.
  878. //
  879. // Arguments:
  880. // pwcoInout --
  881. // pwszMofClassNameIn --
  882. // pwszObjectNameIn --
  883. // eotObjectTypeIn --
  884. // dwEventMinorIn --
  885. //
  886. // Return Values:
  887. // None.
  888. //
  889. //--
  890. //////////////////////////////////////////////////////////////////////////////
  891. void
  892. CEventProv::S_SetGroupStateProperty(
  893. CWbemClassObject & pwcoInout,
  894. LPCWSTR pwszMofClassNameIn,
  895. LPCWSTR pwszObjectNameIn,
  896. EEventObjectType eotObjectTypeIn,
  897. DWORD dwEventMinorIn
  898. )
  899. {
  900. SAFECLUSTER shCluster;
  901. SAFEGROUP shGroup;
  902. DWORD dwState;
  903. DWORD cchName = MAX_PATH;
  904. CWstrBuf wsbNodeName;
  905. wsbNodeName.SetSize( cchName );
  906. shCluster = OpenCluster( NULL );
  907. shGroup = OpenClusterGroup( shCluster, pwszObjectNameIn );
  908. dwState = GetClusterGroupState( shGroup, wsbNodeName, &cchName );
  909. if ( dwState == ClusterGroupStateUnknown )
  910. {
  911. //
  912. // BUGBUG I am not handling error_more_data here, since it's not possible that
  913. // nodeName exceed MAX_PATH, assuming it use netbios name
  914. //
  915. TracePrint(("ClusterGroup State is UNKNOWN. Throwing exception!\n"));
  916. throw CProvException( GetLastError() );
  917. } else {
  918. TracePrint(("Setting group state for group <%ws> to %!GroupState!\n", pwszObjectNameIn, dwState ));
  919. pwcoInout.SetProperty( dwState, PVD_PROP_EVENT_NEWSTATE );
  920. pwcoInout.SetProperty( wsbNodeName, PVD_PROP_EVENT_NODE );
  921. }
  922. S_SetEventProperty(
  923. pwcoInout,
  924. pwszMofClassNameIn,
  925. pwszObjectNameIn,
  926. eotObjectTypeIn,
  927. dwEventMinorIn
  928. );
  929. return;
  930. } //*** CEventProv::S_SetGroupStateProperty()
  931. //////////////////////////////////////////////////////////////////////////////
  932. //++
  933. //
  934. // static
  935. // void
  936. // CEventProv::S_SetResourceStateProperty(
  937. // CWbemClassObject & pwcoInout,
  938. // LPCWSTR pwszMofClassNameIn,
  939. // LPCWSTR pwszObjectNameIn,
  940. // EEventObjectType eotObjectTypeIn,
  941. // DWORD dwEventMinorIn
  942. // )
  943. //
  944. // Description:
  945. // Set a resource state property.
  946. //
  947. // Arguments:
  948. // pwcoInout --
  949. // pwszMofClassNameIn --
  950. // pwszObjectNameIn --
  951. // eotObjectTypeIn --
  952. // dwEventMinorIn --
  953. //
  954. // Return Values:
  955. // None.
  956. //
  957. //--
  958. //////////////////////////////////////////////////////////////////////////////
  959. void
  960. CEventProv::S_SetResourceStateProperty(
  961. CWbemClassObject & pwcoInout,
  962. LPCWSTR pwszMofClassNameIn,
  963. LPCWSTR pwszObjectNameIn,
  964. EEventObjectType eotObjectTypeIn,
  965. DWORD dwEventMinorIn
  966. )
  967. {
  968. SAFECLUSTER shCluster;
  969. SAFERESOURCE shResource;
  970. DWORD dwState;
  971. DWORD cchNodeName = MAX_PATH;
  972. CWstrBuf wsbNodeName;
  973. DWORD cchGroupName = MAX_PATH;
  974. CWstrBuf wsbGroupName;
  975. DWORD dwError;
  976. shCluster = OpenCluster( NULL );
  977. wsbNodeName.SetSize( cchNodeName );
  978. wsbGroupName.SetSize( cchGroupName );
  979. shResource = OpenClusterResource( shCluster, pwszObjectNameIn );
  980. if ( !shResource.BIsNULL() ) {
  981. dwState = GetClusterResourceState(
  982. shResource,
  983. wsbNodeName,
  984. &cchNodeName,
  985. wsbGroupName,
  986. &cchGroupName
  987. );
  988. } else {
  989. dwState = ClusterResourceStateUnknown;
  990. }
  991. TracePrint(("Setting resource state for resource <%ws> to %!ResourceState!\n", pwszObjectNameIn, dwState ));
  992. pwcoInout.SetProperty( dwState, PVD_PROP_EVENT_NEWSTATE );
  993. pwcoInout.SetProperty( wsbNodeName, PVD_PROP_EVENT_NODE );
  994. pwcoInout.SetProperty( wsbGroupName, PVD_PROP_EVENT_GROUP );
  995. S_SetEventProperty(
  996. pwcoInout,
  997. pwszMofClassNameIn,
  998. pwszObjectNameIn,
  999. eotObjectTypeIn,
  1000. dwEventMinorIn
  1001. );
  1002. return;
  1003. } //*** CEventProv::S_SetResourceStateProperty()
  1004. //////////////////////////////////////////////////////////////////////////////
  1005. //++
  1006. //
  1007. // void
  1008. // CEventProv::InsertTable(
  1009. // DWORD dwIdxIn,
  1010. // CLUSTER_CHANGE eTypeIn,
  1011. // EEventObjectType eotObjectTypeIn,
  1012. // LPCWSTR pwszMofIn,
  1013. // IWbemClassObject * pwcoIn,
  1014. // FPSETPROP pfnIn
  1015. // )
  1016. //
  1017. // Description:
  1018. // Insert values in the event table.
  1019. //
  1020. // Arguments:
  1021. // dwIdxIn --
  1022. // eTypeIn --
  1023. // eotObjectTypeIn --
  1024. // pwszMofIn --
  1025. // pwcoIn --
  1026. // pfnIn --
  1027. //
  1028. // Return Values:
  1029. // None.
  1030. //
  1031. //--
  1032. //////////////////////////////////////////////////////////////////////////////
  1033. void
  1034. CEventProv::InsertTable(
  1035. DWORD dwIdxIn,
  1036. CLUSTER_CHANGE eTypeIn,
  1037. EEventObjectType eotObjectTypeIn,
  1038. LPCWSTR pwszMofIn,
  1039. IWbemClassObject * pwcoIn,
  1040. FPSETPROP pfnIn
  1041. )
  1042. {
  1043. m_EventTypeTable[ dwIdxIn ].m_eType = eTypeIn;
  1044. m_EventTypeTable[ dwIdxIn ].m_eotObjectType = eotObjectTypeIn;
  1045. m_EventTypeTable[ dwIdxIn ].m_pwszMof = pwszMofIn;
  1046. m_EventTypeTable[ dwIdxIn ].m_pwco = pwcoIn;
  1047. m_EventTypeTable[ dwIdxIn ].m_pfn= pfnIn;
  1048. return;
  1049. } //*** CEventProv::InsertTable()
  1050. //////////////////////////////////////////////////////////////////////////////
  1051. //++
  1052. //
  1053. // HRESULT
  1054. // CEventProv::Initialize(
  1055. // LPWSTR pwszUserIn,
  1056. // LONG lFlagsIn,
  1057. // LPWSTR pwszNamespaceIn,
  1058. // LPWSTR pwszLocaleIn,
  1059. // IWbemServices * pNamespaceIn,
  1060. // IWbemContext * pCtxIn,
  1061. // IWbemProviderInitSink * pInitSinkIn
  1062. // )
  1063. //
  1064. // Description:
  1065. // Initializing the provider by setting up a lookup table.
  1066. // called by wmi only once to create provider object.
  1067. //
  1068. // Arguments:
  1069. // pwszUserIn -- User name
  1070. // lFlagsIn -- WMI flag
  1071. // pwszNamespaceIn -- Name space
  1072. // pwszLocaleIn -- Locale string
  1073. // pCtxIn -- WMI context
  1074. // pInitSinkIn -- WMI sink pointer
  1075. //
  1076. // Return Values:
  1077. // WBEM_NO_ERROR
  1078. // WBEM_E_FAILED
  1079. //
  1080. //--
  1081. //////////////////////////////////////////////////////////////////////////////
  1082. HRESULT
  1083. CEventProv::Initialize(
  1084. LPWSTR pwszUserIn,
  1085. LONG lFlagsIn,
  1086. LPWSTR pwszNamespaceIn,
  1087. LPWSTR pwszLocaleIn,
  1088. IWbemServices * pNamespaceIn,
  1089. IWbemContext * pCtxIn,
  1090. IWbemProviderInitSink * pInitSinkIn
  1091. )
  1092. {
  1093. HRESULT hr = WBEM_S_INITIALIZED;
  1094. CError er;
  1095. m_pNs = pNamespaceIn;
  1096. m_pNs->AddRef();
  1097. //
  1098. // Grab the class definition for the event.
  1099. //
  1100. try
  1101. {
  1102. er = m_pNs->GetObject(
  1103. _bstr_t( PVD_CLASS_EVENT_ADD ),
  1104. 0,
  1105. pCtxIn,
  1106. &m_pEventAdd,
  1107. 0
  1108. );
  1109. er = m_pNs->GetObject(
  1110. _bstr_t( PVD_CLASS_EVENT_REMOVE ),
  1111. 0,
  1112. pCtxIn,
  1113. &m_pEventRemove,
  1114. 0
  1115. );
  1116. er = m_pNs->GetObject(
  1117. _bstr_t( PVD_CLASS_EVENT_STATECHANGE ),
  1118. 0,
  1119. pCtxIn,
  1120. &m_pEventState,
  1121. 0
  1122. );
  1123. er = m_pNs->GetObject(
  1124. _bstr_t( PVD_CLASS_EVENT_GROUPSTATECHANGE ),
  1125. 0,
  1126. pCtxIn,
  1127. &m_pEventGroupState,
  1128. 0
  1129. );
  1130. er = m_pNs->GetObject(
  1131. _bstr_t( PVD_CLASS_EVENT_RESOURCESTATECHANGE ),
  1132. 0,
  1133. pCtxIn,
  1134. &m_pEventResourceState,
  1135. 0
  1136. );
  1137. #if 0
  1138. er = m_pNs->GetObject(
  1139. _bstr_t( PVD_CLASS_EVENT_NODESTATECHANGE ),
  1140. 0,
  1141. pCtxIn,
  1142. &m_pEventNodeState,
  1143. 0
  1144. );
  1145. #endif
  1146. er = m_pNs->GetObject(
  1147. _bstr_t( PVD_CLASS_EVENT_PROP ),
  1148. 0,
  1149. pCtxIn,
  1150. &m_pEventProperty,
  1151. 0
  1152. );
  1153. //
  1154. // initialize mapping table
  1155. //
  1156. //
  1157. // node events
  1158. //
  1159. InsertTable(
  1160. 0,
  1161. CLUSTER_CHANGE_NODE_STATE,
  1162. eotNODE,
  1163. PVD_CLASS_NODE,
  1164. m_pEventState,
  1165. S_SetNodeStateProperty
  1166. );
  1167. InsertTable(
  1168. 1,
  1169. CLUSTER_CHANGE_NODE_DELETED,
  1170. eotNODE,
  1171. PVD_CLASS_NODE,
  1172. m_pEventRemove,
  1173. S_SetEventProperty
  1174. );
  1175. InsertTable(
  1176. 2,
  1177. CLUSTER_CHANGE_NODE_ADDED,
  1178. eotNODE,
  1179. PVD_CLASS_NODE,
  1180. m_pEventAdd,
  1181. S_SetEventProperty
  1182. );
  1183. InsertTable(
  1184. 3,
  1185. CLUSTER_CHANGE_NODE_PROPERTY,
  1186. eotNODE,
  1187. PVD_CLASS_NODE,
  1188. m_pEventProperty,
  1189. S_SetEventProperty
  1190. );
  1191. //
  1192. // registry event, don't care
  1193. //
  1194. //
  1195. // Resource
  1196. //
  1197. InsertTable(
  1198. 8,
  1199. CLUSTER_CHANGE_RESOURCE_STATE,
  1200. eotRESOURCE,
  1201. PVD_CLASS_RESOURCE,
  1202. m_pEventResourceState,
  1203. S_SetResourceStateProperty
  1204. );
  1205. InsertTable(
  1206. 9,
  1207. CLUSTER_CHANGE_RESOURCE_DELETED,
  1208. eotRESOURCE,
  1209. PVD_CLASS_RESOURCE,
  1210. m_pEventRemove,
  1211. S_DeleteEvent
  1212. );
  1213. InsertTable(
  1214. 10,
  1215. CLUSTER_CHANGE_RESOURCE_ADDED,
  1216. eotRESOURCE,
  1217. PVD_CLASS_RESOURCE,
  1218. m_pEventAdd,
  1219. S_AddEvent
  1220. );
  1221. InsertTable(
  1222. 11,
  1223. CLUSTER_CHANGE_RESOURCE_PROPERTY,
  1224. eotRESOURCE,
  1225. PVD_CLASS_RESOURCE,
  1226. m_pEventProperty,
  1227. S_SetEventProperty
  1228. );
  1229. //
  1230. // group
  1231. //
  1232. InsertTable(
  1233. 12,
  1234. CLUSTER_CHANGE_GROUP_STATE,
  1235. eotGROUP,
  1236. PVD_CLASS_GROUP,
  1237. m_pEventGroupState,
  1238. S_SetGroupStateProperty
  1239. );
  1240. InsertTable(
  1241. 13,
  1242. CLUSTER_CHANGE_GROUP_DELETED,
  1243. eotGROUP,
  1244. PVD_CLASS_GROUP,
  1245. m_pEventRemove,
  1246. S_DeleteEvent
  1247. );
  1248. InsertTable(
  1249. 14,
  1250. CLUSTER_CHANGE_GROUP_ADDED,
  1251. eotGROUP,
  1252. PVD_CLASS_GROUP,
  1253. m_pEventAdd,
  1254. S_AddEvent
  1255. );
  1256. InsertTable(
  1257. 15,
  1258. CLUSTER_CHANGE_GROUP_PROPERTY,
  1259. eotGROUP,
  1260. PVD_CLASS_GROUP,
  1261. m_pEventProperty,
  1262. S_SetEventProperty
  1263. );
  1264. //
  1265. // Resource Type
  1266. //
  1267. InsertTable(
  1268. 16,
  1269. CLUSTER_CHANGE_RESOURCE_TYPE_DELETED,
  1270. eotRESOURCE_TYPE,
  1271. PVD_CLASS_RESOURCETYPE,
  1272. m_pEventRemove,
  1273. S_SetEventProperty
  1274. );
  1275. InsertTable(
  1276. 17,
  1277. CLUSTER_CHANGE_RESOURCE_TYPE_ADDED,
  1278. eotRESOURCE_TYPE,
  1279. PVD_CLASS_RESOURCETYPE,
  1280. m_pEventAdd,
  1281. S_SetEventProperty
  1282. );
  1283. InsertTable(
  1284. 18,
  1285. CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY,
  1286. eotRESOURCE_TYPE,
  1287. PVD_CLASS_RESOURCETYPE,
  1288. m_pEventProperty,
  1289. S_SetEventProperty
  1290. );
  1291. //
  1292. // skip 19 - CLUSTER_CHANGE_CLUSTER_RECONNECT
  1293. //
  1294. //
  1295. // network
  1296. //
  1297. InsertTable(
  1298. 20,
  1299. CLUSTER_CHANGE_NETWORK_STATE,
  1300. eotNETWORK,
  1301. PVD_CLASS_NETWORKS,
  1302. m_pEventState,
  1303. S_SetNetworkStateProperty
  1304. );
  1305. InsertTable(
  1306. 21,
  1307. CLUSTER_CHANGE_NETWORK_DELETED,
  1308. eotNETWORK,
  1309. PVD_CLASS_NETWORKS,
  1310. m_pEventRemove,
  1311. S_SetEventProperty
  1312. );
  1313. InsertTable(
  1314. 22,
  1315. CLUSTER_CHANGE_NETWORK_ADDED,
  1316. eotNETWORK,
  1317. PVD_CLASS_NETWORKS,
  1318. m_pEventAdd,
  1319. S_SetEventProperty
  1320. );
  1321. InsertTable(
  1322. 23,
  1323. CLUSTER_CHANGE_NETWORK_PROPERTY,
  1324. eotNETWORK,
  1325. PVD_CLASS_NETWORKS,
  1326. m_pEventProperty,
  1327. S_SetEventProperty
  1328. );
  1329. //
  1330. // net interface
  1331. //
  1332. InsertTable(
  1333. 24,
  1334. CLUSTER_CHANGE_NETINTERFACE_STATE,
  1335. eotNET_INTERFACE,
  1336. PVD_CLASS_NETWORKSINTERFACE,
  1337. m_pEventState,
  1338. S_SetNetInterfaceStateProperty
  1339. );
  1340. InsertTable(
  1341. 25,
  1342. CLUSTER_CHANGE_NETINTERFACE_DELETED,
  1343. eotNET_INTERFACE,
  1344. PVD_CLASS_NETWORKSINTERFACE,
  1345. m_pEventRemove,
  1346. S_SetEventProperty
  1347. );
  1348. InsertTable(
  1349. 26,
  1350. CLUSTER_CHANGE_NETINTERFACE_ADDED,
  1351. eotNET_INTERFACE,
  1352. PVD_CLASS_NETWORKSINTERFACE,
  1353. m_pEventAdd,
  1354. S_SetEventProperty
  1355. );
  1356. InsertTable(
  1357. 27,
  1358. CLUSTER_CHANGE_NETINTERFACE_PROPERTY,
  1359. eotNET_INTERFACE,
  1360. PVD_CLASS_NETWORKSINTERFACE,
  1361. m_pEventProperty,
  1362. S_SetEventProperty
  1363. );
  1364. //
  1365. // other
  1366. //
  1367. InsertTable(
  1368. 28,
  1369. CLUSTER_CHANGE_QUORUM_STATE,
  1370. eotQUORUM,
  1371. PVD_CLASS_RESOURCE,
  1372. m_pEventState,
  1373. S_SetResourceStateProperty
  1374. );
  1375. /* InsertTable(
  1376. 29,
  1377. CLUSTER_CHANGE_CLUSTER_STATE,
  1378. eotCLUSTER,
  1379. PVD_CLASS_CLUSTER,
  1380. m_pEventState,
  1381. S_SetClusterStateProperty );
  1382. */
  1383. InsertTable(
  1384. 30,
  1385. CLUSTER_CHANGE_CLUSTER_PROPERTY,
  1386. eotCLUSTER,
  1387. PVD_CLASS_CLUSTER,
  1388. m_pEventProperty,
  1389. S_SetEventProperty
  1390. );
  1391. //
  1392. // skip 31 - CLUSTER_CHANGE_HANDLE_CLOSE
  1393. //
  1394. } // try
  1395. catch ( ... )
  1396. {
  1397. hr = WBEM_E_FAILED;
  1398. } // catch
  1399. // Tell CIMOM that we're up and running.
  1400. // =====================================
  1401. pInitSinkIn->SetStatus( hr, 0 );
  1402. return WBEM_NO_ERROR;
  1403. } //*** CEventProv::Initialize()
  1404. //////////////////////////////////////////////////////////////////////////////
  1405. //++
  1406. //
  1407. // static
  1408. // HRESULT
  1409. // CEventProv::S_HrCreateThis(
  1410. // IUnknown * pUnknownOuterIn,
  1411. // VOID ** ppvOut
  1412. // )
  1413. //
  1414. // Description:
  1415. // Create a CEventProv object.
  1416. //
  1417. // Arguments:
  1418. // pUnknownOutIn --
  1419. // ppvOut --
  1420. //
  1421. // Return Values:
  1422. // S_OK
  1423. //
  1424. //--
  1425. //////////////////////////////////////////////////////////////////////////////
  1426. HRESULT
  1427. CEventProv::S_HrCreateThis(
  1428. IUnknown * pUnknownOuterIn,
  1429. VOID ** ppvOut
  1430. )
  1431. {
  1432. *ppvOut = new CEventProv();
  1433. return S_OK;
  1434. } //*** CEventProv::S_HrCreateThis()