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.

83 lines
2.9 KiB

  1. //***************************************************************************
  2. //
  3. // (c) 2001 by Microsoft Corp. All Rights Reserved.
  4. //
  5. //***************************************************************************
  6. #ifndef __A51_OBJHEAP__H_
  7. #define __A51_OBJHEAP__H_
  8. #include "index.h"
  9. #include "VarObjHeap.h"
  10. typedef DWORD TOffset;
  11. typedef DWORD TPage;
  12. class CObjectHeap
  13. {
  14. protected:
  15. BOOL m_bInit;
  16. CVarObjHeap m_Heap;
  17. CBtrIndex m_Index;
  18. bool KeyRootInstancePath(const wchar_t *wszPath);
  19. public:
  20. CObjectHeap() :m_bInit(FALSE)
  21. {}
  22. virtual ~CObjectHeap(){}
  23. long Initialize(CPageSource * pAbstractSource,
  24. WCHAR * wszBaseName,
  25. DWORD dwBaseNameLen);
  26. long Uninitialize(DWORD dwShutDownFlags);
  27. //Transaction aborts require caches to be flushed and re-read
  28. void InvalidateCache();
  29. long FlushCaches();
  30. //File read/write methods
  31. long WriteObject(LPCWSTR wszFilePath1, LPCWSTR wszFilePath2, DWORD dwBufferLen, BYTE* pBuffer);
  32. long WriteLink(LPCWSTR wszLinkPath);
  33. long DeleteObject(LPCWSTR wszFilePath);
  34. long DeleteLink(LPCWSTR wszLinkPath);
  35. long DeleteNode(LPCWSTR wszNodeName);
  36. long ReadObject(LPCWSTR wszFilePath, DWORD* pdwBufferLen, BYTE** ppBuffer);
  37. long ReadNextIndex(CFileName &wszSearch, CFileName &wszNextIndex);
  38. // for the dump utility
  39. CBtrIndex * GetIndex(){ return &m_Index; };
  40. CVarObjHeap * GetFileHeap(){ return &m_Heap; };
  41. long ObjectEnumerationBegin(const wchar_t *wszSearchPrefix, void **ppHandle);
  42. long ObjectEnumerationEnd(void *pHandle);
  43. long ObjectEnumerationNext(void *pHandle, CFileName &wszFileName, BYTE **ppBlob, DWORD *pdwSize);
  44. long ObjectEnumerationFree(void *pHandle, BYTE *pBlob);
  45. long IndexEnumerationBegin(const wchar_t *wszSearchPrefix, void **ppHandle);
  46. long IndexEnumerationEnd(void *pHandle);
  47. long IndexEnumerationNext(void *pHandle, CFileName &wszFileName, bool bCopyFullPath = false);
  48. protected:
  49. long GetIndexFileName(LPCWSTR wszFilePath, CFileName& wszIndexFileName);
  50. long GetFileInfo(LPCWSTR wszFilePath, TPage *pnPage, TOffset* pnOffset, DWORD* pdwLength);
  51. long ParseInfoFromIndexFile(LPCWSTR wszIndexFileName, TPage *pnPage, TOffset* pnOffset, DWORD* pdwLength);
  52. long CreateIndexFile(LPCWSTR wszFilePath, TPage nPage, TOffset nOffset, DWORD dwLength);
  53. long DeleteIndexFile(LPCWSTR wszFilePath, LPCWSTR wszIndexFileName);
  54. long CreateZeroLengthFile(LPCWSTR wszFilePath);
  55. long DeleteZeroLengthFile(LPCWSTR wszFilePath);
  56. long WriteAllocation(DWORD dwDataLength, BYTE* pData, TPage *pnPage, TOffset *pnOffset);
  57. long WriteExistingAllocation(TPage nOldPage, TOffset nOldOffset, DWORD dwBufferLen, BYTE *pBuffer, DWORD *pnNewPage, DWORD *pnNewOffset);
  58. long ReadAllocation(TPage nPage, TOffset nOffset, DWORD dwDataLength, BYTE* pBuffer);
  59. };
  60. #endif