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.

122 lines
3.2 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. BLOBFILE.INL
  5. History:
  6. --*/
  7. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  8. // Gets the position with in the file. The position can be set (by calling
  9. // 'Seek()') beyond the end of the data in the file, even beyond the space
  10. // allocated for the file. In any case, 'Read()' and 'Write()' will deal with
  11. // that.
  12. //------------------------------------------------------------------------------
  13. inline
  14. DWORD //Returns current file position
  15. CBlobFile::GetPosition() const
  16. {
  17. ASSERT_VALID(this);
  18. return m_nPosition;
  19. }
  20. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  21. // Gets the actual data size in the file, which is what determines the end
  22. // of file during readings.
  23. //------------------------------------------------------------------------------
  24. inline
  25. DWORD //Returns the file data length in bytes.
  26. CBlobFile::GetLength() const
  27. {
  28. ASSERT_VALID(this);
  29. return m_nFileSize;
  30. }
  31. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  32. // Since we keep the file in memory always, we don't need to flush.
  33. //------------------------------------------------------------------------------
  34. inline
  35. void CBlobFile::Flush()
  36. {
  37. }
  38. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  39. // Aborting is like closing.
  40. //------------------------------------------------------------------------------
  41. inline
  42. void CBlobFile::Abort()
  43. {
  44. ASSERT_VALID(this);
  45. Close();
  46. }
  47. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  48. // Unsupported function
  49. //------------------------------------------------------------------------------
  50. inline
  51. void CBlobFile::LockRange(DWORD /* dwPos */, DWORD /* dwCount */)
  52. {
  53. AfxThrowNotSupportedException();
  54. }
  55. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  56. // Unsupported function
  57. //------------------------------------------------------------------------------
  58. inline
  59. void CBlobFile::UnlockRange(DWORD /* dwPos */, DWORD /* dwCount */)
  60. {
  61. AfxThrowNotSupportedException();
  62. }
  63. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  64. // Unsupported function
  65. //------------------------------------------------------------------------------
  66. inline
  67. CFile* CBlobFile::Duplicate() const
  68. {
  69. AfxThrowNotSupportedException();
  70. return NULL;
  71. }
  72. inline
  73. UINT CBlobFile::GetBlobSize(void) const
  74. {
  75. ASSERT_VALID(this);
  76. return m_blobData.GetBlobSize();
  77. }
  78. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  79. //
  80. // That's the only way to that a caller can have access to the buffer data
  81. // of the blobfile's internal cowblob.
  82. //
  83. //-----------------------------------------------------------------------------
  84. inline
  85. CBlobFile::operator const CLocCOWBlob &(void)
  86. {
  87. return GetBlob();
  88. }
  89. inline
  90. const CLocCOWBlob &
  91. CBlobFile::GetBlob(void)
  92. {
  93. if (m_pBuffer != NULL)
  94. {
  95. m_blobData.ReleasePointer();
  96. m_pBuffer = NULL;
  97. }
  98. //Set correct requested cowblob size before giving access to the data.
  99. m_blobData.ReallocBlob(m_nFileSize);
  100. return m_blobData;
  101. }