3 #ifndef __WINDOWS_FILEIO_H
4 #define __WINDOWS_FILEIO_H
6 #include "../Common/Types.h"
12 struct CByHandleFileInfo
15 FILETIME CreationTime;
16 FILETIME LastAccessTime;
17 FILETIME LastWriteTime;
18 DWORD VolumeSerialNumber;
28 bool Create(LPCTSTR fileName, DWORD desiredAccess,
29 DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
31 bool Create(LPCWSTR fileName, DWORD desiredAccess,
32 DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
36 CFileBase(): _handle(INVALID_HANDLE_VALUE){};
41 bool GetPosition(UInt64 &position) const;
42 bool GetLength(UInt64 &length) const;
44 bool Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition) const;
45 bool Seek(UInt64 position, UInt64 &newPosition);
47 bool SeekToEnd(UInt64 &newPosition);
49 bool GetFileInformation(CByHandleFileInfo &fileInfo) const;
52 class CInFile: public CFileBase
55 bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
56 bool OpenShared(LPCTSTR fileName, bool shareForWrite);
57 bool Open(LPCTSTR fileName);
59 bool Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
60 bool OpenShared(LPCWSTR fileName, bool shareForWrite);
61 bool Open(LPCWSTR fileName);
63 bool ReadPart(void *data, UInt32 size, UInt32 &processedSize);
64 bool Read(void *data, UInt32 size, UInt32 &processedSize);
67 class COutFile: public CFileBase
69 // DWORD m_CreationDisposition;
71 // COutFile(): m_CreationDisposition(CREATE_NEW){};
72 bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
73 bool Open(LPCTSTR fileName, DWORD creationDisposition);
74 bool Create(LPCTSTR fileName, bool createAlways);
77 bool Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
78 bool Open(LPCWSTR fileName, DWORD creationDisposition);
79 bool Create(LPCWSTR fileName, bool createAlways);
83 void SetOpenCreationDisposition(DWORD creationDisposition)
84 { m_CreationDisposition = creationDisposition; }
85 void SetOpenCreationDispositionCreateAlways()
86 { m_CreationDisposition = CREATE_ALWAYS; }
89 bool SetTime(const FILETIME *creationTime, const FILETIME *lastAccessTime, const FILETIME *lastWriteTime);
90 bool SetLastWriteTime(const FILETIME *lastWriteTime);
91 bool WritePart(const void *data, UInt32 size, UInt32 &processedSize);
92 bool Write(const void *data, UInt32 size, UInt32 &processedSize);
94 bool SetLength(UInt64 length);