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.

78 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: fileilb.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. //----------------------------------------------------------------------------
  15. #ifndef __FILEILB_HXX__
  16. #define __FILEILB_HXX__
  17. #include "storage.h"
  18. #define ILB_DELETEONERR 1
  19. #define ILB_DELETEONRELEASE 2
  20. class CFileILB: public ILockBytes
  21. {
  22. public:
  23. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj);
  24. STDMETHOD_(ULONG,AddRef) (THIS);
  25. STDMETHOD_(ULONG,Release) (THIS);
  26. // *** ILockBytes methods ***
  27. STDMETHOD(ReadAt) (THIS_ ULARGE_INTEGER ulOffset,
  28. VOID HUGEP *pv,
  29. ULONG cb,
  30. ULONG FAR *pcbRead);
  31. STDMETHOD(WriteAt) (THIS_ ULARGE_INTEGER ulOffset,
  32. VOID const HUGEP *pv,
  33. ULONG cb,
  34. ULONG FAR *pcbWritten);
  35. STDMETHOD(Flush) (THIS);
  36. STDMETHOD(SetSize) (THIS_ ULARGE_INTEGER cb);
  37. STDMETHOD(LockRegion) (THIS_ ULARGE_INTEGER libOffset,
  38. ULARGE_INTEGER cb,
  39. DWORD dwLockType);
  40. STDMETHOD(UnlockRegion) (THIS_ ULARGE_INTEGER libOffset,
  41. ULARGE_INTEGER cb,
  42. DWORD dwLockType);
  43. STDMETHOD(Stat) (THIS_ STATSTG FAR *pstatstg, DWORD grfStatFlag);
  44. CFileILB(const TCHAR *pszName,
  45. DWORD grfMode,
  46. BOOL fOpenFile=TRUE);
  47. ~CFileILB();
  48. SCODE Open(DWORD grfMode);
  49. SCODE Create(DWORD grfMode);
  50. ULONG ReleaseOnError(void); // same as release, but it will not delete
  51. // non-scratch or newly created files
  52. ULONG Seek (ULONGLONG ulPos);
  53. private:
  54. FILE * _f;
  55. ULONG _ulRef;
  56. char *_pszName; // we always use ANSI char when dealing with
  57. // I/O
  58. unsigned short _fDelete;
  59. };
  60. #endif // #ifndef __FILEILB_HXX__