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.

390 lines
7.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. dynupdt.h
  5. Abstract:
  6. Interface for code that implements the Dynamic Update feature of Winnt32.
  7. Author:
  8. Ovidiu Temereanca (ovidiut) 06-Jul-2000
  9. Revision History:
  10. <alias> <date> <comment>
  11. --*/
  12. #define DynUpdtLogLevel Winnt32LogInformation
  13. #ifdef PRERELEASE
  14. #define TRY
  15. #define EXCEPT(e) goto __skip;
  16. #define _exception_code() 0
  17. #define END_EXCEPT __skip:;
  18. #else
  19. #define TRY __try
  20. #define EXCEPT(e) __except (e)
  21. #define END_EXCEPT
  22. #endif
  23. #define S_DUCTRL_DLL TEXT("wsdu.dll")
  24. #define S_HWDB_DLL TEXT("hwdb.dll")
  25. #define S_REGKEY_MIGRATION_DLLS_WIN9X TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup\\Migration DLLs")
  26. #define S_REGVALUE_DYNUPDT TEXT("DynUpdt")
  27. typedef
  28. BOOL
  29. (CALLBACK* PWIN9XGETINCOMPDRVS) (
  30. OUT PSTR** IncompatibleDrivers
  31. );
  32. typedef
  33. VOID
  34. (CALLBACK* PWIN9XRELEASEINCOMPDRVS) (
  35. IN PSTR* IncompatibleDrivers
  36. );
  37. typedef enum {
  38. DUS_INITIAL = 0,
  39. DUS_SKIP,
  40. DUS_PREPARING,
  41. DUS_PREPARING_CONNECTIONUNAVAILABLE,
  42. DUS_PREPARING_INVALIDURL,
  43. DUS_DOWNLOADING,
  44. DUS_DOWNLOADING_ERROR,
  45. DUS_PROCESSING,
  46. DUS_SUCCESSFUL,
  47. DUS_CANCELLED,
  48. DUS_ERROR,
  49. DUS_FATALERROR,
  50. } DUS_STATUS;
  51. typedef struct {
  52. DUS_STATUS DUStatus;
  53. BOOL Disabled;
  54. BOOL SupportQueried;
  55. BOOL SupportPresent;
  56. BOOL RestartWinnt32;
  57. BOOL PrepareWinnt32;
  58. BOOL Winnt32Restarted;
  59. BOOL Cancelled;
  60. BOOL PreserveWorkingDir;
  61. BOOL ForceRemoveWorkingDir;
  62. PTSTR RestartCmdLine;
  63. TCHAR RestartAnswerFile[MAX_PATH];
  64. TCHAR DynamicUpdatesSource[MAX_PATH];
  65. TCHAR UpdatesPath[MAX_PATH];
  66. TCHAR UpdatesCabSource[MAX_PATH];
  67. TCHAR UpdatesCabTarget[MAX_PATH];
  68. TCHAR DuasmsSource[MAX_PATH];
  69. TCHAR DuasmsTarget[MAX_PATH];
  70. TCHAR WorkingDir[MAX_PATH];
  71. TCHAR DriversSource[MAX_PATH];
  72. TCHAR SelectedDrivers[MAX_PATH];
  73. TCHAR GuidrvsInfSource[MAX_PATH];
  74. BOOL UserSpecifiedUpdates;
  75. TCHAR Winnt32Path[MAX_PATH];
  76. TCHAR TempDir[MAX_PATH];
  77. PSDLIST NewDriversList;
  78. PSTRINGLIST BootDriverPathList;
  79. DWORD IncompatibleDriversCount;
  80. //
  81. // target OS information
  82. //
  83. OSVERSIONINFOEX TargetOsVersion;
  84. TCHAR TargetPlatform[32]; // "i386", "ia64"
  85. LCID TargetLCID;
  86. //
  87. // Support libraries stuff
  88. //
  89. HWND ProgressWindow;
  90. HANDLE DuLib;
  91. HANDLE Connection;
  92. PDUISSUPPORTED DuIsSupported;
  93. PDUINITIALIZE DuInitialize;
  94. PDUDODETECTION DuDoDetection;
  95. PDUQUERYUNSUPDRVS DuQueryUnsupDrvs;
  96. PDUBEGINDOWNLOAD DuBeginDownload;
  97. PDUABORTDOWNLOAD DuAbortDownload;
  98. PDUUNINITIALIZE DuUninitialize;
  99. HANDLE HwdbLib;
  100. HANDLE HwdbDatabase;
  101. PHWDBINITIALIZE HwdbInitialize;
  102. PHWDBTERMINATE HwdbTerminate;
  103. PHWDBOPEN HwdbOpen;
  104. PHWDBCLOSE HwdbClose;
  105. PHWDBAPPENDINFS HwdbAppendInfs;
  106. PHWDBFLUSH HwdbFlush;
  107. PHWDBHASDRIVER HwdbHasDriver;
  108. PHWDBHASANYDRIVER HwdbHasAnyDriver;
  109. #ifndef UNICODE
  110. PWIN9XGETINCOMPDRVS Win9xGetIncompDrvs;
  111. PWIN9XRELEASEINCOMPDRVS Win9xReleaseIncompDrvs;
  112. #endif
  113. } DYNUPDT_STATUS, *PDYNUPDT_STATUS;
  114. extern PDYNUPDT_STATUS g_DynUpdtStatus;
  115. typedef struct {
  116. PCTSTR DownloadRoot;
  117. POSVERSIONINFOEX TargetOsVersion;
  118. PCTSTR TargetPlatform; // "i386", "ia64"
  119. LCID TargetLCID;
  120. BOOL Upgrade;
  121. PCTSTR* SourceDirs;
  122. DWORD SourceDirsCount;
  123. BOOL Unattend;
  124. PCTSTR AnswerFile;
  125. HWND ProgressWindow;
  126. PTSTR TempDir;
  127. } DYNUPDT_INIT, *PDYNUPDT_INIT;
  128. typedef struct {
  129. TCHAR BaseDir[MAX_PATH];
  130. } DYNUPDTSTATUS_INFO, *PDYNUPDTSTATUS_INFO;
  131. typedef struct {
  132. BOOL ExpressUpgrade; // WelcomeWizPage
  133. TCHAR OemPid[30]; // OemPid30WizPage
  134. TCHAR CdPid[30]; // CdPid30WizPage
  135. } RESTART_DATA, *PRESTART_DATA;
  136. extern RESTART_DATA g_RestartData;
  137. #define S_DOWNLOAD_ROOT TEXT("setupupd")
  138. #define S_CABNAME_UPDATES TEXT("updates.cab")
  139. #define S_CABNAME_UPGINFS TEXT("upginfs.cab")
  140. #define S_CABNAME_MIGDLLS TEXT("migdlls.cab")
  141. #define S_CABNAME_WINNT32 TEXT("winnt32.cab")
  142. #define S_CABNAME_IDENT TEXT("ident.cab")
  143. #define S_CABNAME_WSDUENG TEXT("wsdueng.cab")
  144. #define S_CABNAME_DUASMS TEXT("duasms.cab")
  145. #define S_SUBDIRNAME_UPDATES TEXT("updates")
  146. #define S_SUBDIRNAME_UPGINFS TEXT("upginfs")
  147. #define S_SUBDIRNAME_MIGDLLS TEXT("migdlls")
  148. #define S_SUBDIRNAME_WINNT32 TEXT("winnt32")
  149. #define S_SUBDIRNAME_DUASMS TEXT("duasms")
  150. #define S_SUBDIRNAME_TEMP TEXT("temp")
  151. #define S_SUBDIRNAME_DRIVERS TEXT("dudrvs")
  152. #define S_SECTIONNAME_UPDATES TEXT("updates")
  153. #define S_RESTART_TXT TEXT("restart.txt")
  154. #define S_PATCH_FILE_EXT TEXT("*._p1")
  155. #define S_HWCOMP_DAT TEXT("hwcomp.dat")
  156. #define S_GUI_DRIVERS_INF TEXT("guidrvs.inf")
  157. #define S_SECTION_VERSION TEXT("Version")
  158. #define S_SECTION_DRIVERS TEXT("Drivers")
  159. #define S_SECTION_EXCLUDED_DRVS TEXT("ExcludedDrivers")
  160. #define S_DRIVER_TYPE_KEY TEXT("DriversAreGuiApproved")
  161. #define S_DU_SYNC_EVENT_NAME TEXT("_WINNT32_DU_")
  162. //
  163. // if this file is present in winnt32.cab, Setup will restart unconditionally
  164. //
  165. #define S_RESTART_FILENAME TEXT("winnt32.rst")
  166. //
  167. // if this file is present in updates.cab, Setup will create a local source directory
  168. //
  169. #define S_MAKE_LS_FILENAME TEXT("updates.~ls")
  170. #define DYN_DISKSPACE_PADDING 10000000
  171. BOOL
  172. DynamicUpdateInitialize (
  173. VOID
  174. );
  175. VOID
  176. DynamicUpdateUninitialize (
  177. VOID
  178. );
  179. BOOL
  180. DynamicUpdateBuildDefaultPaths (
  181. VOID
  182. );
  183. BOOL
  184. DynamicUpdateIsSupported (
  185. IN HWND ParentWnd
  186. );
  187. BOOL
  188. __inline
  189. DynamicUpdateSuccessful (
  190. VOID
  191. )
  192. {
  193. return g_DynUpdtStatus && g_DynUpdtStatus->DUStatus == DUS_SUCCESSFUL;
  194. }
  195. DWORD
  196. WINAPI
  197. DoDynamicUpdate (
  198. LPVOID Parameter
  199. );
  200. BOOL
  201. DynamicUpdateInitDownload (
  202. IN HWND hNotifyWnd
  203. );
  204. BOOL
  205. DynamicUpdateStart (
  206. OUT PDWORD TotalEstimatedTime,
  207. OUT PDWORD TotalEstimatedSize
  208. );
  209. VOID
  210. DynamicUpdateCancel (
  211. VOID
  212. );
  213. BOOL
  214. DynamicUpdateProcessFiles (
  215. OUT PBOOL StopSetup
  216. );
  217. BOOL
  218. DynamicUpdateWriteParams (
  219. IN PCTSTR ParamsFile
  220. );
  221. BOOL
  222. DynamicUpdatePrepareRestart (
  223. VOID
  224. );
  225. BOOL
  226. Winnt32Restarted (
  227. VOID
  228. );
  229. BOOL
  230. Winnt32RestartedWithAF (
  231. VOID
  232. );
  233. BOOL
  234. WINAPI
  235. Winnt32DuIsSupported (
  236. VOID
  237. );
  238. typedef
  239. BOOL
  240. (WINAPI* PWINNT32DUISSUPPORTED) (
  241. IN PCTSTR* SourceDirs,
  242. IN DWORD Count
  243. );
  244. BOOL
  245. WINAPI
  246. Winnt32DuInitialize (
  247. IN PDYNUPDT_INIT InitData
  248. );
  249. typedef
  250. BOOL
  251. (WINAPI* PWINNT32DUINITIALIZE) (
  252. IN PDYNUPDT_INIT InitData
  253. );
  254. BOOL
  255. WINAPI
  256. Winnt32DuInitiateGetUpdates (
  257. OUT PDWORD TotalEstimatedTime,
  258. OUT PDWORD TotalEstimatedSize
  259. );
  260. typedef
  261. BOOL
  262. (WINAPI* PWINNT32DUINITIATEGETUPDATES) (
  263. OUT PDWORD TotalEstimatedTime,
  264. OUT PDWORD TotalEstimatedSize
  265. );
  266. VOID
  267. WINAPI
  268. Winnt32DuCancel (
  269. VOID
  270. );
  271. typedef
  272. VOID
  273. (WINAPI* PWINNT32DUCANCEL) (
  274. VOID
  275. );
  276. BOOL
  277. WINAPI
  278. Winnt32DuProcessFiles (
  279. OUT PBOOL StopSetup
  280. );
  281. typedef
  282. BOOL
  283. (WINAPI* PWINNT32DUPROCESSFILES) (
  284. );
  285. BOOL
  286. WINAPI
  287. Winnt32DuWriteParams (
  288. IN PCTSTR ParamsFile
  289. );
  290. typedef
  291. BOOL
  292. (WINAPI* PWINNT32DUWRITEPARAMS) (
  293. IN PCTSTR ParamsFile
  294. );
  295. VOID
  296. WINAPI
  297. Winnt32DuUninitialize (
  298. VOID
  299. );
  300. typedef
  301. VOID
  302. (WINAPI* PWINNT32DUUNINITIALIZE) (
  303. VOID
  304. );
  305. VOID
  306. BuildSifName (
  307. IN PCTSTR CabName,
  308. OUT PTSTR SifName
  309. );
  310. BOOL
  311. ProcessDownloadedFiles (
  312. OUT PBOOL StopSetup
  313. );