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.

894 lines
21 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // VssClasses.h
  7. //
  8. // Implementation File:
  9. // VssClasses.cpp
  10. //
  11. // Description:
  12. // Definition of the VSS WMI Provider classes.
  13. //
  14. // Author: Jim Benton (jbenton) 15-Nov-2001
  15. //
  16. // Notes:
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. #pragma once
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Include Files
  22. //////////////////////////////////////////////////////////////////////////////
  23. #include "ProvBase.h"
  24. HRESULT
  25. GetShadowPropertyStruct(
  26. IN IVssCoordinator* pCoord,
  27. IN WCHAR* pwszShadowID,
  28. OUT VSS_SNAPSHOT_PROP* pPropSnap
  29. );
  30. BOOL
  31. StringGuidIsGuid(
  32. IN WCHAR* pwszGuid,
  33. IN GUID& guidIn
  34. );
  35. //////////////////////////////////////////////////////////////////////////////
  36. //++
  37. //
  38. // class CProvider
  39. //
  40. // Description:
  41. // Provider Implementation for Provider
  42. //
  43. //--
  44. //////////////////////////////////////////////////////////////////////////////
  45. class CProvider : public CProvBase
  46. {
  47. //
  48. // constructor
  49. //
  50. public:
  51. CProvider(
  52. LPCWSTR pwszNameIn,
  53. CWbemServices* pNamespaceIn
  54. );
  55. ~CProvider(){}
  56. //
  57. // methods
  58. //
  59. public:
  60. virtual HRESULT EnumInstance(
  61. long lFlagsIn,
  62. IWbemContext* pCtxIn,
  63. IWbemObjectSink* pHandlerIn
  64. );
  65. virtual HRESULT GetObject(
  66. CObjPath& rObjPathIn,
  67. long lFlagsIn,
  68. IWbemContext* pCtxIn,
  69. IWbemObjectSink* pHandlerIn
  70. );
  71. virtual HRESULT ExecuteMethod(
  72. BSTR bstrObjPathIn,
  73. WCHAR* pwszMethodNameIn,
  74. long lFlagIn,
  75. IWbemClassObject* pParamsIn,
  76. IWbemObjectSink* pHandlerIn
  77. ) { return WBEM_E_NOT_SUPPORTED; };
  78. virtual HRESULT PutInstance(
  79. CWbemClassObject& rInstToPutIn,
  80. long lFlagIn,
  81. IWbemContext* pCtxIn,
  82. IWbemObjectSink* pHandlerIn
  83. ) { return WBEM_E_NOT_SUPPORTED; };
  84. virtual HRESULT DeleteInstance(
  85. CObjPath& rObjPathIn,
  86. long lFlagIn,
  87. IWbemContext* pCtxIn,
  88. IWbemObjectSink* pHandlerIn
  89. ) { return WBEM_E_NOT_SUPPORTED; };
  90. static CProvBase* S_CreateThis(
  91. LPCWSTR pwszNameIn,
  92. CWbemServices* pNamespaceIn
  93. );
  94. HRESULT Initialize()
  95. {
  96. HRESULT hr = S_OK;
  97. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  98. return hr;
  99. }
  100. private:
  101. CComPtr<IVssCoordinator> m_spCoord;
  102. void LoadInstance(
  103. IN VSS_PROVIDER_PROP* pProp,
  104. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  105. }; // class CProvider
  106. #ifdef ENABLE_WRITERS
  107. //////////////////////////////////////////////////////////////////////////////
  108. //++
  109. //
  110. // class CWriter
  111. //
  112. // Description:
  113. // Provider Implementation for Writer
  114. //
  115. //--
  116. //////////////////////////////////////////////////////////////////////////////
  117. class CWriter : public CProvBase
  118. {
  119. //
  120. // constructor
  121. //
  122. public:
  123. CWriter(
  124. LPCWSTR pwszNameIn,
  125. CWbemServices* pNamespaceIn
  126. );
  127. ~CWriter(){}
  128. //
  129. // methods
  130. //
  131. public:
  132. virtual HRESULT EnumInstance(
  133. long lFlagsIn,
  134. IWbemContext* pCtxIn,
  135. IWbemObjectSink* pHandlerIn
  136. );
  137. virtual HRESULT GetObject(
  138. CObjPath & rObjPathIn,
  139. long lFlagsIn,
  140. IWbemContext* pCtxIn,
  141. IWbemObjectSink* pHandlerIn
  142. );
  143. virtual HRESULT ExecuteMethod(
  144. BSTR bstrObjPathIn,
  145. WCHAR* pwszMethodNameIn,
  146. long lFlagIn,
  147. IWbemClassObject* pParamsIn,
  148. IWbemObjectSink* pHandlerIn
  149. ) { return WBEM_E_NOT_SUPPORTED; };
  150. virtual HRESULT PutInstance(
  151. CWbemClassObject& rInstToPutIn,
  152. long lFlagIn,
  153. IWbemContext* pCtxIn,
  154. IWbemObjectSink* pHandlerIn
  155. ) { return WBEM_E_NOT_SUPPORTED; };
  156. virtual HRESULT DeleteInstance(
  157. CObjPath& rObjPathIn,
  158. long lFlagIn,
  159. IWbemContext* pCtxIn,
  160. IWbemObjectSink* pHandlerIn
  161. ) { return WBEM_E_NOT_SUPPORTED; };
  162. static CProvBase* S_CreateThis(
  163. LPCWSTR pwszNameIn,
  164. CWbemServices* pNamespaceIn
  165. );
  166. HRESULT Initialize()
  167. {
  168. return S_OK;
  169. }
  170. }; // class CWriter
  171. #endif // ENABLE_WRITERS
  172. //////////////////////////////////////////////////////////////////////////////
  173. //++
  174. //
  175. // class CShadow
  176. //
  177. // Description:
  178. // Provider Implementation for Shadow
  179. //
  180. //--
  181. //////////////////////////////////////////////////////////////////////////////
  182. class CShadow : public CProvBase
  183. {
  184. //
  185. // constructor
  186. //
  187. public:
  188. CShadow(
  189. LPCWSTR pwszNameIn,
  190. CWbemServices* pNamespaceIn
  191. );
  192. ~CShadow(){}
  193. //
  194. // methods
  195. //
  196. public:
  197. virtual HRESULT EnumInstance(
  198. long lFlagsIn,
  199. IWbemContext* pCtxIn,
  200. IWbemObjectSink* pHandlerIn
  201. );
  202. virtual HRESULT GetObject(
  203. CObjPath& rObjPathIn,
  204. long lFlagsIn,
  205. IWbemContext* pCtxIn,
  206. IWbemObjectSink* pHandlerIn
  207. );
  208. virtual HRESULT ExecuteMethod(
  209. BSTR bstrObjPathIn,
  210. WCHAR* pwszMethodNameIn,
  211. long lFlagIn,
  212. IWbemClassObject* pParamsIn,
  213. IWbemObjectSink* pHandlerIn
  214. );
  215. virtual HRESULT PutInstance(
  216. CWbemClassObject& rInstToPutIn,
  217. long lFlagIn,
  218. IWbemContext* pCtxIn,
  219. IWbemObjectSink* pHandlerIn
  220. ) { return WBEM_E_NOT_SUPPORTED; };
  221. virtual HRESULT DeleteInstance(
  222. CObjPath& rObjPathIn,
  223. long lFlagIn,
  224. IWbemContext* pCtxIn,
  225. IWbemObjectSink* pHandlerIn
  226. );
  227. static CProvBase* S_CreateThis(
  228. IN LPCWSTR pwszName,
  229. IN CWbemServices* pNamespace
  230. );
  231. HRESULT Initialize()
  232. {
  233. HRESULT hr = S_OK;
  234. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  235. return hr;
  236. }
  237. private:
  238. CComPtr<IVssCoordinator> m_spCoord;
  239. void LoadInstance(
  240. IN VSS_SNAPSHOT_PROP* pProp,
  241. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  242. HRESULT Create(
  243. IN BSTR bstrContext,
  244. IN BSTR bstrVolume,
  245. OUT VSS_ID* pidShadow
  246. ) throw(HRESULT);
  247. void CreateMapStatus(
  248. IN HRESULT hr,
  249. OUT DWORD& rc
  250. );
  251. }; // class CShadow
  252. //////////////////////////////////////////////////////////////////////////////
  253. //++
  254. //
  255. // class CStorage
  256. //
  257. // Description:
  258. // Provider Implementation for Storage
  259. //
  260. //--
  261. //////////////////////////////////////////////////////////////////////////////
  262. class CStorage : public CProvBase
  263. {
  264. //
  265. // constructor
  266. //
  267. public:
  268. CStorage(
  269. LPCWSTR pwszNameIn,
  270. CWbemServices* pNamespaceIn
  271. );
  272. ~CStorage(){}
  273. //
  274. // methods
  275. //
  276. public:
  277. virtual HRESULT EnumInstance(
  278. long lFlagsIn,
  279. IWbemContext* pCtxIn,
  280. IWbemObjectSink* pHandlerIn
  281. );
  282. virtual HRESULT GetObject(
  283. CObjPath& rObjPathIn,
  284. long lFlagsIn,
  285. IWbemContext* pCtxIn,
  286. IWbemObjectSink* pHandlerIn
  287. );
  288. virtual HRESULT ExecuteMethod(
  289. BSTR bstrObjPathIn,
  290. WCHAR* pwszMethodNameIn,
  291. long lFlagIn,
  292. IWbemClassObject* pParamsIn,
  293. IWbemObjectSink* pHandlerIn
  294. );
  295. virtual HRESULT PutInstance(
  296. CWbemClassObject& rInstToPutIn,
  297. long lFlagIn,
  298. IWbemContext* pCtxIn,
  299. IWbemObjectSink* pHandlerIn
  300. );
  301. virtual HRESULT DeleteInstance(
  302. CObjPath& rObjPathIn,
  303. long lFlagIn,
  304. IWbemContext* pCtxIn,
  305. IWbemObjectSink* pHandlerIn
  306. );
  307. static CProvBase* S_CreateThis(
  308. LPCWSTR pwszNameIn,
  309. CWbemServices* pNamespaceIn
  310. );
  311. HRESULT Initialize()
  312. {
  313. HRESULT hr = S_OK;
  314. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  315. return hr;
  316. }
  317. private:
  318. CComPtr<IVssCoordinator> m_spCoord;
  319. void LoadInstance(
  320. IN VSS_DIFF_AREA_PROP* pProp,
  321. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  322. void SelectDiffAreaProvider(
  323. OUT GUID* pProviderID
  324. );
  325. HRESULT Create(
  326. IN BSTR bstrVolume,
  327. IN BSTR bstrDiffVolume,
  328. IN LONGLONG llMaxSpace
  329. ) throw(HRESULT);
  330. void CreateMapStatus(
  331. IN HRESULT hr,
  332. OUT DWORD& rc
  333. );
  334. }; // class CStorage
  335. //////////////////////////////////////////////////////////////////////////////
  336. //++
  337. //
  338. // class CShadowFor
  339. //
  340. // Description:
  341. // Provider Implementation for ShadowFor
  342. //
  343. //--
  344. //////////////////////////////////////////////////////////////////////////////
  345. class CShadowFor : public CProvBase
  346. {
  347. //
  348. // constructor
  349. //
  350. public:
  351. CShadowFor(
  352. LPCWSTR pwszNameIn,
  353. CWbemServices* pNamespaceIn
  354. );
  355. ~CShadowFor(){}
  356. //
  357. // methods
  358. //
  359. public:
  360. virtual HRESULT EnumInstance(
  361. long lFlagsIn,
  362. IWbemContext* pCtxIn,
  363. IWbemObjectSink* pHandlerIn
  364. );
  365. virtual HRESULT GetObject(
  366. CObjPath& rObjPathIn,
  367. long lFlagsIn,
  368. IWbemContext* pCtxIn,
  369. IWbemObjectSink* pHandlerIn
  370. );
  371. virtual HRESULT ExecuteMethod(
  372. BSTR bstrObjPathIn,
  373. WCHAR* pwszMethodNameIn,
  374. long lFlagIn,
  375. IWbemClassObject* pParamsIn,
  376. IWbemObjectSink* pHandlerIn
  377. ) { return WBEM_E_NOT_SUPPORTED; };
  378. virtual HRESULT PutInstance(
  379. CWbemClassObject& rInstToPutIn,
  380. long lFlagIn,
  381. IWbemContext* pCtxIn,
  382. IWbemObjectSink* pHandlerIn
  383. ) { return WBEM_E_NOT_SUPPORTED; };
  384. virtual HRESULT DeleteInstance(
  385. CObjPath& rObjPathIn,
  386. long lFlagIn,
  387. IWbemContext* pCtxIn,
  388. IWbemObjectSink* pHandlerIn
  389. ) { return WBEM_E_NOT_SUPPORTED; };
  390. static CProvBase* S_CreateThis(
  391. LPCWSTR pwszNameIn,
  392. CWbemServices* pNamespaceIn
  393. );
  394. HRESULT Initialize()
  395. {
  396. HRESULT hr = S_OK;
  397. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  398. return hr;
  399. }
  400. private:
  401. CComPtr<IVssCoordinator> m_spCoord;
  402. void LoadInstance(
  403. IN VSS_SNAPSHOT_PROP* pProp,
  404. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  405. }; // class CShadowFor
  406. //////////////////////////////////////////////////////////////////////////////
  407. //++
  408. //
  409. // class CShadowBy
  410. //
  411. // Description:
  412. // Provider Implementation for ShadowFor
  413. //
  414. //--
  415. //////////////////////////////////////////////////////////////////////////////
  416. class CShadowBy : public CProvBase
  417. {
  418. //
  419. // constructor
  420. //
  421. public:
  422. CShadowBy(
  423. LPCWSTR pwszNameIn,
  424. CWbemServices* pNamespaceIn
  425. );
  426. ~CShadowBy(){}
  427. //
  428. // methods
  429. //
  430. public:
  431. virtual HRESULT EnumInstance(
  432. long lFlagsIn,
  433. IWbemContext* pCtxIn,
  434. IWbemObjectSink* pHandlerIn
  435. );
  436. virtual HRESULT GetObject(
  437. CObjPath& rObjPathIn,
  438. long lFlagsIn,
  439. IWbemContext* pCtxIn,
  440. IWbemObjectSink* pHandlerIn
  441. );
  442. virtual HRESULT ExecuteMethod(
  443. BSTR bstrObjPathIn,
  444. WCHAR* pwszMethodNameIn,
  445. long lFlagIn,
  446. IWbemClassObject* pParamsIn,
  447. IWbemObjectSink* pHandlerIn
  448. ) { return WBEM_E_NOT_SUPPORTED; };
  449. virtual HRESULT PutInstance(
  450. CWbemClassObject& rInstToPutIn,
  451. long lFlagIn,
  452. IWbemContext* pCtxIn,
  453. IWbemObjectSink* pHandlerIn
  454. ) { return WBEM_E_NOT_SUPPORTED; };
  455. virtual HRESULT DeleteInstance(
  456. CObjPath& rObjPathIn,
  457. long lFlagIn,
  458. IWbemContext* pCtxIn,
  459. IWbemObjectSink* pHandlerIn
  460. ) { return WBEM_E_NOT_SUPPORTED; };
  461. static CProvBase* S_CreateThis(
  462. LPCWSTR pwszNameIn,
  463. CWbemServices* pNamespaceIn
  464. );
  465. HRESULT Initialize()
  466. {
  467. HRESULT hr = S_OK;
  468. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  469. return hr;
  470. }
  471. private:
  472. CComPtr<IVssCoordinator> m_spCoord;
  473. void LoadInstance(
  474. IN VSS_SNAPSHOT_PROP* pProp,
  475. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  476. }; // class CShadowBy
  477. //////////////////////////////////////////////////////////////////////////////
  478. //++
  479. //
  480. // class CShadowOn
  481. //
  482. // Description:
  483. // Provider Implementation for ShadowFor
  484. //
  485. //--
  486. //////////////////////////////////////////////////////////////////////////////
  487. class CShadowOn : public CProvBase
  488. {
  489. //
  490. // constructor
  491. //
  492. public:
  493. CShadowOn(
  494. LPCWSTR pwszNameIn,
  495. CWbemServices* pNamespaceIn
  496. );
  497. ~CShadowOn(){}
  498. //
  499. // methods
  500. //
  501. public:
  502. virtual HRESULT EnumInstance(
  503. long lFlagsIn,
  504. IWbemContext* pCtxIn,
  505. IWbemObjectSink* pHandlerIn
  506. );
  507. virtual HRESULT GetObject(
  508. CObjPath& rObjPathIn,
  509. long lFlagsIn,
  510. IWbemContext* pCtxIn,
  511. IWbemObjectSink* pHandlerIn
  512. );
  513. virtual HRESULT ExecuteMethod(
  514. BSTR bstrObjPathIn,
  515. WCHAR* pwszMethodNameIn,
  516. long lFlagIn,
  517. IWbemClassObject* pParamsIn,
  518. IWbemObjectSink* pHandlerIn
  519. ) { return WBEM_E_NOT_SUPPORTED; };
  520. virtual HRESULT PutInstance(
  521. CWbemClassObject& rInstToPutIn,
  522. long lFlagIn,
  523. IWbemContext* pCtxIn,
  524. IWbemObjectSink * pHandlerIn
  525. ) { return WBEM_E_NOT_SUPPORTED; };
  526. virtual HRESULT DeleteInstance(
  527. CObjPath& rObjPathIn,
  528. long lFlagIn,
  529. IWbemContext* pCtxIn,
  530. IWbemObjectSink* pHandlerIn
  531. ) { return WBEM_E_NOT_SUPPORTED; };
  532. static CProvBase* S_CreateThis(
  533. LPCWSTR pwszNameIn,
  534. CWbemServices* pNamespaceIn
  535. );
  536. HRESULT Initialize()
  537. {
  538. HRESULT hr = S_OK;
  539. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  540. return hr;
  541. }
  542. private:
  543. CComPtr<IVssCoordinator> m_spCoord;
  544. void LoadInstance(
  545. IN VSS_SNAPSHOT_PROP* pPropSnap,
  546. IN VSS_DIFF_AREA_PROP* pPropDiff,
  547. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  548. }; // class CShadowOn
  549. //////////////////////////////////////////////////////////////////////////////
  550. //++
  551. //
  552. // class CVolumeSupport
  553. //
  554. // Description:
  555. // Provider Implementation for ShadowFor
  556. //
  557. //--
  558. //////////////////////////////////////////////////////////////////////////////
  559. class CVolumeSupport : public CProvBase
  560. {
  561. //
  562. // constructor
  563. //
  564. public:
  565. CVolumeSupport(
  566. LPCWSTR pwszNameIn,
  567. CWbemServices* pNamespaceIn
  568. );
  569. ~CVolumeSupport(){}
  570. //
  571. // methods
  572. //
  573. public:
  574. virtual HRESULT EnumInstance(
  575. long lFlagsIn,
  576. IWbemContext* pCtxIn,
  577. IWbemObjectSink* pHandlerIn
  578. );
  579. virtual HRESULT GetObject(
  580. CObjPath& rObjPathIn,
  581. long lFlagsIn,
  582. IWbemContext* pCtxIn,
  583. IWbemObjectSink* pHandlerIn
  584. );
  585. virtual HRESULT ExecuteMethod(
  586. BSTR bstrObjPathIn,
  587. WCHAR* pwszMethodNameIn,
  588. long lFlagIn,
  589. IWbemClassObject* pParamsIn,
  590. IWbemObjectSink* pHandlerIn
  591. ) { return WBEM_E_NOT_SUPPORTED; };
  592. virtual HRESULT PutInstance(
  593. CWbemClassObject& rInstToPutIn,
  594. long lFlagIn,
  595. IWbemContext* pCtxIn,
  596. IWbemObjectSink* pHandlerIn
  597. ) { return WBEM_E_NOT_SUPPORTED; };
  598. virtual HRESULT DeleteInstance(
  599. CObjPath& rObjPathIn,
  600. long lFlagIn,
  601. IWbemContext* pCtxIn,
  602. IWbemObjectSink* pHandlerIn
  603. ) { return WBEM_E_NOT_SUPPORTED; };
  604. static CProvBase* S_CreateThis(
  605. LPCWSTR pwszNameIn,
  606. CWbemServices* pNamespaceIn
  607. );
  608. HRESULT Initialize()
  609. {
  610. HRESULT hr = S_OK;
  611. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  612. return hr;
  613. }
  614. private:
  615. CComPtr<IVssCoordinator> m_spCoord;
  616. void LoadInstance(
  617. IN GUID* pProviderID,
  618. IN VSS_VOLUME_PROP* pPropVol,
  619. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  620. }; // class CVolumeSupport
  621. //////////////////////////////////////////////////////////////////////////////
  622. //++
  623. //
  624. // class CDiffVolumeSupport
  625. //
  626. // Description:
  627. // Provider Implementation for ShadowDiffVolumeSupport
  628. //
  629. //--
  630. //////////////////////////////////////////////////////////////////////////////
  631. class CDiffVolumeSupport : public CProvBase
  632. {
  633. //
  634. // constructor
  635. //
  636. public:
  637. CDiffVolumeSupport(
  638. LPCWSTR pwszNameIn,
  639. CWbemServices* pNamespaceIn
  640. );
  641. ~CDiffVolumeSupport(){}
  642. //
  643. // methods
  644. //
  645. public:
  646. virtual HRESULT EnumInstance(
  647. long lFlagsIn,
  648. IWbemContext* pCtxIn,
  649. IWbemObjectSink* pHandlerIn
  650. );
  651. virtual HRESULT GetObject(
  652. CObjPath& rObjPathIn,
  653. long lFlagsIn,
  654. IWbemContext* pCtxIn,
  655. IWbemObjectSink* pHandlerIn
  656. );
  657. virtual HRESULT ExecuteMethod(
  658. BSTR bstrObjPathIn,
  659. WCHAR* pwszMethodNameIn,
  660. long lFlagIn,
  661. IWbemClassObject* pParamsIn,
  662. IWbemObjectSink* pHandlerIn
  663. ) { return WBEM_E_NOT_SUPPORTED; };
  664. virtual HRESULT PutInstance(
  665. CWbemClassObject& rInstToPutIn,
  666. long lFlagIn,
  667. IWbemContext* pCtxIn,
  668. IWbemObjectSink* pHandlerIn
  669. ) { return WBEM_E_NOT_SUPPORTED; };
  670. virtual HRESULT DeleteInstance(
  671. CObjPath& rObjPathIn,
  672. long lFlagIn,
  673. IWbemContext* pCtxIn,
  674. IWbemObjectSink* pHandlerIn
  675. ) { return WBEM_E_NOT_SUPPORTED; };
  676. static CProvBase* S_CreateThis(
  677. LPCWSTR pwszNameIn,
  678. CWbemServices* pNamespaceIn
  679. );
  680. HRESULT Initialize()
  681. {
  682. HRESULT hr = S_OK;
  683. hr = m_spCoord.CoCreateInstance(__uuidof(VSSCoordinator));
  684. return hr;
  685. }
  686. private:
  687. CComPtr<IVssCoordinator> m_spCoord;
  688. void LoadInstance(
  689. IN GUID* pProviderID,
  690. IN VSS_DIFF_VOLUME_PROP* pPropVol,
  691. IN OUT IWbemClassObject* pObject) throw(HRESULT);
  692. }; // class CDiffVolumeSupport
  693. class CVssAutoSnapshotProperties
  694. {
  695. // Constructors/destructors
  696. private:
  697. CVssAutoSnapshotProperties(const CVssAutoSnapshotProperties&);
  698. public:
  699. CVssAutoSnapshotProperties(VSS_SNAPSHOT_PROP &Snap): m_pSnap(&Snap) {};
  700. CVssAutoSnapshotProperties(VSS_OBJECT_PROP &Prop): m_pSnap(&Prop.Obj.Snap) {};
  701. // Automatically closes the handle
  702. ~CVssAutoSnapshotProperties() {
  703. Clear();
  704. };
  705. // Operations
  706. public:
  707. // Returns the value
  708. VSS_SNAPSHOT_PROP *GetPtr() {
  709. return m_pSnap;
  710. }
  711. // NULLs out the pointer. Used after a pointer has been transferred to another
  712. // funtion.
  713. void Transferred() {
  714. m_pSnap = NULL;
  715. }
  716. // Clears the contents of the auto string
  717. void Clear() {
  718. if ( m_pSnap != NULL )
  719. {
  720. ::VssFreeSnapshotProperties(m_pSnap);
  721. m_pSnap = NULL;
  722. }
  723. }
  724. // Returns the value to the actual pointer
  725. VSS_SNAPSHOT_PROP* operator->() const {
  726. return m_pSnap;
  727. }
  728. // Returns the value of the actual pointer
  729. operator VSS_SNAPSHOT_PROP* () const {
  730. return m_pSnap;
  731. }
  732. private:
  733. VSS_SNAPSHOT_PROP *m_pSnap;
  734. };