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.

2499 lines
50 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <commctrl.h>
  6. #include <commdlg.h>
  7. #include <winioctl.h>
  8. #include <setupbat.h>
  9. #include <setupapi.h>
  10. #include <winnls.h>
  11. #include <shlwapi.h>
  12. #include <winspool.h>
  13. #include <wininet.h>
  14. #include <tchar.h>
  15. #include <malloc.h>
  16. #include <stdlib.h>
  17. #include <stdio.h>
  18. #include <winnt32p.h>
  19. #include <pidgen.h>
  20. #include <locale.h>
  21. #include <ntverp.h>
  22. #include <patchapi.h>
  23. #include <cfgmgr32.h>
  24. #include <regstr.h>
  25. #include <imagehlp.h>
  26. #define STRSAFE_NO_DEPRECATE
  27. #include <strsafe.h>
  28. #include "resource.h"
  29. #include "util.h"
  30. #include "hwdb.h"
  31. #include "wsdu.h"
  32. #include "dynupdt.h"
  33. #include "diamond.h"
  34. //
  35. // moved to precomp.h
  36. //
  37. //#include "msg.h"
  38. #include "helpids.h"
  39. #include "comp.h"
  40. #include "compliance.h"
  41. #include "mgdlllib.h"
  42. #ifdef PRERELEASE
  43. #define TRY
  44. #define EXCEPT(e) goto __skip;
  45. #define _exception_code() 0
  46. #define END_EXCEPT __skip:;
  47. #else
  48. #define TRY __try
  49. #define EXCEPT(e) __except (e)
  50. #define END_EXCEPT
  51. #endif
  52. #define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
  53. #define LENGTHOF(a) (ARRAYSIZE(a) - 1)
  54. #define HideWindow(_hwnd) SetWindowLong((_hwnd),GWL_STYLE,GetWindowLong((_hwnd),GWL_STYLE)&~WS_VISIBLE)
  55. #define UnHideWindow(_hwnd) SetWindowLong((_hwnd),GWL_STYLE,GetWindowLong((_hwnd),GWL_STYLE)|WS_VISIBLE)
  56. #define UNATTENDED(btn) if((UnattendedOperation) && (!CancelPending)) PostMessage(hdlg,WMX_UNATTENDED,btn,0)
  57. #define CHECKUPGRADEONLY() if(CheckUpgradeOnly) return( FALSE )
  58. #define CHECKUPGRADEONLY_Q() if(CheckUpgradeOnlyQ) return( FALSE )
  59. #define SetDialogFocus(_hwnd, _hwndchild) SendMessage(_hwnd, WM_NEXTDLGCTL, (WPARAM)_hwndchild, MAKELPARAM(TRUE, 0))
  60. #define MAKEULONGLONG(low,high) ((ULONGLONG)(((DWORD)(low)) | ((ULONGLONG)((DWORD)(high))) << 32))
  61. #define HIULONG(_val_) ((ULONG)(_val_>>32))
  62. #define LOULONG(_val_) ((ULONG)_val_)
  63. #define TYPICAL() (dwSetupFlags & UPG_FLAG_TYPICAL)
  64. extern HINSTANCE hInst;
  65. extern UINT AppTitleStringId;
  66. extern DWORD TlsIndex;
  67. extern HINSTANCE hinstBB;
  68. extern HWND WizardHandle;
  69. extern BOOL g_DeleteRunOnceFlag;
  70. HWND GetBBhwnd();
  71. HWND GetBBMainHwnd();
  72. #define S_WINNT32_WARNING TEXT("Winnt32RunOnceWarning")
  73. // #define RUN_SYSPARSE 1
  74. //
  75. // Flag indicating whether we are initiating an MSI-Install.
  76. //
  77. extern BOOL RunFromMSI;
  78. //
  79. // Flag indicating whether we are initiating an Typical install
  80. //
  81. extern DWORD dwSetupFlags;
  82. //
  83. // Flag indicating whether we are initiating an upgrade.
  84. //
  85. extern BOOL Upgrade;
  86. //
  87. // Flag to say if we need to write the AcpiHAL value to the winnt.sif file
  88. //
  89. extern BOOL WriteAcpiHalValue;
  90. //
  91. // What should we write as the value for the AcpiHalValue
  92. //
  93. extern BOOL AcpiHalValue;
  94. //
  95. // Flag indicating whether we're installing/upgrading to NT Server
  96. //
  97. extern BOOL Server;
  98. //
  99. // Flag to indicate if we are running BVT's
  100. //
  101. extern BOOL RunningBVTs;
  102. //
  103. // When running BVT's, what baudrate should we set the debugger to?
  104. //
  105. extern LONG lDebugBaudRate;
  106. //
  107. // When running BVT's, what comport should we set the debugger to?
  108. //
  109. extern LONG lDebugComPort;
  110. //
  111. // When running BVT's, should we copy the symbols locally?
  112. //
  113. extern BOOL CopySymbols;
  114. //
  115. // Flag to indicate if we are running ASR tests
  116. //
  117. extern DWORD AsrQuickTest;
  118. //
  119. // Product type and flavor for upgrade modules
  120. //
  121. extern PRODUCTTYPE UpgradeProductType;
  122. extern UINT ProductFlavor;
  123. //
  124. // fat to ntfs conversion flag
  125. //
  126. extern BOOL ForceNTFSConversion;
  127. extern BOOL NTFSConversionChanged;
  128. //
  129. // 16 bit environment boot (Win9x upgrade only)
  130. //
  131. typedef enum {
  132. BOOT16_AUTOMATIC,
  133. BOOT16_YES,
  134. BOOT16_NO
  135. } BOOT16_OPTIONS;
  136. extern UINT g_Boot16;
  137. //
  138. // Global flag indicating whether the entire overall program operation
  139. // was successful. Also a flag indicating whether to shut down automatically
  140. // when the wizard is done in the non-unattended case.
  141. //
  142. extern BOOL GlobalResult;
  143. extern BOOL AutomaticallyShutDown;
  144. //
  145. // Global OS version info.
  146. //
  147. extern OSVERSIONINFO OsVersion;
  148. extern DWORD OsVersionNumber;
  149. #define BUILDNUM() (OsVersion.dwBuildNumber)
  150. #ifdef UNICODE
  151. #define ISNT() (TRUE)
  152. #define ISOSR2() (FALSE)
  153. #else
  154. #define ISNT() (FALSE)
  155. #define ISOSR2() (LOWORD(OsVersion.dwBuildNumber) > 1080)
  156. #endif
  157. extern WINNT32_PLUGIN_INIT_INFORMATION_BLOCK info;
  158. //
  159. // Flags indicating how we were run and whether to create
  160. // a local source.
  161. //
  162. extern BOOL RunFromCD;
  163. extern BOOL MakeLocalSource;
  164. extern BOOL UserSpecifiedMakeLocalSource;
  165. extern BOOL NoLs;
  166. extern TCHAR UserSpecifiedLocalSourceDrive;
  167. extern LONG SourceInstallType; // uses InstallType enum
  168. extern DWORD MLSDiskID;
  169. //
  170. // Used for win9xupg reporting (reportonly mode)
  171. //
  172. extern UINT UpgRequiredMb;
  173. extern UINT UpgAvailableMb;
  174. //
  175. // advanced install options
  176. //
  177. extern BOOL ChoosePartition;
  178. extern BOOL UseSignatures;
  179. extern TCHAR InstallDir[MAX_PATH];
  180. extern TCHAR HeadlessSelection[MAX_PATH];
  181. extern ULONG HeadlessBaudRate;
  182. #ifdef PRERELEASE
  183. extern BOOL AppendDebugDataToBoot;
  184. #endif
  185. //
  186. // SMS support
  187. //
  188. extern PSTR LastMessage;
  189. #if defined(REMOTE_BOOT)
  190. //
  191. // Flag indicating whether we're running on a remote boot client.
  192. //
  193. extern BOOL RemoteBoot;
  194. //
  195. // Path to the machine directory for a remote boot client.
  196. //
  197. extern TCHAR MachineDirectory[MAX_PATH];
  198. #endif // defined(REMOTE_BOOT)
  199. //
  200. // Flags indicating which Accessibility utilities to use
  201. //
  202. extern BOOL AccessibleMagnifier;
  203. extern BOOL AccessibleKeyboard;
  204. extern BOOL AccessibleVoice;
  205. extern BOOL AccessibleReader;
  206. //
  207. // Build number we're upgrading from
  208. //
  209. extern DWORD BuildNumber;
  210. #define NT351 1057
  211. #define NT40 1381
  212. #define NT50B1 1671
  213. #define NT50B3 2031
  214. #define NT50 2195
  215. #define NT51B2 2462
  216. #define NT51 2600
  217. //
  218. // Are any of the Accesssibility utilities enabled?
  219. //
  220. extern BOOL AccessibleSetup;
  221. //
  222. // Flags and values relating to unattended operation.
  223. //
  224. extern BOOL UnattendedOperation;
  225. extern BOOL UnattendSwitchSpecified;
  226. extern PTSTR UnattendedScriptFile;
  227. extern UINT UnattendedShutdownTimeout;
  228. extern UINT UnattendedCountdown;
  229. extern BOOL BatchMode;
  230. //
  231. // Name of unattended script file to be used for Accessible Setup
  232. //
  233. extern TCHAR AccessibleScriptFile[MAX_PATH];
  234. //
  235. // Name of inf file and handles to dosnet.inf and txtsetup.sif.
  236. //
  237. extern TCHAR InfName[MAX_PATH];
  238. extern PVOID MainInf;
  239. extern TCHAR FullInfName[MAX_PATH];
  240. extern PVOID TxtsetupSif;
  241. extern PVOID NtcompatInf;
  242. BOOL
  243. GetMainInfValue (
  244. IN PCTSTR Section,
  245. IN PCTSTR Key,
  246. IN DWORD FieldNumber,
  247. OUT PTSTR Buffer,
  248. IN DWORD BufChars
  249. );
  250. //
  251. // Language options stuff
  252. //
  253. extern BOOL IntlInfProcessed;
  254. extern DWORD PrimaryLocale;
  255. // Global used in WriteParamsFile and AddExternalParams
  256. extern TCHAR ActualParamFile[MAX_PATH];
  257. BOOL InitLangControl(HWND hdlg, BOOL bFarEast);
  258. BOOL IsFarEastLanguage(DWORD LangIdx);
  259. BOOL SelectFarEastLangGroup(BOOL bSelect);
  260. void BB_SetProgressText(LPTSTR szText);
  261. void BB_SetTimeEstimateText(LPTSTR szText);
  262. void BB_SetInfoText(LPTSTR szText);
  263. extern
  264. BOOL
  265. ReadIntlInf(
  266. IN HWND hdlg
  267. );
  268. extern
  269. VOID
  270. SaveLanguageDirs(
  271. );
  272. extern
  273. BOOL
  274. SaveLanguageParams(
  275. IN LPCTSTR FileName
  276. );
  277. extern
  278. VOID
  279. FreeLanguageData(
  280. );
  281. VOID
  282. CleanUpOldLocalSources(
  283. IN HWND hdlg
  284. );
  285. BOOL
  286. InspectFilesystems(
  287. IN HWND hdlg
  288. );
  289. BOOL
  290. LoadInfWorker(
  291. IN HWND hdlg,
  292. IN LPCTSTR FilenamePart,
  293. OUT PVOID *InfHandle,
  294. IN BOOL Winnt32File
  295. );
  296. BOOL
  297. FindLocalSourceAndCheckSpace(
  298. IN HWND hdlg,
  299. IN BOOL QuickTest,
  300. IN LONGLONG AdditionalPadding
  301. );
  302. BOOL
  303. EnoughMemory(
  304. IN HWND hdlg,
  305. IN BOOL QuickTest
  306. );
  307. //
  308. // Optional directory stuff.
  309. //
  310. #define MAX_OPTIONALDIRS 20
  311. extern UINT OptionalDirectoryCount;
  312. extern TCHAR OptionalDirectories[MAX_OPTIONALDIRS][MAX_PATH];
  313. extern UINT OptionalDirectoryFlags[MAX_OPTIONALDIRS];
  314. #define OPTDIR_TEMPONLY 0x00000001
  315. #define OPTDIR_OEMSYS 0x00000002
  316. #define OPTDIR_OVERLAY 0x00000004
  317. #define OPTDIR_ADDSRCARCH 0x00000008
  318. #define OPTDIR_ABSOLUTE 0x00000010
  319. #define OPTDIR_DEBUGGER 0x00000020 // speficies that this optional dir is to be copied to %windir%\Debuggers
  320. // OPTDIR_PLATFORM_INDEP becomes DIR_IS_PLATFORM_INDEPEND and FILE_IN_PLATFORM_INDEPEND_DIR
  321. #define OPTDIR_PLATFORM_INDEP 0x00000040
  322. #define OPTDIR_IN_LOCAL_BOOT 0x00000080
  323. #define OPTDIR_SUPPORT_DYNAMIC_UPDATE 0x00000100
  324. #define OPTDIR_USE_TAIL_FOLDER_NAME 0x00000200
  325. #define OPTDIR_PLATFORM_SPECIFIC_FIRST 0x00000400
  326. #define OPTDIR_DOESNT_SUPPORT_PRIVATES 0x00000800
  327. #define OPTDIR_SIDE_BY_SIDE 0x00001000
  328. //
  329. // Source paths and count of paths.
  330. //
  331. extern TCHAR SourcePaths[MAX_SOURCE_COUNT][MAX_PATH];
  332. extern TCHAR NativeSourcePaths[MAX_SOURCE_COUNT][MAX_PATH];
  333. extern UINT SourceCount;
  334. extern TCHAR *UserSpecifiedOEMShare;
  335. //
  336. // Local source information.
  337. //
  338. #define DEFAULT_INSTALL_DIR TEXT("\\WINDOWS")
  339. #define INTERNAL_WINNT32_DIR TEXT("winnt32")
  340. #define LOCAL_SOURCE_DIR_A "$WIN_NT$.~LS"
  341. #define LOCAL_SOURCE_DIR_W L"$WIN_NT$.~LS"
  342. #define TEXTMODE_INF_A "TXTSETUP.SIF"
  343. #define TEXTMODE_INF_W L"TXTSETUP.SIF"
  344. #define NTCOMPAT_INF_A "COMPDATA\\NTCOMPAT.INF"
  345. #define NTCOMPAT_INF_W L"COMPDATA\\NTCOMPAT.INF"
  346. #define DRVINDEX_INF_A "DRVINDEX.INF"
  347. #define DRVINDEX_INF_W L"DRVINDEX.INF"
  348. #define SETUPP_INI_A "SETUPP.INI"
  349. #define SETUPP_INI_W L"SETUPP.INI"
  350. #define PID_SECTION_A "Pid"
  351. #define PID_SECTION_W L"Pid"
  352. #define PID_KEY_A "Pid"
  353. #define PID_KEY_W L"Pid"
  354. #define OEM_INSTALL_RPC_A "OEM"
  355. #define OEM_INSTALL_RPC_W L"OEM"
  356. #define SELECT_INSTALL_RPC_A "270"
  357. #define SELECT_INSTALL_RPC_W L"270"
  358. #define MSDN_INSTALL_RPC_A "335"
  359. #define MSDN_INSTALL_RPC_W L"335"
  360. #define MSDN_PID30_A "MD97J-QC7R7-TQJGD-3V2WM-W7PVM"
  361. #define MSDN_PID30_W L"MD97J-QC7R7-TQJGD-3V2WM-W7PVM"
  362. #define INF_FILE_HEADER "[Version]\r\nSignature = \"$Windows NT$\"\r\n\r\n"
  363. #ifdef UNICODE
  364. #define LOCAL_SOURCE_DIR LOCAL_SOURCE_DIR_W
  365. #define TEXTMODE_INF TEXTMODE_INF_W
  366. #define NTCOMPAT_INF NTCOMPAT_INF_W
  367. #define DRVINDEX_INF DRVINDEX_INF_W
  368. #define SETUPP_INI SETUPP_INI_W
  369. #define PID_SECTION PID_SECTION_W
  370. #define PID_KEY PID_KEY_W
  371. #define OEM_INSTALL_RPC OEM_INSTALL_RPC_W
  372. #define SELECT_INSTALL_RPC SELECT_INSTALL_RPC_W
  373. #define MSDN_INSTALL_RPC MSDN_INSTALL_RPC_W
  374. #define MSDN_PID30 MSDN_PID30_W
  375. #else
  376. #define LOCAL_SOURCE_DIR LOCAL_SOURCE_DIR_A
  377. #define TEXTMODE_INF TEXTMODE_INF_A
  378. #define NTCOMPAT_INF NTCOMPAT_INF_A
  379. #define DRVINDEX_INF DRVINDEX_INF_A
  380. #define SETUPP_INI SETUPP_INI_A
  381. #define PID_SECTION PID_SECTION_A
  382. #define PID_KEY PID_KEY_A
  383. #define OEM_INSTALL_RPC OEM_INSTALL_RPC_A
  384. #define SELECT_INSTALL_RPC SELECT_INSTALL_RPC_A
  385. #define MSDN_INSTALL_RPC MSDN_INSTALL_RPC_A
  386. #define MSDN_PID30 MSDN_PID30_A
  387. #endif
  388. #if defined(_AMD64_) || defined(_X86_)
  389. #define LOCAL_BOOT_DIR_A "$WIN_NT$.~BT"
  390. #define LOCAL_BOOT_DIR_W L"$WIN_NT$.~BT"
  391. #define AUX_BS_NAME_A "$LDR$"
  392. #define AUX_BS_NAME_W L"$LDR$"
  393. #define FLOPPY_COUNT 4
  394. //
  395. // Local BACKUP information, on NEC98.
  396. //
  397. #define LOCAL_BACKUP_DIR_A "$WIN_NT$.~BU"
  398. #define LOCAL_BACKUP_DIR_W L"$WIN_NT$.~BU"
  399. #ifdef UNICODE
  400. #define LOCAL_BOOT_DIR LOCAL_BOOT_DIR_W
  401. #define AUX_BS_NAME AUX_BS_NAME_W
  402. #define LOCAL_BACKUP_DIR LOCAL_BACKUP_DIR_W
  403. #else
  404. #define LOCAL_BOOT_DIR LOCAL_BOOT_DIR_A
  405. #define AUX_BS_NAME AUX_BS_NAME_A
  406. #define LOCAL_BACKUP_DIR LOCAL_BACKUP_DIR_A
  407. #endif
  408. extern TCHAR LocalBackupDirectory[MAX_PATH];
  409. extern TCHAR FirstFloppyDriveLetter;
  410. #endif
  411. extern DWORD LocalSourceDriveOffset;
  412. extern TCHAR LocalSourceDrive;
  413. extern TCHAR LocalSourceDirectory[MAX_PATH];
  414. extern TCHAR LocalSourceWithPlatform[MAX_PATH];
  415. extern TCHAR LocalBootDirectory[MAX_PATH];
  416. extern BOOL BlockOnNotEnoughSpace;
  417. extern LONGLONG LocalSourceSpaceRequired;
  418. extern LONGLONG WinDirSpaceFor9x;
  419. extern BOOL UpginfsUpdated;
  420. extern BOOL Win95upgInfUpdated;
  421. //
  422. // wizard stuff
  423. //
  424. // wizard page size
  425. #define WIZ_PAGE_SIZE_X 317
  426. #define WIZ_PAGE_SIZE_Y 179
  427. #define BBSTEP_NONE 0
  428. #define BBSTEP_COLLECTING_INFORMATION 1
  429. #define BBSTEP_DYNAMIC_UPDATE 2
  430. #define BBSTEP_PREPARING 3
  431. typedef struct _PAGE_COMMON_DATA {
  432. DLGPROC DialogProcedure;
  433. UINT BillboardStep;
  434. //
  435. // State to initialize buttons to.
  436. //
  437. DWORD Buttons;
  438. UINT Flags;
  439. } PAGE_COMMON_DATA, *PPAGE_COMMON_DATA;
  440. typedef struct _PAGE_CREATE_DATA {
  441. //
  442. // If these are specified, then a range of pages may come
  443. // from somewhere else. Otherwise, it's one page whose
  444. // resource id is given below.
  445. //
  446. LPPROPSHEETPAGE *ExternalPages;
  447. PUINT ExternalPageCount;
  448. UINT Template;
  449. PAGE_COMMON_DATA CommonData;
  450. } PAGE_CREATE_DATA, *PPAGE_CREATE_DATA;
  451. typedef struct _PAGE_RUNTIME_DATA {
  452. PAGE_COMMON_DATA CommonData;
  453. //
  454. // Per-page (private) data
  455. //
  456. DWORD PerPageData;
  457. } PAGE_RUNTIME_DATA, *PPAGE_RUNTIME_DATA;
  458. typedef struct _BITMAP_DATA {
  459. CONST BITMAPINFOHEADER *BitmapInfoHeader;
  460. PVOID BitmapBits;
  461. HPALETTE Palette;
  462. UINT PaletteColorCount;
  463. BOOL Adjusted;
  464. } BITMAP_DATA, *PBITMAP_DATA;
  465. #define WIZPAGE_FULL_PAGE_WATERMARK 0x00000001
  466. #define WIZPAGE_SEPARATOR_CREATED 0x00000002
  467. #define WIZPAGE_NEW_HEADER 0x00000004
  468. //
  469. // compatibility data
  470. //
  471. typedef struct _COMPATIBILITY_DATA {
  472. //
  473. // general
  474. //
  475. LIST_ENTRY ListEntry;
  476. //
  477. // what type of entry
  478. //
  479. TCHAR Type;
  480. //
  481. // service-driver data
  482. //
  483. LPCTSTR ServiceName;
  484. //
  485. // registry data
  486. //
  487. LPCTSTR RegKey;
  488. LPCTSTR RegValue;
  489. LPCTSTR RegValueExpect;
  490. //
  491. // file data
  492. //
  493. LPCTSTR FileName;
  494. LPCTSTR FileVer;
  495. //
  496. // common
  497. //
  498. LPCTSTR Description;
  499. LPCTSTR HtmlName;
  500. LPCTSTR TextName;
  501. LPTSTR RegKeyName;
  502. LPTSTR RegValName;
  503. LPVOID RegValData;
  504. DWORD RegValDataSize;
  505. LPVOID SaveValue;
  506. DWORD Flags;
  507. LPCTSTR InfName;
  508. LPCTSTR InfSection;
  509. HMODULE hModDll;
  510. PCOMPAIBILITYHAVEDISK CompHaveDisk;
  511. } COMPATIBILITY_DATA, *PCOMPATIBILITY_DATA;
  512. extern LIST_ENTRY CompatibilityData;
  513. extern DWORD CompatibilityCount;
  514. extern DWORD IncompatibilityStopsInstallation;
  515. extern BOOL AnyNt5CompatDlls;
  516. BOOL
  517. AnyBlockingCompatibilityItems (
  518. VOID
  519. );
  520. //
  521. // Plug and Play device migration routines.
  522. // (linked into winnt.dll from pnpsif.lib)
  523. //
  524. BOOL
  525. MigrateDeviceInstanceData(
  526. OUT LPTSTR *Buffer
  527. );
  528. BOOL
  529. MigrateClassKeys(
  530. OUT LPTSTR *Buffer
  531. );
  532. BOOL
  533. MigrateHashValues(
  534. OUT LPTSTR *Buffer
  535. );
  536. //
  537. // Array of drive letters for all system partitions.
  538. // Note that on amd64/x86 there will always be exactly one.
  539. // The list is 0-terminated.
  540. //
  541. extern TCHAR SystemPartitionDriveLetters[27];
  542. extern TCHAR SystemPartitionDriveLetter;
  543. #ifdef UNICODE
  544. extern UINT SystemPartitionCount;
  545. extern PWSTR* SystemPartitionNtNames;
  546. extern PWSTR SystemPartitionNtName;
  547. extern PWSTR SystemPartitionVolumeGuid;
  548. #else
  549. extern PCSTR g_LocalSourcePath;
  550. #endif
  551. //
  552. // UDF stuff
  553. //
  554. extern LPCTSTR UniquenessId;
  555. extern LPCTSTR UniquenessDatabaseFile;
  556. //
  557. // Preinstall stuff
  558. //
  559. extern BOOL OemPreinstall;
  560. #if defined(_AMD64_) || defined(_X86_)
  561. typedef struct _OEM_BOOT_FILE {
  562. struct _OEM_BOOT_FILE *Next;
  563. LPCTSTR Filename;
  564. } OEM_BOOT_FILE, *POEM_BOOT_FILE;
  565. extern POEM_BOOT_FILE OemBootFiles;
  566. #endif
  567. extern TCHAR ForcedSystemPartition;
  568. //
  569. // Miscellaneous other command line parameters.
  570. //
  571. extern LPCTSTR CmdToExecuteAtEndOfGui;
  572. extern BOOL AutoSkipMissingFiles;
  573. extern BOOL HideWinDir;
  574. extern TCHAR ProductId[64];
  575. //
  576. // Flag indicating that the user cancelled.
  577. // Flag indicating that a succssessful abort should be performed.
  578. // Handle for mutex used to guarantee that only one error dialog
  579. // is on the screen at once.
  580. //
  581. extern BOOL Cancelled;
  582. extern BOOL CancelPending;
  583. extern BOOL Aborted;
  584. extern HANDLE UiMutex;
  585. //
  586. // This indicates that well give the user some detailed data-throughput
  587. // info.
  588. //
  589. extern BOOL DetailedCopyProgress;
  590. extern ULONGLONG TotalDataCopied;
  591. //
  592. // Upgrade Options variables. Used to pass a multistring of
  593. // upgrade command line options to the plugin DLLs.
  594. //
  595. extern LPTSTR UpgradeOptions;
  596. extern DWORD UpgradeOptionsLength;
  597. extern DWORD UpgradeOptionsSize;
  598. BOOL
  599. AppendUpgradeOption (
  600. IN PCTSTR String
  601. );
  602. #if defined(_AMD64_) || defined(_X86_)
  603. //
  604. // Win9x upgrade report status
  605. //
  606. extern UINT g_UpgradeReportMode;
  607. #endif
  608. //
  609. // Compliance variables
  610. //
  611. extern BOOL NoCompliance;
  612. extern BOOL NoBuildCheck;
  613. // UpgradeOnly is true is the media is CCP media and only valid
  614. // to upgrade a system. eula.c will use this to ensure that an
  615. // FPP pid is not used with CCP media and vice-versa
  616. extern BOOL UpgradeOnly;
  617. extern BOOL SkipLocaleCheck;
  618. extern BOOL SkipVirusScannerCheck;
  619. extern BOOL UseBIOSToBoot;
  620. //
  621. // TargetNativeLangID : this is native language ID of running system
  622. //
  623. extern LANGID TargetNativeLangID;
  624. //
  625. // SourceNativeLangID : this is native language ID of new NT you want to install
  626. //
  627. extern LANGID SourceNativeLangID;
  628. //
  629. // IsLanguageMatched : if source and target language are matched (or compatible)
  630. //
  631. // 1. if SourceNativeLangID == TargetNativeLangID
  632. //
  633. // 2. if SourceNativeLangID's alternative ID == TargetNativeLangID
  634. //
  635. extern BOOL IsLanguageMatched;
  636. BOOL
  637. InitLanguageDetection(
  638. LPCTSTR SourcePath,
  639. LPCTSTR InfFile
  640. );
  641. //
  642. // Routines from Setupapi.dll
  643. //
  644. //
  645. // ISSUE: be careful when using this routine on NT4, as it may fail;
  646. // setupapi on NT4 doesn't understand LZX compression, currently used to compress files
  647. //
  648. extern
  649. DWORD
  650. (*SetupapiDecompressOrCopyFile)(
  651. IN PCTSTR SourceFileName,
  652. OUT PCTSTR TargetFileName,
  653. OUT PUINT CompressionType OPTIONAL
  654. );
  655. extern
  656. HINF
  657. (*SetupapiOpenInfFile)(
  658. IN LPCTSTR FileName,
  659. IN LPCTSTR InfClass, OPTIONAL
  660. IN DWORD InfStyle,
  661. OUT PUINT ErrorLine OPTIONAL
  662. );
  663. extern
  664. VOID
  665. (*SetupapiCloseInfFile)(
  666. IN HINF InfHandle
  667. );
  668. extern
  669. BOOL
  670. (*SetupapiFindFirstLine)(
  671. IN HINF InfHandle,
  672. IN PCTSTR Section,
  673. IN PCTSTR Key, OPTIONAL
  674. OUT PINFCONTEXT Context
  675. );
  676. extern
  677. BOOL
  678. (*SetupapiFindNextLine)(
  679. PINFCONTEXT ContextIn,
  680. PINFCONTEXT ContextOut
  681. );
  682. extern
  683. BOOL
  684. (*SetupapiFindNextMatchLine)(
  685. PINFCONTEXT ContextIn,
  686. PCTSTR Key,
  687. PINFCONTEXT ContextOut
  688. );
  689. extern
  690. LONG
  691. (*SetupapiGetLineCount)(
  692. IN HINF InfHandle,
  693. IN LPCTSTR Section
  694. );
  695. extern
  696. DWORD
  697. (*SetupapiGetFieldCount)(
  698. IN PINFCONTEXT Context
  699. );
  700. extern
  701. BOOL
  702. (*SetupapiGetStringField)(
  703. IN PINFCONTEXT Context,
  704. DWORD FieldIndex,
  705. PTSTR ReturnBuffer,
  706. DWORD ReturnBufferSize,
  707. PDWORD RequiredSize
  708. );
  709. extern
  710. BOOL
  711. (*SetupapiGetLineByIndex)(
  712. IN HINF InfHandle,
  713. IN LPCTSTR Section,
  714. IN DWORD Index,
  715. OUT PINFCONTEXT Context
  716. );
  717. extern
  718. HSPFILEQ
  719. (*SetupapiOpenFileQueue) (
  720. VOID
  721. );
  722. extern
  723. BOOL
  724. (*SetupapiCloseFileQueue) (
  725. IN HSPFILEQ QueueHandle
  726. );
  727. extern
  728. BOOL
  729. (*SetupapiQueueCopy) (
  730. IN HSPFILEQ QueueHandle,
  731. IN PCTSTR SourceRootPath, OPTIONAL
  732. IN PCTSTR SourcePath, OPTIONAL
  733. IN PCTSTR SourceFilename,
  734. IN PCTSTR SourceDescription, OPTIONAL
  735. IN PCTSTR SourceTagfile, OPTIONAL
  736. IN PCTSTR TargetDirectory,
  737. IN PCTSTR TargetFilename, OPTIONAL
  738. IN DWORD CopyStyle
  739. );
  740. extern
  741. BOOL
  742. (*SetupapiCommitFileQueue) (
  743. IN HWND Owner, OPTIONAL
  744. IN HSPFILEQ QueueHandle,
  745. IN PSP_FILE_CALLBACK_W MsgHandler,
  746. IN PVOID Context
  747. );
  748. extern
  749. UINT
  750. (*SetupapiDefaultQueueCallback) (
  751. IN PVOID Context,
  752. IN UINT Notification,
  753. IN UINT_PTR Param1,
  754. IN UINT_PTR Param2
  755. );
  756. extern
  757. PVOID
  758. (*SetupapiInitDefaultQueueCallback) (
  759. HWND OwnerWindow
  760. );
  761. extern
  762. VOID
  763. (*SetupapiTermDefaultQueueCallback) (
  764. PVOID Context
  765. );
  766. #ifdef UNICODE
  767. extern
  768. BOOL
  769. (*SetupapiGetSourceFileLocation) (
  770. HINF InfHandle, // handle of an INF file
  771. PINFCONTEXT InfContext, // optional, context of an INF file
  772. PCTSTR FileName, // optional, source file to locate
  773. PUINT SourceId, // receives the source media ID
  774. PTSTR ReturnBuffer, // optional, receives the location
  775. DWORD ReturnBufferSize, // size of the supplied buffer
  776. PDWORD RequiredSize // optional, buffer size needed
  777. );
  778. extern
  779. BOOL
  780. (*SetupapiGetInfInformation) (
  781. LPCVOID InfSpec, // handle or filename of the INF file
  782. DWORD SearchControl, // how to search for the INF file
  783. PSP_INF_INFORMATION ReturnBuffer, // optional, receives the INF info
  784. DWORD ReturnBufferSize, // size of the supplied buffer
  785. PDWORD RequiredSize // optional, buffer size needed
  786. );
  787. extern
  788. BOOL
  789. (*SetupapiQueryInfFileInformation) (
  790. PSP_INF_INFORMATION InfInformation, // structure that contains the INF info
  791. UINT InfIndex, // index of the file to investigate
  792. PTSTR ReturnBuffer, // optional, receives the information
  793. DWORD ReturnBufferSize, // size of the supplied buffer
  794. PDWORD RequiredSize // optional, buffer size needed
  795. );
  796. extern
  797. BOOL
  798. (*SetupapiQueryInfOriginalFileInformation) (
  799. PSP_INF_INFORMATION InfInformation, // structure that contains the INF information
  800. UINT InfIndex, // index of the file to investigate
  801. PSP_ALTPLATFORM_INFO AlternatePlatformInfo, // optional, receives the alternate platform information
  802. PSP_ORIGINAL_FILE_INFO OriginalFileInfo // original file information
  803. );
  804. #endif
  805. //
  806. // Custom window messages. Define so they don't overlap with
  807. // any being used by plug-in dll's.
  808. //
  809. #define WMX_EDITCONTROLSTATE (WMX_PLUGIN_FIRST-1)
  810. #define WMX_INSPECTRESULT (WMX_PLUGIN_FIRST-2)
  811. //#define WMX_SETPROGRESSTEXT (WMX_PLUGIN_FIRST-3)
  812. #define WMX_ERRORMESSAGEUP (WMX_PLUGIN_FIRST-4)
  813. #define WMX_I_AM_VISIBLE (WMX_PLUGIN_FIRST-5)
  814. #define WMX_COPYPROGRESS (WMX_PLUGIN_FIRST-6)
  815. #define WMX_I_AM_DONE (WMX_PLUGIN_FIRST-7)
  816. #define WMX_FINISHBUTTON (WMX_PLUGIN_FIRST-8)
  817. #define WMX_UNATTENDED (WMX_PLUGIN_FIRST-9)
  818. #define WMX_NEXTBUTTON (WMX_PLUGIN_FIRST-10)
  819. #define WMX_BACKBUTTON (WMX_PLUGIN_FIRST-11)
  820. #define WMX_VALIDATE (WMX_PLUGIN_FIRST-12)
  821. #define WMX_SETUPUPDATE_PREPARING (WMX_PLUGIN_FIRST-13)
  822. #define WMX_SETUPUPDATE_DOWNLOADING (WMX_PLUGIN_FIRST-14)
  823. #define WMX_SETUPUPDATE_PROCESSING (WMX_PLUGIN_FIRST-15)
  824. #define WMX_SETUPUPDATE_DONE (WMX_PLUGIN_FIRST-16)
  825. #define WMX_SETUPUPDATE_CANCEL (WMX_PLUGIN_FIRST-17)
  826. #define WMX_SETUPUPDATE_INIT_RETRY (WMX_PLUGIN_FIRST-18)
  827. #define WMX_SETUPUPDATE_THREAD_DONE (WMX_PLUGIN_FIRST-19)
  828. #ifdef RUN_SYSPARSE
  829. #define WMX_SYSPARSE_DONE (WMX_PLUGIN_FIRST-20)
  830. #endif
  831. #define WMX_DYNAMIC_UPDATE_COMPLETE (WMX_PLUGIN_FIRST-21)
  832. //
  833. // Helper macro for uppercasing
  834. //
  835. #define TOUPPER(x) (TCHAR)CharUpper((LPTSTR)x)
  836. //
  837. // Routine that does everything by starting the wizard.
  838. //
  839. VOID
  840. Wizard(
  841. VOID
  842. );
  843. //
  844. // Routine that builds a cmdcons installation.
  845. //
  846. VOID
  847. DoBuildCmdcons(
  848. VOID
  849. );
  850. VOID
  851. FixUpWizardTitle(
  852. IN HWND Wizard
  853. );
  854. //
  855. // Cleanup routine and globals used by the cleanup stuff.
  856. //
  857. DWORD
  858. StartCleanup(
  859. IN PVOID ThreadParameter
  860. );
  861. #if defined(_AMD64_) || defined(_X86_)
  862. BOOL
  863. RestoreBootSector(
  864. VOID
  865. );
  866. BOOL
  867. RestoreBootIni(
  868. VOID
  869. );
  870. BOOL
  871. SaveRestoreBootFiles_NEC98(
  872. IN UCHAR Flag
  873. );
  874. #define NEC98SAVEBOOTFILES 0
  875. #define NEC98RESTOREBOOTFILES 1
  876. BOOL
  877. IsDriveAssignNEC98(
  878. VOID
  879. );
  880. //
  881. // Check ATA Drive
  882. //
  883. BOOLEAN
  884. CheckATACardonNT4(
  885. HANDLE hDisk
  886. );
  887. //
  888. // Check formatted drive type
  889. //
  890. BOOLEAN
  891. IsValidDrive(
  892. TCHAR Drive
  893. );
  894. #endif // defined(_AMD64_) || defined(_X86_)
  895. BOOL
  896. RestoreNvRam(
  897. VOID
  898. );
  899. //
  900. // Thread that inspects sources, loads infs, builds the copy list,
  901. // checks disk space, etc. And some worker routines.
  902. //
  903. DWORD
  904. InspectAndLoadThread(
  905. IN PVOID ThreadParam
  906. );
  907. BOOL
  908. InspectSources(
  909. IN HWND ParentWnd
  910. );
  911. BOOL
  912. BuildCopyListWorker(
  913. IN HWND hdlg
  914. );
  915. BOOL
  916. FindLocalSourceAndCheckSpaceWorker(
  917. IN HWND hdlg,
  918. IN BOOL QuickTest,
  919. IN LONGLONG AdditionalPadding
  920. );
  921. UINT
  922. GetTotalFileCount(
  923. VOID
  924. );
  925. DWORD
  926. StartCopyingThread(
  927. IN PVOID ThreadParameter
  928. );
  929. VOID
  930. CancelledMakeSureCopyThreadsAreDead(
  931. VOID
  932. );
  933. DWORD
  934. DoPostCopyingStuff(
  935. IN PVOID ThreadParam
  936. );
  937. //
  938. // File copy error routine and outcomes.
  939. //
  940. UINT
  941. FileCopyError(
  942. IN HWND ParentWindow,
  943. IN LPCTSTR SourceFilename,
  944. IN LPCTSTR TargetFilename,
  945. IN UINT Win32Error,
  946. IN BOOL MasterList
  947. );
  948. #define COPYERR_SKIP 1
  949. #define COPYERR_EXIT 2
  950. #define COPYERR_RETRY 3
  951. //
  952. // Routine to add an optional directory to the list of dirs
  953. // we copy.
  954. //
  955. BOOL
  956. RememberOptionalDir(
  957. IN LPCTSTR Directory,
  958. IN UINT Flags
  959. );
  960. //
  961. // Resource utility routines.
  962. //
  963. PCTSTR
  964. GetStringResource (
  965. IN UINT Id // ID or pointer to string name
  966. );
  967. VOID
  968. FreeStringResource (
  969. IN PCTSTR String
  970. );
  971. VOID
  972. SaveMessageForSMS(
  973. IN DWORD MessageId,
  974. ...
  975. );
  976. VOID
  977. SaveTextForSMS(
  978. IN PCTSTR Buffer
  979. );
  980. int
  981. MessageBoxFromMessage(
  982. IN HWND Window,
  983. IN DWORD MessageId,
  984. IN BOOL SystemMessage,
  985. IN DWORD CaptionStringId,
  986. IN UINT Style,
  987. ...
  988. );
  989. int
  990. MessageBoxFromMessageV(
  991. IN HWND Window,
  992. IN DWORD MessageId,
  993. IN BOOL SystemMessage,
  994. IN DWORD CaptionStringId,
  995. IN UINT Style,
  996. IN va_list *Args
  997. );
  998. int
  999. MessageBoxFromMessageWithSystem(
  1000. IN HWND Window,
  1001. IN DWORD MessageId,
  1002. IN DWORD CaptionStringId,
  1003. IN UINT Style,
  1004. IN HMODULE hMod
  1005. );
  1006. int
  1007. MessageBoxFromMessageAndSystemError(
  1008. IN HWND Window,
  1009. IN DWORD MessageId,
  1010. IN DWORD SystemMessageId,
  1011. IN DWORD CaptionStringId,
  1012. IN UINT Style,
  1013. ...
  1014. );
  1015. HBITMAP
  1016. LoadResourceBitmap(
  1017. IN HINSTANCE hInst,
  1018. IN LPCTSTR Id,
  1019. OUT HPALETTE *Palette
  1020. );
  1021. BOOL
  1022. GetBitmapDataAndPalette(
  1023. IN HINSTANCE hInst,
  1024. IN LPCTSTR Id,
  1025. OUT HPALETTE *Palette,
  1026. OUT PUINT ColorCount,
  1027. OUT CONST BITMAPINFOHEADER **BitmapData
  1028. );
  1029. UINT
  1030. GetYPositionOfDialogItem(
  1031. IN LPCTSTR Dialog,
  1032. IN UINT ControlId
  1033. );
  1034. //
  1035. // Security routines.
  1036. //
  1037. BOOL
  1038. IsUserAdmin(
  1039. VOID
  1040. );
  1041. BOOL
  1042. DoesUserHavePrivilege(
  1043. PCTSTR PrivilegeName
  1044. );
  1045. BOOL
  1046. EnablePrivilege(
  1047. IN PTSTR PrivilegeName,
  1048. IN BOOL Enable
  1049. );
  1050. //
  1051. // Inf routines.
  1052. //
  1053. DWORD
  1054. LoadInfFile(
  1055. IN LPCTSTR Filename,
  1056. IN BOOL OemCodepage,
  1057. OUT PVOID *InfHandle
  1058. );
  1059. VOID
  1060. UnloadInfFile(
  1061. IN PVOID InfHandle
  1062. );
  1063. LONG
  1064. InfGetSectionLineCount(
  1065. IN PVOID INFHandle,
  1066. IN PTSTR SectionName
  1067. );
  1068. LPCTSTR
  1069. InfGetFieldByIndex(
  1070. IN PVOID INFHandle,
  1071. IN LPCTSTR SectionName,
  1072. IN unsigned LineIndex,
  1073. IN unsigned ValueIndex
  1074. );
  1075. LPCTSTR
  1076. InfGetFieldByKey(
  1077. IN PVOID INFHandle,
  1078. IN LPCTSTR SectionName,
  1079. IN LPCTSTR Key,
  1080. IN unsigned ValueIndex
  1081. );
  1082. BOOL
  1083. InfDoesLineExistInSection(
  1084. IN PVOID INFHandle,
  1085. IN LPCTSTR SectionName,
  1086. IN LPCTSTR Key
  1087. );
  1088. BOOL
  1089. InfDoesEntryExistInSection (
  1090. IN PVOID INFHandle,
  1091. IN LPCTSTR SectionName,
  1092. IN LPCTSTR Entry
  1093. );
  1094. LPCTSTR
  1095. InfGetLineKeyName(
  1096. IN PVOID INFHandle,
  1097. IN LPCTSTR SectionName,
  1098. IN unsigned LineIndex
  1099. );
  1100. typedef struct {
  1101. // Caller members (read-only)
  1102. PCTSTR FieldZeroData;
  1103. unsigned LineIndex;
  1104. // Internal members
  1105. PVOID InfHandle;
  1106. PCTSTR SectionName;
  1107. } INF_ENUM, *PINF_ENUM;
  1108. BOOL
  1109. EnumFirstInfLine (
  1110. OUT PINF_ENUM InfEnum,
  1111. IN PVOID InfHandle,
  1112. IN PCTSTR InfSection
  1113. );
  1114. BOOL
  1115. EnumNextInfLine (
  1116. IN OUT PINF_ENUM InfEnum
  1117. );
  1118. VOID
  1119. AbortInfLineEnum (
  1120. IN PINF_ENUM InfEnum // ZEROED
  1121. );
  1122. //
  1123. // Routines to manipulate parameters files like unattend.txt,
  1124. // the param file we pass to text mode setup, etc.
  1125. //
  1126. BOOL
  1127. WriteParametersFile(
  1128. IN HWND ParentWindow
  1129. );
  1130. BOOL
  1131. AddExternalParams(
  1132. IN HWND ParentWindow
  1133. );
  1134. //
  1135. // Miscellaenous utility routines.
  1136. //
  1137. LPTSTR *
  1138. CommandLineToArgv(
  1139. OUT int *NumArgs
  1140. );
  1141. VOID
  1142. MyWinHelp(
  1143. IN HWND Window,
  1144. IN UINT Command,
  1145. IN ULONG_PTR Data
  1146. );
  1147. BOOL
  1148. ConcatenatePaths(
  1149. IN OUT PTSTR Path1,
  1150. IN LPCTSTR Path2,
  1151. IN DWORD BufferSizeChars
  1152. );
  1153. LPTSTR
  1154. DupString(
  1155. IN LPCTSTR String
  1156. );
  1157. UINT
  1158. MyGetDriveType(
  1159. IN TCHAR Drive
  1160. );
  1161. #ifdef UNICODE
  1162. UINT
  1163. MyGetDriveType2 (
  1164. IN PCWSTR NtDeviceName
  1165. );
  1166. BOOL
  1167. MyGetDiskFreeSpace (
  1168. IN PCWSTR NtVolumeName,
  1169. IN PDWORD SectorsPerCluster,
  1170. IN PDWORD BytesPerSector,
  1171. IN PDWORD NumberOfFreeClusters,
  1172. IN PDWORD TotalNumberOfClusters
  1173. );
  1174. #endif
  1175. BOOL
  1176. GetPartitionInfo(
  1177. IN TCHAR Drive,
  1178. OUT PPARTITION_INFORMATION PartitionInfo
  1179. );
  1180. BOOL
  1181. IsDriveNTFT(
  1182. IN TCHAR Drive,
  1183. IN PCTSTR NtVolumeName
  1184. );
  1185. BOOL
  1186. IsDriveVeritas(
  1187. IN TCHAR Drive,
  1188. IN PCTSTR NtVolumeName
  1189. );
  1190. #ifdef UNICODE
  1191. BOOL
  1192. IsSoftPartition(
  1193. IN TCHAR Drive,
  1194. IN PCTSTR NtVolumeName
  1195. );
  1196. #else
  1197. #define IsSoftPartition(d,n) (FALSE)
  1198. #endif
  1199. BOOL
  1200. IsDriveNTFS(
  1201. IN TCHAR Drive
  1202. );
  1203. BOOL
  1204. IsMachineSupported(
  1205. OUT PCOMPATIBILITY_ENTRY CompEntry
  1206. );
  1207. BOOL
  1208. GetAndSaveNTFTInfo(
  1209. IN HWND ParentWindow
  1210. );
  1211. VOID
  1212. ForceStickyDriveLetters(
  1213. );
  1214. DWORD
  1215. MapFileForRead(
  1216. IN LPCTSTR FileName,
  1217. OUT PDWORD FileSize,
  1218. OUT PHANDLE FileHandle,
  1219. OUT PHANDLE MappingHandle,
  1220. OUT PVOID *BaseAddress
  1221. );
  1222. DWORD
  1223. UnmapFile(
  1224. IN HANDLE MappingHandle,
  1225. IN PVOID BaseAddress
  1226. );
  1227. VOID
  1228. GenerateCompressedName(
  1229. IN LPCTSTR Filename,
  1230. OUT LPTSTR CompressedName
  1231. );
  1232. DWORD
  1233. CreateMultiLevelDirectory(
  1234. IN LPCTSTR Directory
  1235. );
  1236. VOID
  1237. MyDelnode(
  1238. IN LPCTSTR Directory
  1239. );
  1240. BOOL
  1241. ForceFileNoCompress(
  1242. IN LPCTSTR Filename
  1243. );
  1244. BOOL
  1245. IsCurrentOsServer(
  1246. void
  1247. );
  1248. BOOL
  1249. IsCurrentAdvancedServer(
  1250. void
  1251. );
  1252. BOOL
  1253. IsNTFSConversionRecommended(
  1254. void
  1255. );
  1256. BOOL
  1257. ForceBootFilesUncompressed(
  1258. IN HWND ParentWindow,
  1259. IN BOOL TellUserAboutError
  1260. );
  1261. BOOLEAN
  1262. AdjustPrivilege(
  1263. PCTSTR Privilege
  1264. );
  1265. BOOL
  1266. GetUserPrintableFileSizeString(
  1267. IN DWORDLONG Size,
  1268. OUT LPTSTR Buffer,
  1269. IN DWORD BufferSize
  1270. );
  1271. BOOL
  1272. FileExists(
  1273. IN PCTSTR FileName,
  1274. OUT PWIN32_FIND_DATA FindData OPTIONAL
  1275. );
  1276. BOOL
  1277. DoesDirectoryExist (
  1278. IN PCTSTR DirSpec
  1279. );
  1280. BOOL
  1281. InDriverCacheInf(
  1282. IN PVOID InfHandle,
  1283. IN PCTSTR FileName,
  1284. OUT PTSTR DriverCabName, OPTIONAL
  1285. IN DWORD BufferChars OPTIONAL
  1286. );
  1287. BOOL
  1288. BuildSystemPartitionPathToFile (
  1289. IN PCTSTR FileName,
  1290. OUT PTSTR Path,
  1291. IN INT BufferSizeChars
  1292. );
  1293. BOOL
  1294. FindPathToInstallationFileEx (
  1295. IN PCTSTR FileName,
  1296. OUT PTSTR PathToFile,
  1297. IN INT PathToFileBufferSize,
  1298. OUT PBOOL Compressed OPTIONAL
  1299. );
  1300. #define FindPathToInstallationFile(n,p,s) FindPathToInstallationFileEx(n,p,s,NULL)
  1301. BOOL
  1302. FindPathToWinnt32File (
  1303. IN PCTSTR FileRelativePath,
  1304. OUT PTSTR PathToFile,
  1305. IN INT PathToFileBufferSize
  1306. );
  1307. BOOL
  1308. GetFileVersionEx (
  1309. IN PCTSTR FilePath,
  1310. OUT PTSTR FileVersion,
  1311. IN INT CchFileVersion
  1312. );
  1313. #define GetFileVersion(f,v) GetFileVersionEx(f,v,ARRAYSIZE(v))
  1314. //
  1315. // #define to use MyPrivateProfileString to get around virus checkers monitoring operations to C
  1316. // drive that cause us to fail WritePrivateProfileString
  1317. // The problem is that usually these s/w examine the files we touch and in somecases open it
  1318. // with exclusive access. We just need to wait for them to be done.
  1319. //
  1320. BOOL
  1321. MyWritePrivateProfileString(
  1322. LPCTSTR lpAppName, // pointer to section name
  1323. LPCTSTR lpKeyName, // pointer to key name
  1324. LPCTSTR lpString, // pointer to string to add
  1325. LPCTSTR lpFileName // pointer to initialization filename
  1326. );
  1327. #ifdef UNICODE
  1328. #define WritePrivateProfileStringW(w,x,y,z) MyWritePrivateProfileString(w,x,y,z)
  1329. #else
  1330. #define WritePrivateProfileStringA(w,x,y,z) MyWritePrivateProfileString(w,x,y,z)
  1331. #endif
  1332. //
  1333. // Routines having to do with advanced program options
  1334. //
  1335. VOID
  1336. InitVariousOptions(
  1337. VOID
  1338. );
  1339. VOID
  1340. DoOptions(
  1341. IN HWND Parent
  1342. );
  1343. VOID
  1344. DoLanguage(
  1345. IN HWND Parent
  1346. );
  1347. VOID
  1348. DoAccessibility(
  1349. IN HWND Parent
  1350. );
  1351. BOOL
  1352. BrowseForDosnetInf(
  1353. IN HWND hdlg,
  1354. IN LPCTSTR InitialPath,
  1355. OUT TCHAR NewPath[MAX_PATH]
  1356. );
  1357. BOOL
  1358. IsValid8Dot3(
  1359. IN LPCTSTR Path
  1360. );
  1361. //
  1362. // Routines having to do with eula and pid
  1363. //
  1364. #define MAX_PID30_EDIT 5
  1365. extern LPTSTR g_EncryptedPID;
  1366. extern BOOL g_bDeferPIDValidation;
  1367. extern BOOL EulaComplete;
  1368. typedef enum InstallType
  1369. {
  1370. SelectInstall,
  1371. OEMInstall,
  1372. RetailInstall
  1373. };
  1374. VOID
  1375. GetSourceInstallType(
  1376. OUT OPTIONAL PDWORD InstallVariation
  1377. );
  1378. BOOL
  1379. SetPid30(
  1380. HWND hdlg,
  1381. LONG ExpectedPidType,
  1382. LPTSTR pProductId
  1383. );
  1384. #ifdef UNICODE
  1385. PCHAR
  1386. FindRealHalName(
  1387. TCHAR *pHalFileName
  1388. );
  1389. #endif
  1390. //
  1391. // Debugging and logging
  1392. //
  1393. typedef enum {
  1394. Winnt32LogSevereError,
  1395. Winnt32LogError,
  1396. Winnt32LogWarning,
  1397. Winnt32LogInformation,
  1398. Winnt32LogDetailedInformation,
  1399. Winnt32LogMax
  1400. #define WINNT32_HARDWARE_LOG 0x40000000
  1401. } Winnt32DebugLevel;
  1402. extern Winnt32DebugLevel DebugLevel;
  1403. BOOL
  1404. StartDebugLog(
  1405. IN LPCTSTR DebugFileLog,
  1406. IN Winnt32DebugLevel Level
  1407. );
  1408. VOID
  1409. CloseDebugLog(
  1410. VOID
  1411. );
  1412. BOOL
  1413. DebugLog(
  1414. IN Winnt32DebugLevel Level,
  1415. IN LPCTSTR Text, OPTIONAL
  1416. IN UINT MessageId,
  1417. ...
  1418. );
  1419. BOOL
  1420. DebugLog2(
  1421. IN Winnt32DebugLevel Level,
  1422. IN LPCTSTR Text, OPTIONAL
  1423. IN UINT MessageId,
  1424. IN va_list ArgList
  1425. );
  1426. BOOL
  1427. DynUpdtDebugLog(
  1428. IN Winnt32DebugLevel Level,
  1429. IN LPCTSTR Text,
  1430. IN UINT MessageId,
  1431. ...
  1432. );
  1433. BOOL
  1434. ConcatenateFile(
  1435. IN HANDLE hOpenFile,
  1436. IN LPTSTR FileName
  1437. );
  1438. VOID
  1439. GatherOtherLogFiles(
  1440. VOID
  1441. );
  1442. //
  1443. // Memory allocation.
  1444. //
  1445. #define MALLOC(s) malloc(s)
  1446. #define FREE(b) free((PVOID)b)
  1447. #define REALLOC(b,s) realloc((b),(s))
  1448. //
  1449. // Floppy-related stuff.
  1450. //
  1451. extern BOOL MakeBootMedia;
  1452. extern BOOL Floppyless;
  1453. //
  1454. // boot loader timeout value, in string form
  1455. //
  1456. extern TCHAR Timeout[32];
  1457. #if defined(_AMD64_) || defined(_X86_)
  1458. UINT
  1459. FloppyGetTotalFileCount(
  1460. VOID
  1461. );
  1462. DWORD
  1463. FloppyWorkerThread(
  1464. IN PVOID ThreadParameter
  1465. );
  1466. //
  1467. // Routine to lay NT boot code, munge boot.ini, create aux boot sector, etc.
  1468. //
  1469. BOOL
  1470. DoX86BootStuff(
  1471. IN HWND ParentWindow
  1472. );
  1473. BOOL
  1474. PatchTextIntoBootCode(
  1475. VOID
  1476. );
  1477. VOID
  1478. MigrateBootIniData();
  1479. //
  1480. // Drive information abstraction
  1481. //
  1482. typedef struct _WINNT32_DRIVE_INFORMATION {
  1483. DWORD CylinderCount;
  1484. DWORD HeadCount;
  1485. DWORD SectorsPerTrack;
  1486. ULONGLONG SectorCount;
  1487. WORD BytesPerSector;
  1488. } WINNT32_DRIVE_INFORMATION, *PWINNT32_DRIVE_INFORMATION;
  1489. //
  1490. // Routine to get drive form-factor/type.
  1491. //
  1492. MEDIA_TYPE
  1493. GetMediaType(
  1494. IN TCHAR Drive,
  1495. IN PWINNT32_DRIVE_INFORMATION DriveInfo OPTIONAL
  1496. );
  1497. //
  1498. // Disk sector I/O routines
  1499. //
  1500. BOOL
  1501. ReadDiskSectors(
  1502. IN TCHAR Drive,
  1503. IN UINT StartSector,
  1504. IN UINT SectorCount,
  1505. IN UINT SectorSize,
  1506. OUT LPBYTE Buffer
  1507. );
  1508. BOOL
  1509. WriteDiskSectors(
  1510. IN TCHAR Drive,
  1511. IN UINT StartSector,
  1512. IN UINT SectorCount,
  1513. IN UINT SectorSize,
  1514. IN LPBYTE Buffer
  1515. );
  1516. BOOL
  1517. MarkPartitionActive(
  1518. IN TCHAR DriveLetter
  1519. );
  1520. //
  1521. // Enum for filesystems we recognize
  1522. //
  1523. typedef enum {
  1524. Winnt32FsUnknown,
  1525. Winnt32FsFat,
  1526. Winnt32FsFat32,
  1527. Winnt32FsNtfs
  1528. } WINNT32_SYSPART_FILESYSTEM;
  1529. //
  1530. // Hardcoded constant for sector size, and sizes
  1531. // of bootcode areas for various filesystems.
  1532. //
  1533. #define WINNT32_SECTOR_SIZE 512
  1534. #define WINNT32_FAT_BOOT_SECTOR_COUNT 1
  1535. #define WINNT32_NTFS_BOOT_SECTOR_COUNT 16
  1536. #define WINNT32_MAX_BOOT_SIZE (16*WINNT32_SECTOR_SIZE)
  1537. BOOL
  1538. PatchBootCode(
  1539. IN WINNT32_SYSPART_FILESYSTEM FileSystem,
  1540. IN TCHAR Drive,
  1541. IN OUT PUCHAR BootCode,
  1542. IN DWORD BootCodeSize
  1543. );
  1544. #endif // defined(_AMD64_) || defined(_X86_)
  1545. //
  1546. // ARC/NV-RAM stuff
  1547. //
  1548. #if defined _IA64_
  1549. #define SETUPLDR_FILENAME L"SETUPLDR.EFI"
  1550. #elif defined _X86_
  1551. #define SETUPLDR_FILENAME L"arcsetup.exe"
  1552. #else
  1553. #define SETUPLDR_FILENAME L"SETUPLDR"
  1554. #endif
  1555. BOOL
  1556. SetUpNvRam(
  1557. IN HWND ParentWindow
  1558. );
  1559. DWORD
  1560. DriveLetterToArcPath(
  1561. IN WCHAR DriveLetter,
  1562. OUT LPWSTR *ArcPath
  1563. );
  1564. //
  1565. // Implement a terminalserver-safe GetWindowsDirectory()
  1566. //
  1567. UINT
  1568. MyGetWindowsDirectory(
  1569. LPTSTR MyBuffer,
  1570. UINT Size
  1571. );
  1572. //
  1573. // Upgrade stuff
  1574. //
  1575. typedef struct _UPGRADE_SUPPORT {
  1576. TCHAR DllPath[MAX_PATH];
  1577. HINSTANCE DllModuleHandle;
  1578. UINT AfterWelcomePageCount;
  1579. LPPROPSHEETPAGE Pages1;
  1580. UINT AfterOptionsPageCount;
  1581. LPPROPSHEETPAGE Pages2;
  1582. UINT BeforeCopyPageCount;
  1583. LPPROPSHEETPAGE Pages3;
  1584. PWINNT32_PLUGIN_INIT_ROUTINE InitializeRoutine;
  1585. PWINNT32_PLUGIN_GETPAGES_ROUTINE GetPagesRoutine;
  1586. PWINNT32_PLUGIN_WRITEPARAMS_ROUTINE WriteParamsRoutine;
  1587. PWINNT32_PLUGIN_CLEANUP_ROUTINE CleanupRoutine;
  1588. PWINNT32_PLUGIN_OPTIONAL_DIRS_ROUTINE OptionalDirsRoutine;
  1589. } UPGRADE_SUPPORT, *PUPGRADE_SUPPORT;
  1590. extern UPGRADE_SUPPORT UpgradeSupport;
  1591. //
  1592. // Only check to see if we can upgrade or not.
  1593. //
  1594. extern BOOL CheckUpgradeOnly;
  1595. extern BOOL CheckUpgradeOnlyQ;
  1596. extern BOOL UpgradeAdvisorMode;
  1597. BOOL
  1598. InitializeArcStuff(
  1599. IN HWND Parent
  1600. );
  1601. BOOL
  1602. ArcInitializeArcStuff(
  1603. IN HWND Parent
  1604. );
  1605. //
  1606. // Test to see if we're on an ARC based machine
  1607. #ifdef UNICODE
  1608. #if defined(_X86_)
  1609. BOOL
  1610. IsArc(
  1611. VOID
  1612. );
  1613. #elif defined(_AMD64_)
  1614. #define IsArc() FALSE
  1615. #elif defined(_IA64_)
  1616. #define IsArc() TRUE
  1617. #else
  1618. #error "No Target Architecture"
  1619. #endif
  1620. #if defined(EFI_NVRAM_ENABLED)
  1621. BOOL
  1622. IsEfi(
  1623. VOID
  1624. );
  1625. #else
  1626. #define IsEfi() FALSE
  1627. #endif
  1628. VOID
  1629. MigrateBootVarData(
  1630. VOID
  1631. );
  1632. #else
  1633. #define IsArc() FALSE
  1634. #define MigrateBootVarData()
  1635. #endif
  1636. //
  1637. // Build the command console.
  1638. //
  1639. extern BOOL BuildCmdcons;
  1640. #ifdef RUN_SYSPARSE
  1641. //
  1642. // NoSysparse. Set to true if we don't want to run sysparse.exe
  1643. // This hack should be removed before RTM.
  1644. //
  1645. extern BOOL NoSysparse;
  1646. extern PROCESS_INFORMATION piSysparse;
  1647. #endif
  1648. //
  1649. // Internal/undoc'ed stuff
  1650. //
  1651. extern UINT NumberOfLicensedProcessors;
  1652. extern BOOL IgnoreExceptionPackages;
  1653. //
  1654. // Where to get missing files.
  1655. //
  1656. extern TCHAR AlternateSourcePath[MAX_PATH];
  1657. VOID
  1658. InternalProcessCmdLineArg(
  1659. IN LPCTSTR Arg
  1660. );
  1661. //
  1662. // Get Harddisk BPS
  1663. //
  1664. ULONG
  1665. GetHDBps(
  1666. HANDLE hDisk
  1667. );
  1668. #define INIT_OBJA(Obja,UnicodeString,UnicodeText) \
  1669. \
  1670. RtlInitUnicodeString((UnicodeString),(UnicodeText)); \
  1671. \
  1672. InitializeObjectAttributes( \
  1673. (Obja), \
  1674. (UnicodeString), \
  1675. OBJ_CASE_INSENSITIVE, \
  1676. NULL, \
  1677. NULL \
  1678. )
  1679. #define ALIGN(p,val) \
  1680. \
  1681. (PVOID)((((ULONG_PTR)(p) + (val) - 1)) & (~((ULONG_PTR)(val) - 1)))
  1682. #if defined(_AMD64_) || defined(_X86_)
  1683. //
  1684. // PC-98 stuff
  1685. //
  1686. VOID
  1687. SetAutomaticBootselector(
  1688. VOID
  1689. );
  1690. VOID
  1691. SetAutomaticBootselectorNT(
  1692. VOID
  1693. );
  1694. VOID
  1695. SetAutomaticBootselector95(
  1696. VOID
  1697. );
  1698. //
  1699. // read/write disk sectors
  1700. //
  1701. NTSTATUS
  1702. SpReadWriteDiskSectors(
  1703. IN HANDLE Handle,
  1704. IN ULONG SectorNumber,
  1705. IN ULONG SectorCount,
  1706. IN ULONG BytesPerSector,
  1707. IN OUT PVOID AlignedBuffer,
  1708. IN BOOL Write
  1709. );
  1710. #define NEC_WRITESEC TRUE
  1711. #define NEC_READSEC FALSE
  1712. //
  1713. // Get WindowsNT System Position
  1714. //
  1715. UCHAR
  1716. GetSystemPosition(
  1717. PHANDLE phDisk,
  1718. PDISK_GEOMETRY SystemMediaInfo
  1719. );
  1720. BOOL
  1721. IsNEC98(
  1722. VOID
  1723. );
  1724. LONG
  1725. CalcHiddenSector(
  1726. IN TCHAR SystemPartitionDriveLetter,
  1727. IN SHORT Bps
  1728. );
  1729. #endif
  1730. //
  1731. // Registry migration stuff
  1732. //
  1733. //
  1734. // Context structure used for generating inf files (infgen.c)
  1735. //
  1736. #define INFLINEBUFLEN 512
  1737. typedef struct _INFFILEGEN {
  1738. TCHAR FileName[MAX_PATH];
  1739. HANDLE FileHandle;
  1740. BOOL SawBogusOp;
  1741. TCHAR LineBuf[INFLINEBUFLEN];
  1742. unsigned LineBufUsed;
  1743. } INFFILEGEN, *PINFFILEGEN;
  1744. DWORD
  1745. InfStart(
  1746. IN LPCTSTR InfName,
  1747. IN LPCTSTR Directory,
  1748. OUT PINFFILEGEN *Context
  1749. );
  1750. DWORD
  1751. InfEnd(
  1752. IN OUT PINFFILEGEN *Context
  1753. );
  1754. DWORD
  1755. InfCreateSection(
  1756. IN LPCTSTR SectionName,
  1757. IN OUT PINFFILEGEN *Context
  1758. );
  1759. DWORD
  1760. InfRecordAddReg(
  1761. IN OUT PINFFILEGEN Context,
  1762. IN HKEY Key,
  1763. IN LPCTSTR Subkey,
  1764. IN LPCTSTR Value, OPTIONAL
  1765. IN DWORD DataType,
  1766. IN PVOID Data,
  1767. IN DWORD DataLength,
  1768. IN BOOL SetNoClobberFlag
  1769. );
  1770. ULONG
  1771. DumpRegKeyToInf(
  1772. IN PINFFILEGEN InfContext,
  1773. IN HKEY PredefinedKey,
  1774. IN LPCTSTR FullKeyPath,
  1775. IN BOOL DumpIfEmpty,
  1776. IN BOOL DumpSubKeys,
  1777. IN BOOL SetNoClobberFlag,
  1778. IN BOOL DumpNonVolatileKey
  1779. );
  1780. DWORD
  1781. WriteText(
  1782. IN HANDLE FileHandle,
  1783. IN UINT MessageId,
  1784. ...
  1785. );
  1786. //
  1787. // Unsupported driver migration stuff
  1788. //
  1789. //
  1790. // Structure used to build a list of files associated to and usupported
  1791. // driver that was detected on the NT system to be upgraded.
  1792. //
  1793. typedef struct _UNSUPORTED_PNP_HARDWARE_ID {
  1794. //
  1795. // Pointer to the next element in the list
  1796. //
  1797. struct _UNSUPORTED_PNP_HARDWARE_ID *Next;
  1798. //
  1799. // String that represents the hardware id of a PNP device.
  1800. //
  1801. LPTSTR Id;
  1802. //
  1803. // Service for the device
  1804. //
  1805. LPTSTR Service;
  1806. //
  1807. // GUID for this device, if any
  1808. //
  1809. LPTSTR ClassGuid;
  1810. } UNSUPORTED_PNP_HARDWARE_ID, *PUNSUPORTED_PNP_HARDWARE_ID;
  1811. typedef struct _UNSUPORTED_DRIVER_FILE_INFO {
  1812. //
  1813. // Pointer to the next element in the list
  1814. //
  1815. struct _UNSUPORTED_DRIVER_FILE_INFO *Next;
  1816. //
  1817. // Pointer to the file name
  1818. //
  1819. LPTSTR FileName;
  1820. //
  1821. // Pointer to the path relative to %SystemRoot% where the file
  1822. // should be installed.
  1823. //
  1824. LPTSTR TargetDirectory;
  1825. } UNSUPORTED_DRIVER_FILE_INFO, *PUNSUPORTED_DRIVER_FILE_INFO;
  1826. typedef struct _UNSUPORTED_DRIVER_INSTALL_INFO {
  1827. //
  1828. // Pointer to the next element in the list
  1829. //
  1830. struct _UNSUPORTED_DRIVER_INSTALL_INFO *Next;
  1831. //
  1832. // Pointer to the path relative to %SystemRoot%
  1833. // where the actual inf file is currently installed
  1834. //
  1835. LPTSTR InfRelPath;
  1836. //
  1837. // Pointer to the actual INF file name
  1838. //
  1839. LPTSTR InfFileName;
  1840. //
  1841. // Pointer to the original INF file name (optional)
  1842. //
  1843. LPTSTR InfOriginalFileName;
  1844. //
  1845. // Pointer to the path relative to %SystemRoot%
  1846. // where the actual catalog file is currently installed (optional)
  1847. //
  1848. LPTSTR CatalogRelPath;
  1849. //
  1850. // Pointer to the actual catalog name (optional)
  1851. //
  1852. LPTSTR CatalogFileName;
  1853. //
  1854. // Pointer to the original catalog name (optional)
  1855. //
  1856. LPTSTR CatalogOriginalFileName;
  1857. } UNSUPORTED_DRIVER_INSTALL_INFO, *PUNSUPORTED_DRIVER_INSTALL_INFO;
  1858. typedef struct _UNSUPORTED_DRIVER_REGKEY_INFO {
  1859. //
  1860. // Pointer to the next element in the list
  1861. //
  1862. struct _UNSUPORTED_DRIVER_REGKEY_INFO *Next;
  1863. //
  1864. // A predefined key
  1865. //
  1866. HKEY PredefinedKey;
  1867. //
  1868. // Path to the key to be migrated, relative to a predefined key.
  1869. //
  1870. LPTSTR KeyPath;
  1871. //
  1872. // Undicates whether or not volatile keys should be migrated
  1873. //
  1874. BOOL MigrateVolatileKeys;
  1875. } UNSUPORTED_DRIVER_REGKEY_INFO, *PUNSUPORTED_DRIVER_REGKEY_INFO;
  1876. typedef struct _UNSUPORTED_DRIVER_INFO {
  1877. //
  1878. // Pointer to the next element in the list
  1879. //
  1880. struct _UNSUPORTED_DRIVER_INFO *Next;
  1881. //
  1882. // A string that identifies the driver to be migrated (such as aic78xx)
  1883. //
  1884. LPTSTR DriverId;
  1885. //
  1886. // Points to the list of files associated to the unsupported driver
  1887. //
  1888. PUNSUPORTED_DRIVER_REGKEY_INFO KeyList;
  1889. //
  1890. // Points to the list of keys associated to the unsupported driver
  1891. //
  1892. PUNSUPORTED_DRIVER_FILE_INFO FileList;
  1893. //
  1894. // Points to the list of install info associated to the unsupported driver
  1895. //
  1896. PUNSUPORTED_DRIVER_INSTALL_INFO InstallList;
  1897. //
  1898. // Points to the list of hardware ids associated to the unsupported driver
  1899. //
  1900. PUNSUPORTED_PNP_HARDWARE_ID HardwareIdsList;
  1901. } UNSUPORTED_DRIVER_INFO, *PUNSUPORTED_DRIVER_INFO;
  1902. //
  1903. // Unsupported driver list
  1904. // This list contains the information about the unsupported drivers that needs
  1905. // to be migrated on a clean install or upgrade.
  1906. //
  1907. // extern PUNSUPORTED_DRIVER_INFO UnsupportedDriverList;
  1908. BOOL
  1909. BuildUnsupportedDriverList(
  1910. IN PVOID TxtsetupSifHandle,
  1911. OUT PUNSUPORTED_DRIVER_INFO* DriverList
  1912. );
  1913. BOOL
  1914. SaveUnsupportedDriverInfo(
  1915. IN HWND ParentWindow,
  1916. IN LPTSTR FileName,
  1917. IN PUNSUPORTED_DRIVER_INFO DriverList
  1918. );
  1919. BOOL
  1920. AddUnsupportedFilesToCopyList(
  1921. IN HWND ParentWindow,
  1922. IN PUNSUPORTED_DRIVER_INFO DriverList
  1923. );
  1924. BOOL
  1925. MigrateUnsupportedNTDrivers(
  1926. IN HWND ParentWindow,
  1927. IN PVOID TxtsetupSifHandle
  1928. );
  1929. // Error codes and Function to check schema version for NT5 DC Upgrades
  1930. #define DSCHECK_ERR_SUCCESS 0
  1931. #define DSCHECK_ERR_FILE_NOT_FOUND 1
  1932. #define DSCHECK_ERR_FILE_COPY 2
  1933. #define DSCHECK_ERR_VERSION_MISMATCH 3
  1934. #define DSCHECK_ERR_CREATE_DIRECTORY 4
  1935. BOOL
  1936. ISDC(
  1937. VOID
  1938. );
  1939. BOOL
  1940. IsNT5DC();
  1941. int
  1942. CheckSchemaVersionForNT5DCs(
  1943. IN HWND ParentWnd
  1944. );
  1945. //
  1946. // Diagnostic/debug functions in debug.c
  1947. //
  1948. //
  1949. // Allow assertion checking to be turned on independently
  1950. // of DBG, like by specifying C_DEFINES=-DASSERTS_ON=1 in sources file.
  1951. //
  1952. #ifndef ASSERTS_ON
  1953. #if DBG
  1954. #define ASSERTS_ON 1
  1955. #else
  1956. #define ASSERTS_ON 0
  1957. #endif
  1958. #endif
  1959. #if ASSERTS_ON
  1960. #ifndef MYASSERT
  1961. #define MYASSERT(x) if(!(x)) { AssertFail(__FILE__,__LINE__,#x); }
  1962. VOID
  1963. AssertFail(
  1964. IN PSTR FileName,
  1965. IN UINT LineNumber,
  1966. IN PSTR Condition
  1967. );
  1968. #endif
  1969. #else
  1970. #define MYASSERT(x)
  1971. #endif
  1972. #if defined(_AMD64_) || defined(_X86_)
  1973. VOID
  1974. ProtectAllModules (
  1975. VOID
  1976. );
  1977. #endif
  1978. BOOL
  1979. WriteHeadlessParameters(
  1980. IN LPCTSTR FileName
  1981. );
  1982. //
  1983. // Setup Log prototypes in setupapi.dll
  1984. //
  1985. typedef BOOL(WINAPI * SETUPOPENLOG)(BOOL Erase);
  1986. typedef BOOL(WINAPI * SETUPLOGERROR)(PCTSTR MessageString, LogSeverity Severity);
  1987. typedef VOID(WINAPI * SETUPCLOSELOG)(VOID);
  1988. //
  1989. // Default throughput (5 KB/msec)
  1990. //
  1991. #define DEFAULT_IO_THROUGHPUT (5 * 1024)
  1992. extern DWORD dwThroughPutSrcToDest;
  1993. extern DWORD dwThroughPutHDToHD;
  1994. void CalcThroughput();
  1995. // Should allow 1K for strings for localization
  1996. #define MAX_STRING 1024
  1997. BOOL
  1998. SaveAdvancedOptions (
  1999. IN PCTSTR AnswerFile
  2000. );
  2001. BOOL
  2002. SaveLanguageOptions (
  2003. IN PCTSTR AnswerFile
  2004. );
  2005. BOOL
  2006. SaveAccessibilityOptions (
  2007. IN PCTSTR AnswerFile
  2008. );
  2009. BOOL
  2010. LoadAdvancedOptions (
  2011. IN PCTSTR AnswerFile
  2012. );
  2013. BOOL
  2014. LoadLanguageOptions (
  2015. IN PCTSTR AnswerFile
  2016. );
  2017. BOOL
  2018. LoadAccessibilityOptions (
  2019. IN PCTSTR AnswerFile
  2020. );
  2021. BOOL
  2022. AddCopydirIfExists(
  2023. IN LPTSTR pszPathToCopy,
  2024. IN UINT Flags
  2025. );
  2026. BOOL
  2027. IsNetConnectivityAvailable (
  2028. VOID
  2029. );
  2030. BOOL
  2031. ValidatePidEx(LPTSTR PID, BOOL *pbStepup, BOOL *bSelect);
  2032. #ifdef PRERELEASE
  2033. #define TEST_EXCEPTION 1
  2034. #endif
  2035. #define SETUP_FAULTH_APPNAME "drw\\faulth.dll"
  2036. //#define SETUP_URL "officewatson"
  2037. #define SETUP_URL "watson.microsoft.com"
  2038. #define S_WINNT32LOGFILE TEXT("WINNT32.LOG")
  2039. #define S_DEFAULT_NT_COMPAT_FILENAME TEXT("UPGRADE.TXT")
  2040. #ifdef TEST_EXCEPTION
  2041. void DoException( DWORD dwSetupArea);
  2042. #endif