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.

117 lines
2.9 KiB

  1. //+------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1998.
  5. //
  6. // File: oleprop.hxx
  7. //
  8. // Contents: OLE Property Manager. Handles access to property sets.
  9. //
  10. // Classes: COLEPropManager
  11. //
  12. // History: 13-Dec-95 dlee Created
  13. //
  14. //-------------------------------------------------------------------
  15. #pragma once
  16. extern BOOL IsNullPointerVariant( PROPVARIANT *ppv );
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Class: COLEPropManager
  20. //
  21. // Purpose: Handles access to OLE Property sets
  22. //
  23. // History: 13-Dec-95 dlee Created
  24. //
  25. //----------------------------------------------------------------------------
  26. class COLEPropManager
  27. {
  28. public:
  29. COLEPropManager( ) : _ppsstg( 0 ),
  30. _fStgOpenAttempted( FALSE ),
  31. _fOfficeCustomPropsetOpen( FALSE ),
  32. _fSharingViolation( FALSE ),
  33. _aPropSets( 0 )
  34. { }
  35. ~COLEPropManager() { ReleasePSS(); }
  36. BOOL isOpen() { return ( 0 != _ppsstg ); }
  37. BOOL Open( const CFunnyPath & funnyPath );
  38. void Close() { ReleasePSS(); }
  39. void FetchProperty( GUID const & guidPS,
  40. PROPSPEC const & psProperty,
  41. PROPVARIANT * pbData,
  42. unsigned * pcb );
  43. BOOL ReadProperty( CFullPropSpec const & ps,
  44. PROPVARIANT & Var );
  45. private:
  46. void ReleasePSS()
  47. {
  48. _fStgOpenAttempted = FALSE;
  49. _fSharingViolation = FALSE;
  50. _fOfficeCustomPropsetOpen = FALSE;
  51. if ( 0 != _ppsstg )
  52. {
  53. _aPropSets.Clear();
  54. _ppsstg->Release();
  55. _ppsstg = 0;
  56. }
  57. }
  58. unsigned PropSetToOrdinal( GUID const & guidPS );
  59. //
  60. // Property set mapping.
  61. //
  62. class CPropSetMap
  63. {
  64. public:
  65. CPropSetMap()
  66. : _pstg( 0 ), _fOpenAttempted( FALSE ) {}
  67. CPropSetMap( GUID const & guidPS )
  68. : _pstg( 0 ), _fOpenAttempted( FALSE ), _guid( guidPS ) {}
  69. ~CPropSetMap() { Close(); }
  70. GUID const & GetGuid() { return _guid; }
  71. void SetGuid( GUID const & guid ) { _guid = guid; }
  72. IPropertyStorage & GetPS() { return *_pstg; }
  73. BOOL isOpen( IPropertySetStorage * ppsstg );
  74. void Close();
  75. private:
  76. GUID _guid;
  77. IPropertyStorage * _pstg;
  78. BOOL _fOpenAttempted;
  79. };
  80. IPropertySetStorage * _ppsstg;
  81. BOOL _fStgOpenAttempted;
  82. BOOL _fOfficeCustomPropsetOpen;
  83. BOOL _fSharingViolation;
  84. CDynArrayInPlaceNST<CPropSetMap> _aPropSets;
  85. LONGLONG _llAlign;
  86. WCHAR _awcPath[ MAX_PATH + 1 ];
  87. };