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.

98 lines
3.0 KiB

  1. #pragma once
  2. #ifndef CACHE_H
  3. #define CACHE_H
  4. #include "nameres.h"
  5. #include "transprt.h"
  6. #include "appctx.h"
  7. // Forward declaration for friend statement.
  8. class CAssemblyEnum;
  9. class CScavenger;
  10. // ---------------------------------------------------------------------------
  11. // CCache
  12. // static cache class
  13. // ---------------------------------------------------------------------------
  14. class CCache
  15. {
  16. friend CAssemblyEnum;
  17. friend CScavenger;
  18. public:
  19. // Name res apis
  20. // Inserts entry to name resolution cache.
  21. static HRESULT InsertNameResEntry(IApplicationContext *pAppCtx,
  22. IAssemblyName *pNameSrc, IAssemblyName *pNameTrgt);
  23. // Retrieves name res entry from name resolution cache.
  24. static HRESULT RetrieveNameResEntry(IApplicationContext *pAppCtx,
  25. IAssemblyName *pNameSrc, CNameRes **ppNameRes);
  26. // Retrieves name object target from name resolution cache.
  27. static HRESULT RetrieveNameResTarget(IApplicationContext *pAppCtx,
  28. IAssemblyName *pNameSrc, IAssemblyName **ppNameTrgt);
  29. // Trans cache apis
  30. // Inserts entry to transport cache.
  31. static HRESULT InsertTransCacheEntry(IAssemblyName *pName,
  32. LPTSTR szPath, DWORD dwKBSize, DWORD dwFlags, DWORD dwCommitFlags, DWORD dwPinBits,
  33. CTransCache **ppTransCache);
  34. // Retrieves transport cache entry from transport cache.
  35. static HRESULT RetrieveTransCacheEntry(IAssemblyName *pName,
  36. DWORD dwFlags, CTransCache **ppTransCache);
  37. // Retrieves assembly in global cache with maximum
  38. // revision/build number based on name passed in.
  39. static HRESULT GetGlobalMax(IAssemblyName *pName,
  40. IAssemblyName **ppNameGlobal, CTransCache **ppTransCache);
  41. // Tests for presence of originator
  42. static BOOL IsStronglyNamed(IAssemblyName *pName);
  43. // Tests for presence of custom data
  44. static BOOL IsCustom(IAssemblyName *pName);
  45. // get assembly name object from nameres entry
  46. static HRESULT NameFromNameResEntry(
  47. CNameRes* pNRes, IAssemblyName **ppName);
  48. // get name res entry from name
  49. static HRESULT NameResEntryFromName(IApplicationContext *pAppCtx,
  50. IAssemblyName *pName, CNameRes **ppNameRes);
  51. // get trans cache entry from naming object.
  52. static HRESULT TransCacheEntryFromName(IAssemblyName *pName,
  53. DWORD dwFlags, CTransCache **ppTransCache);
  54. // get assembly name object from transcache entry.
  55. static HRESULT NameFromTransCacheEntry(
  56. CTransCache *pTC, IAssemblyName **ppName);
  57. protected:
  58. // Determines cache index from name and flags.
  59. static HRESULT ResolveCacheIndex(IAssemblyName *pName,
  60. DWORD dwFlags, LPDWORD pdwCacheId);
  61. // flush NameRes entries for deleted TransCache item
  62. static HRESULT FlushNameResEntries(CTransCache* pDeletedTransCache);
  63. // safe for delete?
  64. static BOOL IsSafeForDeletion(CTransCache* pTC);
  65. };
  66. STDAPI NukeDownloadedCache();
  67. STDAPI DeleteAssemblyFromTransportCache( LPCTSTR lpszCmdLine, DWORD *pDelCount );
  68. #endif // CACHE_H