Leaked source code of windows server 2003
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.

190 lines
5.8 KiB

  1. #pragma once
  2. #include "List.h"
  3. #include "assemblycache.h"
  4. #include "dbglog.h"
  5. class CGlobalCacheInstallEntry;
  6. class CDownloadDlg;
  7. class CAssemblyDownload : public IAssemblyDownload
  8. {
  9. public:
  10. // IUnknown methods
  11. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  12. STDMETHODIMP_(ULONG) AddRef();
  13. STDMETHODIMP_(ULONG) Release();
  14. // IBackgroundCopyCallback methods
  15. STDMETHOD(JobTransferred)(
  16. /* in */ IBackgroundCopyJob *pJob);
  17. STDMETHOD(JobError)(
  18. /* in */ IBackgroundCopyJob* pJob,
  19. /* in */ IBackgroundCopyError* pError);
  20. STDMETHOD(JobModification)(
  21. /* in */ IBackgroundCopyJob* pJob,
  22. /* in */ DWORD dwReserved);
  23. // IAssemblyDownload methods
  24. STDMETHOD(DownloadManifestAndDependencies)(
  25. /* in */ LPWSTR wzApplicationManifestUrl, IAssemblyBindSink *pBindSink, DWORD dwFlags);
  26. STDMETHOD(CancelDownload)();
  27. CAssemblyDownload();
  28. ~CAssemblyDownload();
  29. HRESULT Init( CDebugLog * pDbgLog);
  30. static HRESULT InitBITS();
  31. CDebugLog *_pDbgLog;
  32. BOOL _bLocalLog;
  33. private:
  34. HRESULT DoCacheUpdate(IBackgroundCopyJob *pJob);
  35. HRESULT HandleManifest(IBackgroundCopyFile *pFile,
  36. IBackgroundCopyJob **ppJob);
  37. HRESULT HandleSubscriptionManifest(
  38. IAssemblyManifestImport *pManifestImport,
  39. CString &sLocalName, CString &sRemoteName,
  40. IBackgroundCopyJob **ppJob);
  41. HRESULT HandleApplicationManifest(
  42. IAssemblyManifestImport *pManifestImport,
  43. CString &sLocalName, CString &sRemoteName,
  44. IBackgroundCopyJob **ppJob);
  45. HRESULT HandleComponentManifest(
  46. IAssemblyManifestImport *pManifestImport,
  47. CString &sLocalName, CString &sRemoteName,
  48. IBackgroundCopyJob **ppJob);
  49. HRESULT HandleFile(IBackgroundCopyFile *pFile);
  50. HRESULT EnqueueDependencies(IUnknown* pUnk,
  51. CString &sRemoteName, IBackgroundCopyJob **ppJob);
  52. HRESULT EnqueueSubscriptionDependencies(
  53. IAssemblyManifestImport *pManifestImport, CString &sCodebase,
  54. CString& sDisplayName, IBackgroundCopyJob **ppJob);
  55. HRESULT EnqueueApplicationDependencies(IAssemblyCacheImport *pCacheImport,
  56. CString &sCodebase, CString& sDisplayName, IBackgroundCopyJob **ppJob);
  57. HRESULT EnqueueComponentDependencies(IAssemblyCacheImport *pCacheImport,
  58. CString &sCodebase, CString& sDisplayName, BOOL fRecurse, IBackgroundCopyJob **ppJob);
  59. HRESULT LookupPatchInfo(IAssemblyCacheImport *pCacheImport);
  60. HRESULT ApplyPatchFile (LPWSTR pwzFilePath);
  61. HRESULT ResolveFile(CString &sFileName, CString &sLocalFilePath);
  62. HRESULT CleanUpPatchDir();
  63. static HRESULT GetBITSErrorMsg(IBackgroundCopyError *pError, CString &sMessage);
  64. HRESULT CreateNewBITSJob(IBackgroundCopyJob **ppJob,
  65. CString &sDisplayName);
  66. HRESULT MakeTempManifestLocation(CString &sAssemblyName,
  67. CString& sManifestFilePath);
  68. HRESULT CleanUpTempFilesOnError(IBackgroundCopyJob *pJob);
  69. HRESULT IsManifestFile(IBackgroundCopyFile *pFile, BOOL *pbIsManifestFile);
  70. HRESULT InstallGlobalAssemblies();
  71. VOID SetJobObject(IBackgroundCopyJob *pJob);
  72. HRESULT SetErrorCode(HRESULT dwHr);
  73. HRESULT FinishDownload();
  74. HRESULT SignalAbort();
  75. HRESULT HandleError(IBackgroundCopyError *pError, IBackgroundCopyJob *pJob);
  76. HRESULT DoEvilAvalonRegistrationHack();
  77. HRESULT IsAvalonAssembly(IAssemblyIdentity *pId, BOOL *pbIsAvalon);
  78. DWORD _dwSig;
  79. LONG _cRef;
  80. HRESULT _hr;
  81. HRESULT _hrError;
  82. CString _sAppBase;
  83. CString _sAppDisplayName;
  84. IAssemblyCacheEmit *_pRootEmit;
  85. IAssemblyBindSink *_pBindSink;
  86. IBackgroundCopyJob *_pJob;
  87. CDownloadDlg *_pDlg;
  88. IManifestInfo *_pPatchingInfo;
  89. List <CGlobalCacheInstallEntry*> _ListGlobalCacheInstall;
  90. BOOL _bAbort;
  91. BOOL _bAbortFromBindSink;
  92. BOOL _bErrorHandled;
  93. CRITICAL_SECTION _cs;
  94. friend CDownloadDlg;
  95. friend HRESULT CreateAssemblyDownload(IAssemblyDownload **ppAssemblyDownload, CDebugLog *pDbgLog, DWORD dwFlags);
  96. };
  97. ///////////////////////////////////////////////////////////////////////////////
  98. class CBitsCallback : public IBackgroundCopyCallback
  99. {
  100. public:
  101. // IUnknown methods
  102. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  103. STDMETHODIMP_(ULONG) AddRef();
  104. STDMETHODIMP_(ULONG) Release();
  105. // IBackgroundCopyCallback methods
  106. STDMETHOD(JobTransferred)(
  107. /* in */ IBackgroundCopyJob *pJob);
  108. STDMETHOD(JobError)(
  109. /* in */ IBackgroundCopyJob* pJob,
  110. /* in */ IBackgroundCopyError* pError);
  111. STDMETHOD(JobModification)(
  112. /* in */ IBackgroundCopyJob* pJob,
  113. /* in */ DWORD dwReserved);
  114. CBitsCallback(IAssemblyDownload *pDownload);
  115. ~CBitsCallback();
  116. DWORD _dwSig;
  117. LONG _cRef;
  118. HRESULT _hr;
  119. IAssemblyDownload *_pDownload;
  120. };
  121. ///////////////////////////////////////////////////////////////////////////////
  122. class CGlobalCacheInstallEntry
  123. {
  124. public:
  125. CGlobalCacheInstallEntry();
  126. ~CGlobalCacheInstallEntry();
  127. IAssemblyCacheImport* _pICacheImport;
  128. CString _sCurrentAssemblyPath;
  129. private:
  130. DWORD _dwSig;
  131. };
  132. extern IBackgroundCopyManager* g_pBITSManager;
  133. HRESULT InitBITS();
  134. HRESULT DeleteAssemblyAndModules(LPWSTR pszManifestFilePath);