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.

104 lines
1.6 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1998 - 1999
  3. All rights reserved.
  4. Module Name:
  5. Stream.hxx
  6. Abstract:
  7. Implements read, write , seek methods to operate a file likewise a stream
  8. Author:
  9. Adina Trufinescu (AdinaTru) 4-Nov-1998
  10. Revision History:
  11. --*/
  12. #ifndef _TSTREAM_HXX_
  13. #define _TSTREAM_HXX_
  14. class TStream
  15. {
  16. public:
  17. TStream::
  18. TStream(
  19. IN TString& strFileName
  20. );
  21. TStream::
  22. ~TStream();
  23. HRESULT
  24. Read(
  25. IN VOID * pv,
  26. IN ULONG cb,
  27. IN ULONG * pcbRead
  28. );
  29. HRESULT
  30. Write(
  31. IN VOID const* pv,
  32. IN ULONG cb,
  33. IN ULONG * pcbWritten
  34. );
  35. HRESULT
  36. Seek(
  37. IN LARGE_INTEGER dlibMove,
  38. IN DWORD dwOrigin,
  39. IN ULARGE_INTEGER * plibNewPosition
  40. );
  41. HRESULT
  42. TStream::
  43. DestroyFile(
  44. VOID
  45. );
  46. BOOL
  47. TStream::
  48. bSetEndOfFile(
  49. VOID
  50. );
  51. static
  52. HRESULT
  53. MapWin32ErrorCodeToHRes(
  54. IN DWORD dwErrorCode
  55. );
  56. private:
  57. BOOL
  58. TStream::
  59. bValid
  60. (
  61. VOID
  62. );
  63. HANDLE
  64. PCreateFile(
  65. OUT LPDWORD pdwAccess
  66. );
  67. TString m_strFileName; // file name
  68. HANDLE m_hFileHandle; // file handle
  69. BOOL m_bCreated; // specify is file was created or just opened
  70. DWORD m_dwAccess; // specify access rights the file was opened with
  71. ULARGE_INTEGER m_uliStreamSize; // specify file size
  72. };
  73. #endif