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.

69 lines
2.0 KiB

  1. #ifndef __A51_OBJHEAP__H_
  2. #define __A51_OBJHEAP__H_
  3. #include "heap.h"
  4. #include "absfile.h"
  5. #include "index.h"
  6. //class CAbstractIndex;
  7. class CObjectHeap
  8. {
  9. protected:
  10. BOOL m_bInit;
  11. CCritSec m_cs;
  12. CFileHeap m_Heap;
  13. CBtrIndex m_Index;
  14. // just to save universal replace
  15. CFileHeap * m_pHeap;
  16. CBtrIndex * m_pIndex;
  17. public:
  18. CObjectHeap() :m_bInit(FALSE),
  19. m_pHeap(&m_Heap), m_pIndex(&m_Index)
  20. {}
  21. virtual ~CObjectHeap(){}
  22. long Initialize(CAbstractFileSource * pAbstractSource,
  23. WCHAR * wszObjHeapName,
  24. WCHAR * wszBaseName,
  25. DWORD dwBaseNameLen);
  26. long Uninitialize(DWORD dwShutDownFlags);
  27. void InvalidateCache();
  28. long FindFirst(LPCWSTR wszPrefix, WIN32_FIND_DATAW* pfd, void** ppHandle);
  29. long FindNext(void* pHandle, WIN32_FIND_DATAW* pfd);
  30. long FindClose(void* pHandle);
  31. long WriteFile(LPCWSTR wszFilePath, DWORD dwBufferLen, BYTE* pBuffer);
  32. long DeleteFile(LPCWSTR wszFilePath);
  33. long ReadFile(LPCWSTR wszFilePath, DWORD* pdwBufferLen, BYTE** ppBuffer);
  34. // for the dump utility
  35. CBtrIndex * GetIndex(){ return m_pIndex; };
  36. CFileHeap * GetFileHeap(){ return m_pHeap; };
  37. protected:
  38. long GetIndexFileName(LPCWSTR wszFilePath, LPWSTR wszIndexFileName);
  39. long GetFileInfo(LPCWSTR wszFilePath, TOffset* pnOffset, DWORD* pdwLength);
  40. long ParseInfoFromIndexFile(LPCWSTR wszIndexFileName,
  41. TOffset* pnOffset, DWORD* pdwLength);
  42. long CreateIndexFile(LPCWSTR wszFilePath, TOffset nOffset, DWORD dwLength);
  43. long DeleteIndexFile(LPCWSTR wszFilePath, LPCWSTR wszIndexFileName);
  44. long CreateZeroLengthFile(LPCWSTR wszFilePath);
  45. long DeleteZeroLengthFile(LPCWSTR wszFilePath);
  46. DWORD GetAllocationHeaderLength();
  47. long WriteAllocation(TOffset nOffset, DWORD dwDataLength, BYTE* pData);
  48. long ReadAllocation(TOffset nOffset, DWORD dwDataLength, BYTE* pBuffer);
  49. };
  50. #endif