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.

63 lines
2.2 KiB

  1. #include "asmstrm.h"
  2. #include "transprt.h"
  3. #include <windows.h>
  4. #include "dbglog.h"
  5. #define TRANSPORT_CACHE_FLAGS_REGENERATION 0x100
  6. #define TRANSPORT_CACHE_REGENERATION_IDX_OFFSET 0x100
  7. class CAssemblyCacheRegenerator
  8. {
  9. protected:
  10. DWORD _dwSig;
  11. CDebugLog *_pdbglog;
  12. // for cross process locking
  13. HANDLE _hRegeneratorMutex;
  14. // storage for lock that CDatabase::Lock returns
  15. HLOCK _hlTransCacheLock[TRANSPORT_CACHE_IDX_TOTAL];
  16. HLOCK _hlNameResLock;
  17. HLOCK _hlNewGlobalCacheLock;
  18. // interface to temporary cache index files
  19. static IDatabase *g_pDBNewCache[TRANSPORT_CACHE_IDX_TOTAL];
  20. static IDatabase *g_pDBNewNameRes;
  21. // reentrancy protection flags
  22. BOOL _fThisInstanceIsRegenerating;
  23. static DWORD g_dwRegeneratorRunningInThisProcess;
  24. // which database are we regenerating
  25. DWORD _dwCacheId;
  26. // we are regenerating NameRes (TRUE) TransCache (FALSE)
  27. BOOL _fIsNameRes;
  28. public:
  29. CAssemblyCacheRegenerator(CDebugLog *pdbglog, DWORD dwCacheId, BOOL fIsNameRes);
  30. ~CAssemblyCacheRegenerator();
  31. HRESULT Init();
  32. HRESULT Regenerate();
  33. static HRESULT SetSchemaVersion(DWORD dwNewMinorVersion, DWORD dwCacheId, BOOL fIsNameRes);
  34. private:
  35. static HRESULT CreateRegenerationTransCache(DWORD dwCacheId, CTransCache **CTransCache);
  36. HRESULT ProcessStoreDir();
  37. HRESULT RegenerateGlobalCache();
  38. HRESULT CreateEmptyCache();
  39. HRESULT ProcessSubDir(LPTSTR szCurrentDir, LPTSTR szSubDir);
  40. HRESULT LockFusionCache();
  41. HRESULT UnlockFusionCache();
  42. HRESULT CloseCacheRegeneratedDatabase();
  43. //temporary method for checking whether assembly is a ZAP assembly
  44. HRESULT IsZAPAssembly(LPTSTR szPath, LPBOOL pfZap);
  45. HRESULT DeleteFilesInDirectory(LPTSTR szDirectory);
  46. // CCache::InsertTransCacheEntry needs access to CreateRegenerationTransCache
  47. friend class CCache;
  48. };
  49. HRESULT RegenerateCache(CDebugLog *pdbg, DWORD dwCacheId, BOOL fIsNameRes);