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.

84 lines
1.2 KiB

  1. #ifndef _STREAM_H
  2. #define _STREAM_H
  3. class CStream
  4. {
  5. public:
  6. CStream ();
  7. virtual ~CStream (){};
  8. virtual inline BOOL
  9. bValid (VOID) CONST {
  10. return m_bValid;
  11. }
  12. virtual BOOL
  13. Reset (
  14. VOID);
  15. virtual BOOL
  16. GetTotalSize (
  17. PDWORD pdwSize) CONST;
  18. virtual BOOL
  19. SetPtr (
  20. DWORD dwPos) = 0;
  21. virtual BOOL
  22. Read (
  23. PBYTE pBuf,
  24. DWORD dwBufSize,
  25. PDWORD pdwSizeRead) = 0;
  26. protected:
  27. BOOL m_bValid;
  28. DWORD m_dwTotalSize;
  29. DWORD m_dwCurPos;
  30. };
  31. class CMemStream: public CStream
  32. {
  33. public:
  34. CMemStream (
  35. PBYTE pMem,
  36. DWORD dwTotalSize);
  37. virtual BOOL
  38. SetPtr (
  39. DWORD dwPos);
  40. virtual BOOL
  41. Read (
  42. PBYTE pBuf,
  43. DWORD dwBufSize,
  44. PDWORD pdwSizeRead);
  45. private:
  46. PBYTE m_pMem;
  47. };
  48. class CFileStream: public CStream
  49. {
  50. public:
  51. CFileStream (
  52. HANDLE hFile);
  53. virtual BOOL
  54. SetPtr (
  55. DWORD dwPos);
  56. virtual BOOL
  57. Read (
  58. PBYTE pBuf,
  59. DWORD dwBufSize,
  60. PDWORD pdwSizeRead);
  61. private:
  62. HANDLE m_hFile;
  63. };
  64. #endif