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.

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