Guest User

Untitled

a guest
Feb 16th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <windows.h>
  4. #include <boost/unordered_map.hpp>
  5. #include "../eterBase/Singleton.h"
  6. #include "../eterBase/Stl.h"
  7.  
  8. #include "EterPack.h"
  9.  
  10. #ifdef USE_FOX_FS
  11. #include "FoxFS.h"
  12. #endif
  13.  
  14. class CEterPackManager : public CSingleton<CEterPackManager>
  15. {
  16. public:
  17. struct SCache
  18. {
  19. BYTE* m_abBufData;
  20. DWORD m_dwBufSize;
  21. };
  22. public:
  23. #if defined(USE_FOX_FS)
  24. enum ESearchModes
  25. {
  26. SEARCH_FILE,
  27. SEARCH_PACK
  28. };
  29.  
  30. enum ESearchModes2
  31. {
  32. SEARCH_FILE_FIRST,
  33. SEARCH_PACK_FIRST
  34. };
  35. #else
  36. enum ESearchModes
  37. {
  38. SEARCH_FILE_FIRST,
  39. SEARCH_PACK_FIRST
  40. };
  41. #endif
  42.  
  43. typedef std::list<CEterPack*> TEterPackList;
  44. typedef boost::unordered_map<std::string, CEterPack*, stringhash> TEterPackMap;
  45.  
  46. public:
  47. CEterPackManager();
  48. virtual ~CEterPackManager();
  49.  
  50. void SetCacheMode();
  51. void SetRelativePathMode();
  52.  
  53. void LoadStaticCache(const char* c_szFileName);
  54.  
  55. void SetSearchMode(bool bPackFirst);
  56. int GetSearchMode();
  57.  
  58. //THEMIDA
  59. bool Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
  60.  
  61. //THEMIDA
  62. bool GetFromPack(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
  63.  
  64. //THEMIDA
  65. bool GetFromFile(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
  66. bool isExist(const char * c_szFileName);
  67. bool isExistInPack(const char * c_szFileName);
  68.  
  69. bool RegisterPack(const char * c_szName, const char * c_szDirectory, const BYTE* c_pbIV = NULL);
  70. void RegisterRootPack(const char * c_szName);
  71. bool RegisterPackWhenPackMaking(const char * c_szName, const char * c_szDirectory, CEterPack* pPack);
  72.  
  73.  
  74. bool DecryptPackIV(DWORD key);
  75.  
  76. const char * GetRootPackFileName();
  77.  
  78. //for hybridcrypt
  79. //THEMIDA
  80. void WriteHybridCryptPackInfo(const char* pFileName);
  81.  
  82. //THEMIDA
  83. void RetrieveHybridCryptPackKeys( const BYTE* pStream );
  84. //THEMIDA
  85. void RetrieveHybridCryptPackSDB( const BYTE* pStream );
  86.  
  87. // 메모리에 매핑된 팩들 가운데, 정리해야할 것들 정리.
  88. public:
  89. void ArrangeMemoryMappedPack();
  90.  
  91. protected:
  92. int ConvertFileName(const char * c_szFileName, std::string & rstrFileName); // StringPath std::string 버전
  93. bool CompareName(const char * c_szDirectoryName, DWORD iLength, const char * c_szFileName);
  94.  
  95. CEterPack* FindPack(const char* c_szPathName);
  96.  
  97. SCache* __FindCache(DWORD dwFileNameHash);
  98. void __ClearCacheMap();
  99.  
  100. protected:
  101. bool m_bTryRelativePath;
  102. bool m_isCacheMode;
  103. int m_iSearchMode;
  104.  
  105. CEterFileDict m_FileDict;
  106. CEterPack m_RootPack;
  107. TEterPackList m_PackList;
  108. TEterPackMap m_PackMap;
  109. TEterPackMap m_DirPackMap;
  110.  
  111. boost::unordered_map<DWORD, SCache> m_kMap_dwNameKey_kCache;
  112.  
  113. CRITICAL_SECTION m_csFinder;
  114.  
  115. #ifdef USE_FOX_FS
  116. PFoxFS m_pFoxFS;
  117. #endif
  118. };
Advertisement
Add Comment
Please, Sign In to add comment