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.

145 lines
3.6 KiB

  1. #pragma once
  2. class CImpIStream : public IStream
  3. {
  4. private:
  5. LONG m_cRef;
  6. protected:
  7. ULONG m_cbSeek;
  8. STATSTG m_statstg;
  9. public:
  10. CImpIStream(void);
  11. CImpIStream(PVOID pvData,ULONG cbSize);
  12. virtual ~CImpIStream(void);
  13. //IUnknown
  14. STDMETHODIMP QueryInterface(
  15. REFIID riid,
  16. void __RPC_FAR *__RPC_FAR *ppvObject);
  17. STDMETHODIMP_(ULONG) AddRef(void);
  18. STDMETHODIMP_(ULONG) Release(void);
  19. // IStream
  20. STDMETHODIMP Read(
  21. void __RPC_FAR *pv,
  22. ULONG cb,
  23. ULONG __RPC_FAR *pcbRead);
  24. STDMETHODIMP Write(
  25. const void __RPC_FAR *pv,
  26. ULONG cb,
  27. ULONG __RPC_FAR *pcbWritten);
  28. STDMETHODIMP Seek(
  29. LARGE_INTEGER dlibMove,
  30. DWORD dwOrigin,
  31. ULARGE_INTEGER __RPC_FAR *plibNewPosition);
  32. STDMETHODIMP SetSize(
  33. ULARGE_INTEGER libNewSize);
  34. STDMETHODIMP CopyTo(
  35. IStream __RPC_FAR *pstm,
  36. ULARGE_INTEGER cb,
  37. ULARGE_INTEGER __RPC_FAR *pcbRead,
  38. ULARGE_INTEGER __RPC_FAR *pcbWritten);
  39. STDMETHODIMP Commit(
  40. DWORD grfCommitFlags);
  41. STDMETHODIMP Revert( void);
  42. STDMETHODIMP LockRegion(
  43. ULARGE_INTEGER libOffset,
  44. ULARGE_INTEGER cb,
  45. DWORD dwLockType);
  46. STDMETHODIMP UnlockRegion(
  47. ULARGE_INTEGER libOffset,
  48. ULARGE_INTEGER cb,
  49. DWORD dwLockType);
  50. STDMETHODIMP Stat(
  51. STATSTG __RPC_FAR *pstatstg,
  52. DWORD grfStatFlag);
  53. STDMETHODIMP Clone(
  54. IStream __RPC_FAR *__RPC_FAR *ppstm);
  55. };
  56. class CStreamMem : public CImpIStream
  57. {
  58. private:
  59. PVOID m_pvData;
  60. BOOL m_fExternalData;
  61. public:
  62. CStreamMem(void);
  63. CStreamMem(PVOID pvData,ULONG cbSize);
  64. ~CStreamMem(void);
  65. // IStream
  66. STDMETHODIMP Read(
  67. void __RPC_FAR *pv,
  68. ULONG cb,
  69. ULONG __RPC_FAR *pcbRead);
  70. STDMETHODIMP Write(
  71. const void __RPC_FAR *pv,
  72. ULONG cb,
  73. ULONG __RPC_FAR *pcbWritten);
  74. STDMETHODIMP Seek(
  75. LARGE_INTEGER dlibMove,
  76. DWORD dwOrigin,
  77. ULARGE_INTEGER __RPC_FAR *plibNewPosition);
  78. STDMETHODIMP SetSize(
  79. ULARGE_INTEGER libNewSize);
  80. STDMETHODIMP CopyTo(
  81. IStream __RPC_FAR *pstm,
  82. ULARGE_INTEGER cb,
  83. ULARGE_INTEGER __RPC_FAR *pcbRead,
  84. ULARGE_INTEGER __RPC_FAR *pcbWritten);
  85. STDMETHODIMP GetPointerFromStream(PVOID *ppv,DWORD *pdwSize);
  86. };
  87. class CStreamFile : public CImpIStream
  88. {
  89. private:
  90. HANDLE m_hFile;
  91. BOOL m_fCloseHandle;
  92. BOOL m_fReadOnly;
  93. public:
  94. CStreamFile(HANDLE hFile,BOOL fCloseHandle = FALSE, BOOL fReadOnly = FALSE);
  95. ~CStreamFile(void);
  96. // IStream
  97. STDMETHODIMP Read(
  98. void __RPC_FAR *pv,
  99. ULONG cb,
  100. ULONG __RPC_FAR *pcbRead);
  101. STDMETHODIMP Write(
  102. const void __RPC_FAR *pv,
  103. ULONG cb,
  104. ULONG __RPC_FAR *pcbWritten);
  105. STDMETHODIMP Seek(
  106. LARGE_INTEGER dlibMove,
  107. DWORD dwOrigin,
  108. ULARGE_INTEGER __RPC_FAR *plibNewPosition);
  109. STDMETHODIMP SetSize(
  110. ULARGE_INTEGER libNewSize);
  111. STDMETHODIMP Commit(
  112. DWORD grfCommitFlags);
  113. };