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.

65 lines
1.8 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: PROPSTRM.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 10/7/1999
  12. *
  13. * DESCRIPTION: Property stream wrapper
  14. *
  15. *******************************************************************************/
  16. #ifndef __PROPSTRM_H_INCLUDED
  17. #define __PROPSTRM_H_INCLUDED
  18. #include <windows.h>
  19. #include <objbase.h>
  20. #include "simreg.h"
  21. #include "simstr.h"
  22. class CPropertyStream
  23. {
  24. private:
  25. CComPtr<IStream> m_pIStreamPropertyStream;
  26. public:
  27. CPropertyStream(void);
  28. CPropertyStream( IStream *pIStream );
  29. CPropertyStream( IWiaItem *pIWiaItem );
  30. CPropertyStream( const CPropertyStream &other );
  31. ~CPropertyStream();
  32. CPropertyStream &operator=( const CPropertyStream &other );
  33. bool IsValid(void) const;
  34. void Destroy(void);
  35. HRESULT CopyFromStream( IStream *pIStream );
  36. HRESULT CopyFromMemoryBlock( PBYTE pbSource, UINT_PTR nSize );
  37. HRESULT AssignFromWiaItem( IWiaItem *pIWiaItem );
  38. HRESULT ApplyToWiaItem( IWiaItem *pIWiaItem );
  39. IStream *Stream(void);
  40. IStream *Stream(void) const;
  41. UINT_PTR Size(void) const;
  42. PBYTE Lock(void);
  43. void Unlock(void);
  44. bool GetBytes( PBYTE &pByte, UINT_PTR &nSize );
  45. bool WriteToRegistry( IWiaItem *pWiaItem, HKEY hKeyRoot, LPCTSTR pszSubKey, LPCTSTR pszValueName );
  46. bool ReadFromRegistry( IWiaItem *pWiaItem, HKEY hKeyRoot, LPCTSTR pszSubKey, LPCTSTR pszValueName );
  47. };
  48. class CAutoRestorePropertyStream
  49. {
  50. private:
  51. CPropertyStream m_PropertyStream;
  52. HRESULT m_hr;
  53. CComPtr<IWiaItem> m_pWiaItem;
  54. public:
  55. CAutoRestorePropertyStream( IWiaItem *pWiaItem );
  56. ~CAutoRestorePropertyStream(void);
  57. };
  58. #endif //__PROPSTRM_H_INCLUDED