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.

64 lines
1.6 KiB

  1. #ifndef __FILEIO_HPP__
  2. #define __FILEIO_HPP__
  3. class CMBFTFile
  4. {
  5. protected:
  6. HANDLE m_FileHandle;
  7. DWORD m_LastIOError;
  8. char m_szFileName[_MAX_PATH];
  9. char m_szTempDirectory[_MAX_PATH];
  10. private:
  11. enum OpenModeFlags
  12. {
  13. FDW_Read = 0x0001,
  14. FDW_Write = 0x0002,
  15. FDW_Create = 0x0010,
  16. FDW_RDeny = 0x0100,
  17. FDW_WDeny = 0x0200
  18. };
  19. public:
  20. enum OpenMode
  21. {
  22. OpenReadOnly = FDW_Read,
  23. OpenReadWrite = FDW_Read|FDW_Write,
  24. OpenBinary = 0,
  25. CreateReadOnly = FDW_Read|FDW_Create,
  26. CreateWrite = FDW_Write|FDW_Create,
  27. CreateReadWrite = FDW_Write|FDW_Read|FDW_Create,
  28. ShareExclusive = FDW_RDeny|FDW_WDeny,
  29. ShareDenyNone = 0,
  30. ShareDenyRead = FDW_RDeny,
  31. ShareDenyWrite = FDW_WDeny,
  32. };
  33. enum SeekMode
  34. {
  35. SeekFromBegin = 0,
  36. SeekFromCurrent = 1,
  37. SeekFromEnd = 2
  38. };
  39. CMBFTFile();
  40. ~CMBFTFile();
  41. BOOL Open(LPCSTR lpszFileName,unsigned iOpenMode);
  42. BOOL Close(BOOL status=TRUE);
  43. BOOL Create(LPCSTR lpszDirName, LPCSTR lpszFileName);
  44. BOOL DeleteFile(void);
  45. LONG Seek(LONG lOffset,int lFromWhere);
  46. ULONG Read(LPSTR lpszBuffer, ULONG iNumBytes);
  47. BOOL Write(LPCSTR lpszBuffer, ULONG iNumBytes);
  48. LONG GetFileSize(void);
  49. time_t GetFileDateTime(void);
  50. BOOL SetFileDateTime(time_t FileDateTime);
  51. LPCSTR GetTempDirectory(void);
  52. LPCSTR GetFileName(void) { return m_szFileName; }
  53. int GetLastErrorCode(void);
  54. BOOL GetIsEOF();
  55. };
  56. #endif //__FILEIO_HPP__
  57.