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.

1679 lines
45 KiB

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