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.

193 lines
5.9 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. #ifdef DEVMODE
  95. BOOL _bIsDevMode;
  96. #endif
  97. friend CDownloadDlg;
  98. friend HRESULT CreateAssemblyDownload(IAssemblyDownload **ppAssemblyDownload, CDebugLog *pDbgLog, DWORD dwFlags);
  99. };
  100. ///////////////////////////////////////////////////////////////////////////////
  101. class CBitsCallback : public IBackgroundCopyCallback
  102. {
  103. public:
  104. // IUnknown methods
  105. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  106. STDMETHODIMP_(ULONG) AddRef();
  107. STDMETHODIMP_(ULONG) Release();
  108. // IBackgroundCopyCallback methods
  109. STDMETHOD(JobTransferred)(
  110. /* in */ IBackgroundCopyJob *pJob);
  111. STDMETHOD(JobError)(
  112. /* in */ IBackgroundCopyJob* pJob,
  113. /* in */ IBackgroundCopyError* pError);
  114. STDMETHOD(JobModification)(
  115. /* in */ IBackgroundCopyJob* pJob,
  116. /* in */ DWORD dwReserved);
  117. CBitsCallback(IAssemblyDownload *pDownload);
  118. ~CBitsCallback();
  119. DWORD _dwSig;
  120. LONG _cRef;
  121. HRESULT _hr;
  122. IAssemblyDownload *_pDownload;
  123. };
  124. ///////////////////////////////////////////////////////////////////////////////
  125. class CGlobalCacheInstallEntry
  126. {
  127. public:
  128. CGlobalCacheInstallEntry();
  129. ~CGlobalCacheInstallEntry();
  130. IAssemblyCacheImport* _pICacheImport;
  131. CString _sCurrentAssemblyPath;
  132. private:
  133. DWORD _dwSig;
  134. };
  135. extern IBackgroundCopyManager* g_pBITSManager;
  136. HRESULT InitBITS();
  137. HRESULT DeleteAssemblyAndModules(LPWSTR pszManifestFilePath);