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.

214 lines
6.5 KiB

  1. #ifndef _SOFTDIST_H_
  2. #define _SOFTDIST_H_
  3. #ifdef __cplusplus
  4. typedef struct tagDISTUNITINST {
  5. DWORD dwInstalledVersionMS;
  6. DWORD dwInstalledVersionLS;
  7. } DISTUNITINST, *LPDISTUNITINST;
  8. typedef struct tagDISTUNITADVT {
  9. DWORD dwVersionMS;
  10. DWORD dwVersionLS;
  11. LPCSTR pszTitle;
  12. LPCSTR pszAbstract;
  13. LPCSTR pszHREF;
  14. } DISTUNITADVT, *LPDISTUNITADVT;
  15. /*
  16. STDAPI
  17. GetDistributionUnitAdvertisement(
  18. LPCWSTR szDistUnit,
  19. LPDISTUNITINST *ppdunitinst,
  20. LPDISTUNITADVT *ppdunitadvt,
  21. LPVOID pvReserved, // Must be NULL
  22. DWORD flags);
  23. */
  24. // SoftDist tag handler for CDF
  25. #define CBH_FLAGS_DOWNLOADED 0x1
  26. #define CBH_FLAGS_MAIN_CODEBASE 0x2
  27. class CCodeBaseHold {
  28. public:
  29. CCodeBaseHold() {
  30. wszCodeBase = NULL;
  31. dwSize = 0;
  32. bHREF = FALSE;
  33. wszDLGroup = NULL;
  34. dwFlags = 0;
  35. }
  36. ~CCodeBaseHold() {
  37. if (wszCodeBase) {
  38. delete wszCodeBase;
  39. }
  40. if (wszDLGroup) {
  41. delete wszDLGroup;
  42. }
  43. }
  44. LPWSTR wszCodeBase;
  45. DWORD dwSize;
  46. BOOL bHREF;
  47. LPWSTR wszDLGroup;
  48. DWORD dwFlags;
  49. };
  50. // Helper prototypes
  51. BOOL AreAllLanguagesPresent(LPCSTR lpszLang1, LPCSTR lpszLang2);
  52. HRESULT GetStyleFromString(LPSTR szStyle, LPDWORD lpdwStyle);
  53. HRESULT CheckLanguage(LCID localeID, LPTSTR szLanguages);
  54. class CSoftDist : public ISoftDistExt {
  55. public:
  56. CSoftDist();
  57. ~CSoftDist();
  58. // IUnknown methods
  59. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  60. STDMETHODIMP_(ULONG) AddRef();
  61. STDMETHODIMP_(ULONG) Release();
  62. // ISoftDistExt methods
  63. STDMETHODIMP ProcessSoftDist(LPCWSTR szCDFURL, IXMLElement *pSoftDistElement, LPSOFTDISTINFO);
  64. STDMETHODIMP GetFirstCodeBase(LPWSTR *szCodeBase, DWORD *dwMaxSize);
  65. STDMETHODIMP GetNextCodeBase(LPWSTR *szCodeBase, DWORD *dwMaxSize);
  66. STDMETHODIMP AsyncInstallDistributionUnit(IBindCtx *pbc, LPVOID pvReserved, DWORD flags, LPCODEBASEHOLD lpcbh);
  67. // helper methods for GetSoftwareUpdateInfo
  68. HRESULT GetSoftwareUpdateInfo( LPCWSTR szDistUnit, LPSOFTDISTINFO psdi );
  69. HRESULT SetSoftwareUpdateAdvertisementState( LPCWSTR szDistUnit,
  70. DWORD dwAdState,
  71. DWORD dwAdvertisedVersionMS,
  72. DWORD dwAdvertisedVersionLS );
  73. // Other functions
  74. STDMETHODIMP Logo3Download(LPWSTR szCodeBase);
  75. STDMETHODIMP Logo3DownloadNext();
  76. STDMETHODIMP Logo3DownloadRedundant();
  77. private:
  78. HRESULT IsLocallyInstalled(LPCWSTR szDistUnit, DWORD dwVersionMS, DWORD dwVersionLS, LPCSTR szLanguages, DWORD style);
  79. HRESULT IsICDLocallyInstalled(LPCWSTR szDistUnit, DWORD dwVersionMS, DWORD dwVersionLS, LPCSTR szLanguages);
  80. HRESULT IsActSetupLocallyInstalled(LPCWSTR szDistUnit, DWORD dwVersionMS, DWORD dwVersionLS, LPCSTR szLanguages);
  81. HRESULT IsLogo3LocallyInstalled(LPCWSTR szDistUnit, DWORD dwVersionMS, DWORD dwVersionLS, LPCSTR szLanguages);
  82. HRESULT IsLogo3Advertised(LPBOOL lpfIsPrecached, LPBOOL lpfIsAuthorizedCDF);
  83. HRESULT IsICDAdvertised(LPBOOL lpfIsPrecached, LPBOOL lpfIsAuthorizedCDF);
  84. HRESULT IsActSetupAdvertised(LPBOOL lpfIsPrecached, LPBOOL lpfIsAuthorizedCDF);
  85. HRESULT IsAdvertised(LPBOOL lpfIsPrecached, LPBOOL lpfIsAuthorizedCDF);
  86. HRESULT Advertise(BOOL bFullAdvt);
  87. HRESULT ICDAdvertise(BOOL bFullAdvt);
  88. HRESULT ActSetupAdvertise(BOOL bFullAdvt);
  89. HRESULT Logo3Advertise(BOOL bFullAdvt);
  90. HRESULT CheckDependency(IXMLElement *pSoftDist);
  91. HRESULT CheckConfig(IXMLElement *pSoftDist);
  92. BOOL IsCDFNewerVersion(DWORD dwCurMS, DWORD dwCurLS);
  93. BOOL IsAuthorizedCDF(HKEY hkRootDU, BOOL bOptional=FALSE);
  94. BOOL IsAnyInstalled() {
  95. return (m_distunitinst.dwInstalledVersionMS | m_distunitinst.dwInstalledVersionLS);
  96. }
  97. LPCWSTR GetMainDistUnit() const { return m_szDistUnit;}
  98. LPCSTR GetCDF() const { return m_szCDFURL;}
  99. HRESULT PrepSoftwareUpdate( LPCWSTR szDistUnit, DWORD *pdwStyle );
  100. #ifdef WX86
  101. CMultiArch * GetMultiArch() { return &m_MultiArch; }
  102. #endif
  103. DWORD m_cRef;
  104. LPWSTR m_szDistUnit;
  105. DWORD m_dwVersionMS;
  106. DWORD m_dwVersionLS;
  107. DWORD m_dwVersionAdvertisedMS;
  108. DWORD m_dwVersionAdvertisedLS;
  109. DWORD m_dwAdState;
  110. DWORD m_Style;
  111. LPSTR m_szCDFURL;
  112. LPSTR m_szTitle;
  113. LPSTR m_szLanguages;
  114. LPSTR m_szAbstract;
  115. LPSTR m_szHREF;
  116. CList<CCodeBaseHold*,CCodeBaseHold*> m_cbh;
  117. POSITION m_curPos;
  118. ISoftDistExt *m_sdMSInstall; // Darwin interface
  119. DISTUNITINST m_distunitinst;
  120. IBindStatusCallback *m_pClientBSC;
  121. LPWSTR m_szBaseURL;
  122. #ifdef WX86
  123. CMultiArch m_MultiArch;
  124. #endif
  125. };
  126. class CActiveSetupBinding : IBinding
  127. {
  128. friend DWORD StartActiveSetup(void *dwArg);
  129. public:
  130. CActiveSetupBinding(IBindCtx *pbc, IBindStatusCallback *pbsc, LPWSTR szCodeBase,
  131. LPWSTR szDistUnit, HRESULT *hr);
  132. ~CActiveSetupBinding();
  133. // IUnknown methods
  134. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  135. STDMETHODIMP_(ULONG) AddRef();
  136. STDMETHODIMP_(ULONG) Release();
  137. // IBinding methods
  138. STDMETHOD(Abort)( void);
  139. STDMETHOD(Suspend)( void);
  140. STDMETHOD(Resume)( void);
  141. STDMETHOD(SetPriority)(LONG nPriority);
  142. STDMETHOD(GetPriority)(LONG *pnPriority);
  143. STDMETHOD(GetBindResult)(CLSID *pclsidProtocol, DWORD *pdwResult, LPWSTR *pszResult,DWORD *pdwReserved);
  144. private:
  145. void StartActiveSetup(void);
  146. void DoCleanUp(DWORD dwExitCode);
  147. BSTR GetErrorMessage(HRESULT hr);
  148. HRESULT SaveHresult(HRESULT hr);
  149. HRESULT SetDefaultDownloadSite(LPSTR szSite);
  150. IBindStatusCallback *m_pbsc;
  151. IBindCtx *m_pbc;
  152. LPSTR m_szCodeBase;
  153. CHAR m_szActSetupPath[MAX_PATH+1];
  154. LPSTR m_szDistUnit;
  155. HANDLE m_hWaitThread;
  156. PROCESS_INFORMATION m_piChild;
  157. DWORD dwThreadID;
  158. DWORD m_dwRef;
  159. BOOL fSilent;
  160. };
  161. #endif
  162. #endif // _SOFTDIST_H_