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.

54 lines
1.7 KiB

  1. // helpers.h
  2. //
  3. #pragma once
  4. BOOL
  5. Validating(
  6. PCWSTR SourceManName,
  7. PCWSTR SchemaName
  8. );
  9. class CFileStreamBase : public IStream
  10. {
  11. public:
  12. CFileStreamBase()
  13. : m_cRef(0),
  14. m_hFile(INVALID_HANDLE_VALUE),
  15. m_bSeenFirstCharacter(false)
  16. { }
  17. virtual ~CFileStreamBase();
  18. bool OpenForRead(PCWSTR pszPath);
  19. bool Close();
  20. // IUnknown methods:
  21. STDMETHODIMP_(ULONG) AddRef();
  22. STDMETHODIMP_(ULONG) Release();
  23. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObj);
  24. // ISequentialStream methods:
  25. STDMETHODIMP Read(void *pv, ULONG cb, ULONG *pcbRead);
  26. STDMETHODIMP Write(void const *pv, ULONG cb, ULONG *pcbWritten);
  27. // IStream methods:
  28. STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
  29. STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize);
  30. STDMETHODIMP CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
  31. STDMETHODIMP Commit(DWORD grfCommitFlags);
  32. STDMETHODIMP Revert();
  33. STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
  34. STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
  35. STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag);
  36. STDMETHODIMP Clone(IStream **ppIStream);
  37. protected:
  38. LONG m_cRef;
  39. HANDLE m_hFile;
  40. bool m_bSeenFirstCharacter;
  41. private:
  42. CFileStreamBase(const CFileStreamBase &r); // intentionally not implemented
  43. CFileStreamBase &operator =(const CFileStreamBase &r); // intentionally not implemented
  44. };