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.

133 lines
3.2 KiB

  1. //
  2. // MODULE: FS.h
  3. //
  4. // PURPOSE: Interface declaration needed in order to use CHM files.
  5. //
  6. // COMPANY: This file was created by Microsoft and should not be changed by Saltmine
  7. // except for comments
  8. //
  9. // ORIGINAL DATE: 1997.
  10. //
  11. // NOTES:
  12. //
  13. // Version Date By Comments
  14. //--------------------------------------------------------------------
  15. // V3.1 01-18-99 JM This header added.
  16. //
  17. // Copyright 1997-1997 Microsoft Corporation. All Rights Reserved.
  18. #ifndef _FS_H_
  19. #define _FS_H_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif
  23. #include <unknwn.h>
  24. #include "msitstg.h"
  25. #ifdef ReleaseObjPtr
  26. #undef ReleaseObjPtr
  27. #endif
  28. #define ReleaseObjPtr(pObj) \
  29. { \
  30. if( pObj ) \
  31. { \
  32. pObj->Release(); \
  33. pObj= NULL; \
  34. } \
  35. }
  36. //
  37. // Sub-File System
  38. //
  39. class CSubFileSystem
  40. {
  41. protected:
  42. bool GetSubPos(ULARGE_INTEGER*, STREAM_SEEK =STREAM_SEEK_CUR);
  43. bool SetSubPos(LARGE_INTEGER, STREAM_SEEK =STREAM_SEEK_SET);
  44. public:
  45. CSubFileSystem(class CFileSystem* pfs);
  46. ~CSubFileSystem();
  47. HRESULT CreateSub(PCSTR pszPathName);
  48. HRESULT CreateUncompressedSub(PCSTR pszPathName);
  49. HRESULT OpenSub(PCSTR pszPathName, DWORD dwAccess = (STGM_READ | STGM_SHARE_DENY_WRITE));
  50. ULONG WriteSub(const void* pData, int cb);
  51. ULONG SeekSub(int cb, int iOrigin);
  52. HRESULT CreateSystemFile(PCSTR pszPathName);
  53. HRESULT CreateUncompressedSystemFile(PCSTR pszPathName);
  54. HRESULT SetSize(unsigned uSize);
  55. HRESULT DeleteSub() ;
  56. ULONG GetUncompressedSize(void);
  57. inline HRESULT ReadSub(void* pData, ULONG cb, ULONG* pcbRead) {
  58. return m_pStream->Read(pData, cb, pcbRead);
  59. }
  60. inline HRESULT Stat(STATSTG *pstatstg, DWORD grfStatFalg)
  61. {
  62. return m_pStream->Stat(pstatstg,grfStatFalg);
  63. }
  64. inline HRESULT CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER* pcbWritten)
  65. {
  66. return m_pStream->CopyTo(pstm, cb, pcbRead, pcbWritten);
  67. }
  68. inline IStream * GetStream(void)
  69. {
  70. return m_pStream;
  71. }
  72. inline IStorage* GetITStorageDocObj(void) const
  73. {
  74. return m_pStorage;
  75. }
  76. private:
  77. class CFileSystem* m_pFS;
  78. IStorage* m_pStorage;
  79. IStream* m_pStream;
  80. char m_szPathName[MAX_PATH]; // Needed for delete.
  81. };
  82. //
  83. // File System
  84. //
  85. class CFileSystem
  86. {
  87. friend class CSubFileSystem;
  88. public:
  89. CFileSystem();
  90. ~CFileSystem();
  91. HRESULT Init(void);
  92. HRESULT Create( PCSTR pszPathName );
  93. HRESULT CreateUncompressed( PCSTR pszPathName );
  94. HRESULT Open( PCSTR pszPathName, DWORD dwAccess = (STGM_READ | STGM_SHARE_DENY_WRITE));
  95. HRESULT Compact(LPCSTR lpszFileName);
  96. HRESULT Close(void);
  97. inline HRESULT GetPathName( LPSTR pszPathName ) { strcpy(pszPathName, m_szPathName); return S_OK; }
  98. inline IITStorage* GetITStorageObj(void) const
  99. {
  100. return m_pITStorage;
  101. }
  102. inline IStorage* GetITStorageDocObj(void) const
  103. {
  104. return m_pStorage;
  105. }
  106. private:
  107. IITStorage* m_pITStorage;
  108. IStorage* m_pStorage;
  109. char m_szPathName[MAX_PATH];
  110. };
  111. #endif // _FS_H_