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.

87 lines
2.6 KiB

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