Source code of Windows XP (NT5)
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.

71 lines
2.4 KiB

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