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.

64 lines
2.0 KiB

  1. #pragma once
  2. class IRWFile
  3. {
  4. protected:
  5. HANDLE m_hFile;
  6. public:
  7. virtual HRESULT InitFile(
  8. LPCTSTR lpFileName,
  9. DWORD dwDesiredAccess,
  10. DWORD dwShareMode,
  11. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  12. DWORD dwCreationDisposition,
  13. DWORD dwFlagsAndAttributes,
  14. HANDLE hTemplateFile
  15. ) = 0;
  16. virtual HRESULT Read(
  17. LPVOID lpBuffer,
  18. DWORD nNumberOfBytesToRead,
  19. LPDWORD lpNumberOfBytesRead,
  20. LPOVERLAPPED lpOverlapped
  21. ) = 0;
  22. virtual HRESULT Write(
  23. LPCVOID lpBuffer,
  24. DWORD nNumberOfBytesToWrite,
  25. LPDWORD lpNumberOfBytesWritten,
  26. LPOVERLAPPED lpOverlapped
  27. ) = 0;
  28. };
  29. class CRWFile : public IRWFile
  30. {
  31. public:
  32. CRWFile();
  33. ~CRWFile();
  34. virtual HRESULT InitFile(
  35. LPCTSTR lpFileName,
  36. DWORD dwDesiredAccess,
  37. DWORD dwShareMode,
  38. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  39. DWORD dwCreationDisposition,
  40. DWORD dwFlagsAndAttributes,
  41. HANDLE hTemplateFile
  42. );
  43. virtual HRESULT Read(
  44. LPVOID lpBuffer,
  45. DWORD nNumberOfBytesToRead,
  46. LPDWORD lpNumberOfBytesRead,
  47. LPOVERLAPPED lpOverlapped
  48. );
  49. virtual HRESULT Write(
  50. LPCVOID lpBuffer,
  51. DWORD nNumberOfBytesToWrite,
  52. LPDWORD lpNumberOfBytesWritten,
  53. LPOVERLAPPED lpOverlapped
  54. );
  55. };