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.

144 lines
6.4 KiB

  1. #pragma once
  2. #ifndef __ADLMGR_H_INCLUDED__
  3. #define __ADLMGR_H_INCLUDED__
  4. #include "dbglog.h"
  5. #define PREFIX_HTTP L"http://"
  6. #define BINPATH_LIST_DELIMITER L';'
  7. #define SHADOW_COPY_DIR_DELIMITER L';'
  8. extern const LPWSTR g_wzProbeExtension;
  9. class CDebugLog;
  10. class CHashNode;
  11. class CAsmDownloadMgr : public IDownloadMgr, public ICodebaseList
  12. {
  13. public:
  14. CAsmDownloadMgr(IAssemblyName *pNameRefSource, IApplicationContext *pAppCtx,
  15. ICodebaseList *pCodebaseList, CDebugLog *pdbglog,
  16. LONGLONG llFlags);
  17. virtual ~CAsmDownloadMgr();
  18. static HRESULT Create(CAsmDownloadMgr **ppadm,
  19. IAssemblyName *pNameRefSource,
  20. IApplicationContext *pAppCtx,
  21. ICodebaseList *pCodebaseList,
  22. LPCWSTR wzBTOCodebase,
  23. CDebugLog *pdbglog,
  24. void *pvReserved,
  25. LONGLONG llFlags);
  26. // IUnknown methods
  27. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  28. STDMETHODIMP_(ULONG) AddRef();
  29. STDMETHODIMP_(ULONG) Release();
  30. // IDownloadMgr methods
  31. STDMETHODIMP PreDownloadCheck(void **ppv);
  32. STDMETHODIMP PreDownloadCheck2(void **ppv);
  33. STDMETHODIMP DoSetup(LPCWSTR wzSourceUrl, LPCWSTR wzFilePath,
  34. IUnknown **ppUnk);
  35. STDMETHODIMP ProbeFailed(IUnknown **ppUnk);
  36. STDMETHODIMP ProbeFailed2(IUnknown **ppUnk);
  37. STDMETHODIMP IsDuplicate(IDownloadMgr *pIDLMgr);
  38. STDMETHODIMP_(BOOL) LogResult();
  39. // ICodebaseList methods
  40. STDMETHODIMP AddCodebase(LPCWSTR wzCodebase);
  41. STDMETHODIMP RemoveCodebase(DWORD dwIndex);
  42. STDMETHODIMP GetCodebase(DWORD dwIndex, LPWSTR wzCodebase, DWORD *pcbCodebase);
  43. STDMETHODIMP GetCount(DWORD *pdwCount);
  44. STDMETHODIMP RemoveAll();
  45. // Helpers
  46. STDMETHODIMP GetPolicyRef(IAssemblyName **ppName);
  47. private:
  48. HRESULT Init(LPCWSTR wzBTOCodebase, void *pvReserved);
  49. // Helpers
  50. HRESULT SetDefaultSID(FILETIME ftLastModified);
  51. HRESULT LookupFromGlobalCache(LPASSEMBLY *ppAsmOut);
  52. HRESULT DoSetupRFS(LPCWSTR wzFilePath, FILETIME *pftLastModified,
  53. LPCWSTR wzSourceUrl, BOOL bWhereRefBind);
  54. HRESULT DoSetupPushToCache(LPCWSTR wzFilePath, LPCWSTR wzSourceUrl,
  55. FILETIME *pftLastModified,
  56. BOOL bWhereRefBind, BOOL bCopyModules);
  57. #ifndef NEW_POLICY_CODE
  58. HRESULT GetCodebaseHint(LPWSTR wzCodebaseHint, DWORD *pdwSize);
  59. #endif
  60. HRESULT GetBinPathHint(BOOL bIsShared, LPWSTR *ppwzBinPathHint);
  61. HRESULT SetupCAB(LPCWSTR wzFilePath, LPCWSTR wzSourceUrl, BOOL bWhereRefBind);
  62. HRESULT ShadowCopyDirCheck(LPCWSTR wzSourceURL);
  63. HRESULT CheckRunFromSource(LPCWSTR wzSourceUrl, BOOL *pbRunFromSource);
  64. HRESULT CheckMSIInstallAvailable() const;
  65. HRESULT MSIInstallAssembly(LPCWSTR wzContext, LPCWSTR wzSourceUrl, IAssembly **ppAsm);
  66. HRESULT SetupMSI(LPCWSTR wzFilePath);
  67. // Probing URL generation
  68. HRESULT ConstructCodebaseList(LPCWSTR wzPolicyCodebase);
  69. HRESULT SetupDefaultProbeList(LPCWSTR wzAppBaseStr, LPCWSTR wzProbeFileName,
  70. ICodebaseList *pCodebaseList);
  71. HRESULT PrepBinPaths(BOOL bIsPartial, BOOL bIsShared,
  72. LPCWSTR wzNameProbe, LPWSTR *ppwzUserBinPathList);
  73. HRESULT PrepPrivateBinPath(LPCWSTR wzNameProbe, LPWSTR *ppwzPrivateBinPath);
  74. HRESULT PrepSharedBinPath(LPWSTR *ppwzSharedBinPath);
  75. HRESULT ConcatenateBinPaths(LPCWSTR pwzPath1, LPCWSTR pwzPath2,
  76. LPWSTR *ppwzOut);
  77. HRESULT ApplyHeuristics(const WCHAR *pwzHeuristics[],
  78. const unsigned int uiNumHeuristics,
  79. WCHAR *pwzValues[], LPCWSTR wzPrefix,
  80. LPCWSTR wzExtension,
  81. ICodebaseList *pCodebaseList,
  82. List<CHashNode *> aHashList[]);
  83. HRESULT ExtractSubstitutionVars(WCHAR *pwzValues[]);
  84. HRESULT ExpandVariables(LPCWSTR pwzHeuristic, WCHAR *pwzValues[],
  85. LPWSTR wzBuf, int iMaxLen);
  86. LPWSTR GetNextDelimitedString(LPWSTR *ppwzList, WCHAR wcDelimiter);
  87. HRESULT GenerateProbeUrls(LPCWSTR wzBinPathList, LPCWSTR wzAppBase,
  88. LPCWSTR wzExt, LPWSTR wzValues[],
  89. ICodebaseList *pCodebaseList, BOOL bIsShared);
  90. HRESULT CheckProbeUrlDupe(List<CHashNode *> paHashList[],
  91. LPCWSTR pwzSource) const;
  92. DWORD HashString(LPCWSTR pwzSource) const;
  93. HRESULT CreateAssembly2(LPCWSTR szPath, LPCWSTR pszURL,
  94. FILETIME *pftLastModTime,
  95. BOOL bRunFromSource,
  96. IAssembly **ppAsmOut);
  97. private:
  98. DWORD _dwSig;
  99. ULONG _cRef;
  100. BOOL _bDoGlobalCacheLookup;
  101. LONGLONG _llFlags;
  102. LPWSTR _wzBTOCodebase;
  103. LPWSTR _wzSharedPathHint;
  104. IAssemblyName *_pNameRefSource;
  105. IAssemblyName *_pNameRefPolicy;
  106. IApplicationContext *_pAppCtx;
  107. IAssembly *_pAsm;
  108. ICodebaseList *_pCodebaseList;
  109. CDebugLog *_pdbglog;
  110. };
  111. HRESULT CreateAssembly(IApplicationContext *pAppCtx, IAssemblyName* pNameRef,
  112. IAssemblyName *pNameRefPolicy,LPCOLESTR szPath, LPCOLESTR pszURL,
  113. FILETIME *pftLastModTime, BOOL bRunFromSource, CDebugLog *pdbglog,
  114. IAssembly **ppAsmOut);
  115. HRESULT CheckValidAsmLocation(IAssemblyName *pNameDef, LPCWSTR wzSourceUrl,
  116. IApplicationContext *pAppCtx,
  117. CDebugLog *pdbglog);
  118. #endif