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
1.8 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. COWBLOB.H
  5. History:
  6. --*/
  7. #ifndef COWBLOB_H
  8. #define COWBLOB_H
  9. class LTAPIENTRY CLocCOWBlob
  10. {
  11. public:
  12. CLocCOWBlob();
  13. CLocCOWBlob(const CLocCOWBlob &);
  14. void AssertValid(void) const;
  15. LTASSERTONLY(UINT GetWriteCount(void) const);
  16. UINT GetBlobSize(void) const;
  17. void SetBlobSize(UINT);
  18. void ReallocBlob(UINT);
  19. void SetGrowSize(UINT);
  20. void *GetPointer(void);
  21. void ReleasePointer(void);
  22. void SetBuffer(const void *, size_t);
  23. operator const void *(void) const;
  24. const CLocCOWBlob &operator=(const CLocCOWBlob &);
  25. void Serialize(CArchive &ar);
  26. void Load(CArchive &ar);
  27. void Store(CArchive &ar) const;
  28. ~CLocCOWBlob();
  29. // Comparison operators
  30. //
  31. NOTHROW int operator==(const CLocCOWBlob &) const;
  32. NOTHROW int operator!=(const CLocCOWBlob &) const;
  33. protected:
  34. private:
  35. typedef struct
  36. {
  37. DWORD RefCount;
  38. DWORD AllocSize;
  39. DWORD RequestedSize;
  40. } BlobHeader;
  41. NOTHROW void Attach(const CLocCOWBlob &);
  42. NOTHROW void Detach(void);
  43. NOTHROW void MakeWritable(void);
  44. NOTHROW BYTE * DataPointer(void) const;
  45. NOTHROW BlobHeader * GetBlobHeader(void);
  46. NOTHROW const BlobHeader * GetBlobHeader(void) const;
  47. NOTHROW DWORD & GetRefCount(void);
  48. NOTHROW DWORD GetAllocatedSize(void) const;
  49. NOTHROW DWORD GetRequestedSize(void) const;
  50. NOTHROW DWORD CalcNewSize(DWORD) const;
  51. BOOL Compare(const CLocCOWBlob &) const;
  52. BYTE *m_pBuffer;
  53. DWORD m_WriteCount;
  54. UINT m_uiGrowSize;
  55. static const UINT m_uiDefaultGrowSize;
  56. #ifdef _DEBUG
  57. static CCounter m_UsageCounter;
  58. void FillEndZone(void);
  59. void CheckEndZone();
  60. #endif
  61. };
  62. #if !defined(_DEBUG) || defined(IMPLEMENT)
  63. #include "cowblob.inl"
  64. #endif
  65. #endif // COWBLOB_H