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.

89 lines
2.4 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. BLOBFILE.H
  5. History:
  6. --*/
  7. #ifndef ESPUTIL_BLOBFILE_H
  8. #define ESPUTIL_BLOBFILE_H
  9. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  10. // Class CBlobFile is similar to CMemFile, except that it is implemented
  11. // with a CLocCOWBlob
  12. //------------------------------------------------------------------------------
  13. //
  14. // The compiler worries when you export a class that has a base class
  15. // that is not exported. Since I *know* that CFile is exported
  16. // tell the compliler that this really isn't a problem right here.
  17. //
  18. #pragma warning(disable : 4275)
  19. class LTAPIENTRY CBlobFile : public CFile
  20. {
  21. DECLARE_DYNAMIC(CBlobFile)
  22. public:
  23. // Constructor
  24. CBlobFile(UINT nGrowBytes = 0);
  25. CBlobFile(const CLocCOWBlob &, UINT nGrowBytes = 0);
  26. virtual ~CBlobFile();
  27. virtual void AssertValid() const;
  28. UINT GetBlobSize(void) const;
  29. virtual DWORD GetPosition() const;
  30. BOOL GetStatus(CFileStatus& rStatus) const;
  31. virtual LONG Seek(LONG lOff, UINT nFrom);
  32. virtual DWORD GetLength() const;
  33. virtual void SetLength(DWORD dwNewLen);
  34. virtual UINT Read(void* lpBuf, UINT nCount);
  35. virtual void Write(const void* lpBuf, UINT nCount);
  36. virtual void Abort();
  37. virtual void Flush();
  38. virtual void Close();
  39. virtual UINT GetBufferPtr(UINT nCommand, UINT nCount = 0,
  40. void** ppBufStart = NULL, void** ppBufMax = NULL);
  41. //
  42. // These operators can't work on const objects, since they
  43. // 'fix up' the blob size.
  44. //
  45. operator const CLocCOWBlob &(void);
  46. const CLocCOWBlob &GetBlob(void);
  47. // Unsupported APIs
  48. virtual CFile* Duplicate() const;
  49. virtual void LockRange(DWORD dwPos, DWORD dwCount);
  50. virtual void UnlockRange(DWORD dwPos, DWORD dwCount);
  51. protected:
  52. // Advanced Overridables
  53. virtual BYTE* Memcpy(BYTE* lpMemTarget, const BYTE* lpMemSource, UINT nBytes);
  54. virtual void GrowFile(DWORD dwNewLen);
  55. protected:
  56. // Implementation
  57. UINT m_nGrowBytes; //unit of growth of 'm_blobData'
  58. const UINT cm_nDefaultGrowth; //default unit of growth
  59. DWORD m_nPosition; //current position within file
  60. DWORD m_nFileSize; //actual number of bytes written to the file
  61. CLocCOWBlob m_blobData; //file data
  62. BYTE * m_pBuffer; //pointer to buffer in blob
  63. };
  64. #pragma warning(default : 4275)
  65. #if !defined(_DEBUG) || defined(IMPLEMENT)
  66. #include "blobfile.inl"
  67. #endif
  68. #endif // BLOBFILE_H_