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.

139 lines
3.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: ilkbhdr.hxx
  7. //
  8. // Contents: ILockBytes file (for testing) and ILockBytesDF class
  9. //
  10. // Classes: CFileBytes
  11. // ILockBytesDF
  12. //
  13. // History: 30-July-96 NarindK Created
  14. //
  15. //--------------------------------------------------------------------------
  16. #ifndef __ILKB_HXX__
  17. #define __ILKB_HXX__
  18. #define ULIGetHigh(li) ((li).HighPart)
  19. class ILockBytesDF;
  20. typedef ILockBytesDF *PILOCKBYTESDF;
  21. class CFileBytes;
  22. typedef CFileBytes *PCFILEBYTES;
  23. // Debug object declaration
  24. DH_DECLARE;
  25. //+-------------------------------------------------------------------------
  26. // Class: CFileBytes
  27. //
  28. // Synopsis: CFileBytes class, publicly derived from ILockBytes
  29. //
  30. // Methods: AddRef
  31. // CFileBytes
  32. // FailWrite0
  33. // Flush
  34. // LockRegion
  35. // QueryInterface
  36. // Release
  37. // ReadAt
  38. // SetSize
  39. // Stat
  40. // UnlockRegion
  41. // WriteAt
  42. // GetSize
  43. //
  44. // Data: [_ulRef] - Reference count
  45. // [_hf] - Handle to file
  46. // [_cfail0] - Simulated failure
  47. // [_cwrite0]
  48. //
  49. // History: 06-Nov-92 AlexT Created
  50. // 30-July-1996 NarindK Modified for stgbase tests.
  51. //
  52. //--------------------------------------------------------------------------
  53. class CFileBytes : public ILockBytes
  54. {
  55. public:
  56. CFileBytes(void);
  57. ~CFileBytes(void);
  58. HRESULT Init (TCHAR *ptcPath, DWORD dwMode);
  59. void FailWrite0 (int cFail0);
  60. ULARGE_INTEGER GetSize (void);
  61. STDMETHOD (QueryInterface)(REFIID riid, LPVOID *ppvObj);
  62. STDMETHOD_ (ULONG,AddRef) (void);
  63. STDMETHOD_ (ULONG,Release) (void);
  64. STDMETHOD(ReadAt) (
  65. ULARGE_INTEGER ulOffset,
  66. VOID HUGEP *pv,
  67. ULONG cb,
  68. ULONG *pcbRead);
  69. STDMETHOD(WriteAt) (
  70. ULARGE_INTEGER ulOffset,
  71. VOID const HUGEP *pv,
  72. ULONG cb,
  73. ULONG FAR *pcbWritten);
  74. STDMETHOD(LockRegion) (
  75. ULARGE_INTEGER libOffset,
  76. ULARGE_INTEGER cb,
  77. DWORD dwLockType);
  78. STDMETHOD(UnlockRegion) (
  79. ULARGE_INTEGER libOffset,
  80. ULARGE_INTEGER cb,
  81. DWORD dwLockType);
  82. STDMETHOD(Flush) (void);
  83. STDMETHOD(SetSize) (ULARGE_INTEGER cb);
  84. STDMETHOD(Stat) (STATSTG FAR *pstatstg, DWORD grfStatFlag);
  85. private:
  86. LONG _ulRef;
  87. HFILE _hf;
  88. int _cFail0;
  89. int _cWrite0;
  90. LPSTR _pszFileName;
  91. };
  92. //+-------------------------------------------------------------------------
  93. //
  94. // Class: ILockBytesDF
  95. //
  96. // Synopsis: Derived class from VirtualDF to gnerate a docfile on custom
  97. // ILockBytes.
  98. //
  99. // Methods: GenerateVirtualDF
  100. // GenerateVirtualDFRoot
  101. //
  102. // History: 2-Aug-96 NarindK Created
  103. //
  104. // Data: [_pCFileBytes] -Pointer to custom CFileBytes instance
  105. //
  106. //--------------------------------------------------------------------------
  107. class ILockBytesDF : public VirtualDF
  108. {
  109. public:
  110. // Functions for ILockBytes DocFile tree
  111. HRESULT GenerateVirtualDF(
  112. ChanceDF *pChanceDF,
  113. VirtualCtrNode **ppvcnRoot);
  114. HRESULT GenerateVirtualDFRoot(
  115. ChanceNode *pcnRoot,
  116. CFileBytes *pCFileBytes);
  117. CFileBytes *_pCFileBytes;
  118. };
  119. #endif // #ifndef __ILKB_HXX__