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
;
29 bool Create(LPCTSTR fileName
, DWORD desiredAccess
,
30 DWORD shareMode
, DWORD creationDisposition
, DWORD flagsAndAttributes
);
32 bool Create(LPCWSTR fileName
, DWORD desiredAccess
,
33 DWORD shareMode
, DWORD creationDisposition
, DWORD flagsAndAttributes
);
37 CFileBase(): _fileIsOpen(false){};
42 bool GetPosition(UInt64
&position
) const;
43 bool GetLength(UInt64
&length
) const;
45 bool Seek(Int64 distanceToMove
, DWORD moveMethod
, UInt64
&newPosition
) const;
46 bool Seek(UInt64 position
, UInt64
&newPosition
);
48 bool SeekToEnd(UInt64
&newPosition
);
50 bool GetFileInformation(CByHandleFileInfo
&fileInfo
) const;
53 class CInFile
: public CFileBase
56 bool Open(LPCTSTR fileName
, DWORD shareMode
, DWORD creationDisposition
, DWORD flagsAndAttributes
);
57 bool Open(LPCTSTR fileName
);
59 bool Open(LPCWSTR fileName
, DWORD shareMode
, DWORD creationDisposition
, DWORD flagsAndAttributes
);
60 bool Open(LPCWSTR fileName
);
62 bool ReadPart(void *data
, UInt32 size
, UInt32
&processedSize
);
63 bool Read(void *data
, UInt32 size
, UInt32
&processedSize
);
66 class COutFile
: public CFileBase
68 // DWORD m_CreationDisposition;
70 // COutFile(): m_CreationDisposition(CREATE_NEW){};
71 bool Open(LPCTSTR fileName
, DWORD shareMode
, DWORD creationDisposition
, DWORD flagsAndAttributes
);
72 bool Open(LPCTSTR fileName
, DWORD creationDisposition
);
73 bool Create(LPCTSTR fileName
, bool createAlways
);
76 bool Open(LPCWSTR fileName
, DWORD shareMode
, DWORD creationDisposition
, DWORD flagsAndAttributes
);
77 bool Open(LPCWSTR fileName
, DWORD creationDisposition
);
78 bool Create(LPCWSTR fileName
, bool createAlways
);
82 void SetOpenCreationDisposition(DWORD creationDisposition)
83 { m_CreationDisposition = creationDisposition; }
84 void SetOpenCreationDispositionCreateAlways()
85 { m_CreationDisposition = CREATE_ALWAYS; }
88 bool SetTime(const FILETIME
*creationTime
, const FILETIME
*lastAccessTime
, const FILETIME
*lastWriteTime
);
89 bool SetLastWriteTime(const FILETIME
*lastWriteTime
);
90 bool WritePart(const void *data
, UInt32 size
, UInt32
&processedSize
);
91 bool Write(const void *data
, UInt32 size
, UInt32
&processedSize
);
93 bool SetLength(UInt64 length
);