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.
|
|
// Copyright 1997-1997 Microsoft Corporation. All Rights Reserved.
#ifndef _FS_H_
#define _FS_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <unknwn.h>
#include "msitstg.h"
#ifdef ReleaseObjPtr
#undef ReleaseObjPtr
#endif
#define ReleaseObjPtr(pObj) \
{ \ if( pObj ) \ { \ pObj->Release(); \ pObj= NULL; \ } \ }
//
// Sub-File System
//
class CSubFileSystem {
public: CSubFileSystem(class CFileSystem* pfs); ~CSubFileSystem();
HRESULT CreateSub(PCSTR pszPathName); HRESULT CreateUncompressedSub(PCSTR pszPathName); HRESULT OpenSub(PCSTR pszPathName, DWORD dwAccess = (STGM_READ | STGM_SHARE_DENY_WRITE)); ULONG WriteSub(const void* pData, int cb); ULONG SeekSub(int cb, int iOrigin); HRESULT CreateSystemFile(PCSTR pszPathName); HRESULT CreateUncompressedSystemFile(PCSTR pszPathName); HRESULT SetSize(unsigned uSize); HRESULT DeleteSub() ;
inline HRESULT ReadSub(void* pData, ULONG cb, ULONG* pcbRead) { return m_pStream->Read(pData, cb, pcbRead); }
inline ULONG GetUncompressedSize(void) { return SeekSub(0,2); }
inline HRESULT Stat(STATSTG *pstatstg, DWORD grfStatFalg) { return m_pStream->Stat(pstatstg,grfStatFalg); }
inline HRESULT CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER* pcbWritten) { return m_pStream->CopyTo(pstm, cb, pcbRead, pcbWritten); }
inline IStream * GetStream(void) { return m_pStream; }
inline IStorage* GetITStorageDocObj(void) const { return m_pStorage; }
private: class CFileSystem* m_pFS; IStorage* m_pStorage; IStream* m_pStream; char m_szPathName[MAX_PATH]; // Needed for delete.
};
//
// File System
//
class CFileSystem { friend class CSubFileSystem;
public: CFileSystem(); ~CFileSystem();
HRESULT Init(void); HRESULT Create( PCSTR pszPathName ); HRESULT CreateUncompressed( PCSTR pszPathName ); HRESULT Open( PCSTR pszPathName, DWORD dwAccess = (STGM_READ | STGM_SHARE_DENY_WRITE)); HRESULT Compact(LPCSTR lpszFileName); HRESULT Close(void);
inline HRESULT GetPathName( LPSTR pszPathName ) { strcpy(pszPathName, m_szPathName); return S_OK; }
inline IITStorage* GetITStorageObj(void) const { return m_pITStorage; }
inline IStorage* GetITStorageDocObj(void) const { return m_pStorage; }
private: IITStorage* m_pITStorage; IStorage* m_pStorage; char m_szPathName[MAX_PATH];
};
#endif // _FS_H_
|