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.

535 lines
13 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. spsif.c
  5. Abstract:
  6. Section names and other data used for indexing into
  7. setup information files.
  8. Author:
  9. Ted Miller (tedm) 31-August-1993
  10. Revision History:
  11. --*/
  12. #include "spprecmp.h"
  13. #pragma hdrstop
  14. //
  15. // [DiskDriverMap]
  16. //
  17. PWSTR SIF_DISKDRIVERMAP = L"DiskDriverMap";
  18. PWSTR SIF_SETUPMEDIA = L"SourceDisksNames";
  19. PWSTR SIF_FILESONSETUPMEDIA = L"SourceDisksFiles";
  20. //
  21. // [Files.KeyboardLayout]
  22. //
  23. PWSTR SIF_KEYBOARDLAYOUTFILES = L"Files.KeyboardLayout";
  24. PWSTR SIF_KEYBOARDLAYOUTDESC = L"Keyboard Layout";
  25. //
  26. // [Files.Vga]
  27. //
  28. PWSTR SIF_VGAFILES = L"Files.Vga";
  29. //
  30. // [WinntDirectories]
  31. //
  32. PWSTR SIF_NTDIRECTORIES = L"WinntDirectories";
  33. //
  34. // [SystemPartitionFiles]
  35. //
  36. PWSTR SIF_SYSPARTCOPYALWAYS = L"SystemPartitionFiles";
  37. //
  38. // [SystemPartitionRoot]
  39. //
  40. PWSTR SIF_SYSPARTROOT = L"SystemPartitionRoot";
  41. //
  42. // [SystemPartitionUtilities]
  43. //
  44. PWSTR SIF_SYSPARTUTIL = L"SystemPartitionUtilities";
  45. //
  46. // [Keyboard Layout]
  47. //
  48. PWSTR SIF_KEYBOARDLAYOUT = L"Keyboard Layout";
  49. #if defined(REMOTE_BOOT)
  50. //
  51. // [Files.RemoteBoot]
  52. //
  53. PWSTR SIF_REMOTEBOOTFILES = L"Files.RemoteBoot";
  54. #endif // defined(REMOTE_BOOT)
  55. //
  56. // [SpecialFiles]
  57. // Multiprocessor =
  58. // Uniprocessor =
  59. // Atdisk =
  60. // abiosdsk =
  61. // mouseclass =
  62. // keyboardclass =
  63. //
  64. PWSTR SIF_SPECIALFILES = L"SpecialFiles";
  65. PWSTR SIF_MPKERNEL = L"Multiprocessor";
  66. PWSTR SIF_UPKERNEL = L"Uniprocessor";
  67. PWSTR SIF_ATDISK = L"atdisk";
  68. PWSTR SIF_ABIOSDISK = L"abiosdsk";
  69. PWSTR SIF_MOUSECLASS = L"MouseClass";
  70. PWSTR SIF_KEYBOARDCLASS = L"KeyboardClass";
  71. //
  72. // [bootvid]
  73. //
  74. PWSTR SIF_BOOTVID = L"bootvid";
  75. //
  76. // [hal]
  77. //
  78. PWSTR SIF_HAL = L"hal";
  79. //
  80. // [ntdetect]
  81. // standard =
  82. //
  83. PWSTR SIF_NTDETECT = L"ntdetect";
  84. PWSTR SIF_STANDARD = L"standard";
  85. //
  86. // [BootBusExtenders]
  87. //
  88. PWSTR SIF_BOOTBUSEXTENDERS = L"BootBusExtenders";
  89. //
  90. // [BusExtenders]
  91. //
  92. PWSTR SIF_BUSEXTENDERS = L"BusExtenders";
  93. //
  94. // [InputDevicesSupport]
  95. //
  96. PWSTR SIF_INPUTDEVICESSUPPORT = L"InputDevicesSupport";
  97. //
  98. // Driver load lists.
  99. //
  100. PWSTR SIF_SCSICLASSDRIVERS = L"ScsiClass";
  101. PWSTR SIF_DISKDRIVERS = L"DiskDrivers";
  102. PWSTR SIF_CDROMDRIVERS = L"CdRomDrivers";
  103. PWSTR SIF_FILESYSTEMS = L"FileSystems";
  104. //
  105. // [SetupData]
  106. // ProductType =
  107. // 0 = workstation
  108. // 1 = server
  109. // 2 = advanced server (subset of server)
  110. // 3 = datacenter server (subset of advanced server)
  111. // 4 = personal (subset of workstation)
  112. //
  113. // FreeDiskSpace =
  114. // <amount of free space in KB>
  115. // FreeSysPartDiskSpace =
  116. // <amount of free space on system partition in KB>
  117. // DefaultPath =
  118. // <default target path, like \winnt for example>
  119. // DefaultLayout =
  120. // <value that matches an entry in [Keyboard Layout]>
  121. // LoadIdentifier =
  122. // <LOADIDENTIFIER boot variable: string to display in boot menu>
  123. // BaseVideoLoadId =
  124. // <string to display in boot menu for VGA mode boot [x86 only]>
  125. // OsLoadOptions =
  126. // <OSLOADOPTIONS for setup boot>
  127. // OsLoadOptionsVar =
  128. // <optional OSLOADOPTIONS boot variable value>
  129. // OsLoadOptionsVarAppend =
  130. // <optional OSLOADOPTIONS boot variable value to be appended to existing options >
  131. // SetupSourceDevice =
  132. // <OPTIONAL: Nt path of source device, overrides cd-rom, etc>
  133. // SetupSourcePath =
  134. // <directory on setup source where setup tree is to be found>
  135. // DontCopy =
  136. // <OPTIONAL: 0,1, indicates whether to skip actual file copying>
  137. // RequiredMemory =
  138. // <number of bytes of memory required for installation>
  139. // SetupCmdlinePrepend =
  140. // <value to stick at front of command line, like windbg or ntsd -d>
  141. //
  142. PWSTR SIF_SETUPDATA = L"SetupData";
  143. PWSTR SIF_DISKSPACEREQUIREMENTS = L"DiskSpaceRequirements";
  144. PWSTR SIF_PRODUCTTYPE = L"ProductType";
  145. PWSTR SIF_MAJORVERSION = L"MajorVersion";
  146. PWSTR SIF_MINORVERSION = L"MinorVersion";
  147. PWSTR SIF_WINDIRSPACE = L"WindirSpace";
  148. PWSTR SIF_FREESYSPARTDISKSPACE = L"FreeSysPartDiskSpace";
  149. PWSTR SIF_DEFAULTPATH = L"DefaultPath";
  150. PWSTR SIF_LOADIDENTIFIER = L"LoadIdentifier";
  151. PWSTR SIF_BASEVIDEOLOADID = L"BaseVideoLoadId";
  152. PWSTR SIF_OSLOADOPTIONS = L"OsLoadOptions";
  153. PWSTR SIF_OSLOADOPTIONSVAR = L"OsLoadOptionsVar";
  154. PWSTR SIF_OSLOADOPTIONSVARAPPEND = L"OsLoadOptionsVarAppend";
  155. PWSTR SIF_SETUPSOURCEDEVICE = L"SetupSourceDevice";
  156. PWSTR SIF_SETUPSOURCEPATH = L"SetupSourcePath";
  157. PWSTR SIF_DONTCOPY = L"DontCopy";
  158. PWSTR SIF_REQUIREDMEMORY = L"RequiredMemory";
  159. PWSTR SIF_SETUPCMDPREPEND = L"SetupCmdlinePrepend";
  160. PWSTR SIF_PAGEFILE = L"Pagefile";
  161. //
  162. // [nls]
  163. // AnsiCodePage = <filename>,<identifier>
  164. // OemCodePage = <filename>,<identifier>
  165. // MacCodePage = <filename>,<identifier>
  166. // UnicodeCasetable = <filename>
  167. // OemHalFont = <filename>
  168. // DefaultLayout = <identifier>
  169. //
  170. PWSTR SIF_NLS = L"nls";
  171. PWSTR SIF_ANSICODEPAGE = L"AnsiCodepage";
  172. PWSTR SIF_OEMCODEPAGE = L"OemCodepage";
  173. PWSTR SIF_MACCODEPAGE = L"MacCodepage";
  174. PWSTR SIF_UNICODECASETABLE = L"UnicodeCasetable";
  175. PWSTR SIF_OEMHALFONT = L"OemHalFont";
  176. PWSTR SIF_DEFAULTLAYOUT = L"DefaultLayout";
  177. //
  178. // 1.0 repair disk sections.
  179. //
  180. PWSTR SIF_REPAIRWINNTFILES = L"Repair.WinntFiles";
  181. PWSTR SIF_REPAIRSYSPARTFILES = L"Repair.BootFiles";
  182. //
  183. // UPGRADE SIF SECTIONS
  184. //
  185. //
  186. // Upgrade Registry sections
  187. // =========================
  188. //
  189. //
  190. // 1. The following section allows us to specify services to disable which may
  191. // cause popups when net services are disabled:
  192. //
  193. // [NetServicesToDisable]
  194. // ServiceName1
  195. // ...
  196. //
  197. // 2. The following section allows us to remove keys which have been removed
  198. // since the Windows NT 3.1 release:
  199. //
  200. // [KeysToDelete]
  201. // RootName1( System | Software | Default | ControlSet ), RootRelativePath1
  202. // ...
  203. //
  204. // 3. The following sections allow us to add/change keys / values under keys
  205. // which have changed since the Windows NT 3.1 release:
  206. //
  207. // [KeysToAdd]
  208. // RootName1, RootRelativePath1, ValueSection1 (can be "")
  209. // ...
  210. //
  211. // [ValueSection1]
  212. // name1 , type1, value1
  213. // name2 , ...
  214. //
  215. // Format of the value is the following
  216. //
  217. // a. Type REG_SZ: name , REG_SZ, "value string"
  218. // b. Type REG_EXPAND_SZ name , REG_EXPAND_SZ, "value string"
  219. // c. Type REG_MULTI_SZ name , REG_MULTI_SZ, "value string1", "value string2", ...
  220. // d. Type REG_BINARY name , REG_BINARY, byte1, byte2, ...
  221. // e. Type REG_DWORD name , REG_DWORD, dword
  222. // f. Type REG_BINARY_DWORD name , REG_BINARY_DWORD, dword1, dword2, ...
  223. //
  224. PWSTR SIF_NET_SERVICES_TO_DISABLE = L"NetServicesToDisable";
  225. PWSTR SIF_KEYS_TO_DELETE = L"KeysToDelete";
  226. PWSTR SIF_KEYS_TO_ADD = L"KeysToAdd";
  227. PWSTR SIF_SYSTEM_HIVE = L"System";
  228. PWSTR SIF_SOFTWARE_HIVE = L"Software";
  229. PWSTR SIF_DEFAULT_HIVE = L"Default";
  230. PWSTR SIF_CONTROL_SET = L"ControlSet";
  231. PWSTR SIF_REG_SZ = L"REG_SZ";
  232. PWSTR SIF_REG_EXPAND_SZ = L"REG_EXPAND_SZ";
  233. PWSTR SIF_REG_MULTI_SZ = L"REG_MULTI_SZ";
  234. PWSTR SIF_REG_BINARY = L"REG_BINARY";
  235. PWSTR SIF_REG_BINARY_DWORD = L"REG_BINARY_DWORD";
  236. PWSTR SIF_REG_DWORD = L"REG_DWORD";
  237. //
  238. // Upgrade File Sections
  239. // =====================
  240. //
  241. //
  242. //
  243. // Files to backup, delete or move
  244. //
  245. PWSTR SIF_FILESDELETEONUPGRADE = L"Files.DeleteOnUpgrade";
  246. PWSTR SIF_FILESBACKUPONUPGRADE = L"Files.BackupOnUpgrade";
  247. PWSTR SIF_FILESBACKUPONOVERWRITE = L"Files.BackupOnOverwrite";
  248. //
  249. // Directories to delete
  250. //
  251. PWSTR SIF_DIRSDELETEONUPGRADE = L"Directories.DeleteOnUpgrade";
  252. #ifdef _X86_
  253. PWSTR SIF_FILESMOVEBEFOREMIGRATION = L"Files.MoveBeforeMigration";
  254. PWSTR SIF_FILESDELETEBEFOREMIGRATION = L"Files.DeleteBeforeMigration";
  255. #endif
  256. //
  257. // Files to copy
  258. //
  259. PWSTR SIF_FILESUPGRADEWIN31 = L"Files.UpgradeWin31";
  260. PWSTR SIF_FILESNEWHIVES = L"Files.NewHives";
  261. //
  262. // New sections and keys added to setup.log
  263. //
  264. PWSTR SIF_NEW_REPAIR_WINNTFILES = L"Files.WinNt";
  265. PWSTR SIF_NEW_REPAIR_SYSPARTFILES = L"Files.SystemPartition";
  266. PWSTR SIF_NEW_REPAIR_SIGNATURE = L"Signature";
  267. PWSTR SIF_NEW_REPAIR_VERSION_KEY = L"Version";
  268. PWSTR SIF_NEW_REPAIR_NT_VERSION = NULL; // Will be created during the
  269. // initialization of setupdd
  270. //
  271. PWSTR SIF_NEW_REPAIR_NT_VERSION_TEMPLATE= L"WinNt%d.%d";
  272. PWSTR SIF_NEW_REPAIR_PATHS = L"Paths";
  273. PWSTR SIF_NEW_REPAIR_PATHS_SYSTEM_PARTITION_DEVICE = L"SystemPartition";
  274. PWSTR SIF_NEW_REPAIR_PATHS_SYSTEM_PARTITION_DIRECTORY = L"SystemPartitionDirectory";
  275. PWSTR SIF_NEW_REPAIR_PATHS_TARGET_DEVICE = L"TargetDevice";
  276. PWSTR SIF_NEW_REPAIR_PATHS_TARGET_DIRECTORY = L"TargetDirectory";
  277. PWSTR SETUP_REPAIR_DIRECTORY = L"repair";
  278. PWSTR SETUP_LOG_FILENAME = L"\\setup.log";
  279. PWSTR SIF_NEW_REPAIR_FILES_IN_REPAIR_DIR = L"Files.InRepairDirectory";
  280. //
  281. // Unattended mode sections (winnt.sif)
  282. //
  283. PWSTR SIF_DATA = WINNT_DATA_W;
  284. PWSTR SIF_UNATTENDED = WINNT_UNATTENDED_W;
  285. PWSTR SIF_SETUPPARAMS = WINNT_SETUPPARAMS_W;
  286. PWSTR SIF_CONFIRMHW = WINNT_U_CONFIRMHW_W;
  287. PWSTR SIF_GUI_UNATTENDED = WINNT_GUIUNATTENDED_W;
  288. PWSTR SIF_UNATTENDED_INF_FILE = WINNT_GUI_FILE_W;
  289. PWSTR SIF_UNIQUEID = WINNT_D_UNIQUEID_W;
  290. PWSTR SIF_ACCESSIBILITY = WINNT_ACCESSIBILITY_W;
  291. PWSTR SIF_EXTENDOEMPART = L"ExtendOemPartition";
  292. PWSTR SIF_REMOTEINSTALL = L"RemoteInstall";
  293. #if defined(REMOTE_BOOT)
  294. PWSTR SIF_REMOTEBOOT = L"RemoteBoot";
  295. PWSTR SIF_ENABLEIPSECURITY = L"EnableIpSecurity";
  296. #endif // defined(REMOTE_BOOT)
  297. PWSTR SIF_REPARTITION = L"Repartition";
  298. PWSTR SIF_USEWHOLEDISK = L"UseWholeDisk";
  299. PWSTR SIF_INCOMPATIBLE_TEXTMODE = WINNT_OVERWRITE_EXISTING_W;
  300. //
  301. // Alternate Source data
  302. //
  303. PWSTR SIF_UPDATEDSOURCES = WINNT_SP_UPDATEDSOURCES_W;
  304. //PWSTR SIF_ALTCOPYFILESSECTION = WINNT_SP_ALTCOPY_W;
  305. PWSTR
  306. SpPlatformSpecificLookup(
  307. IN PVOID SifHandle,
  308. IN PWSTR Section,
  309. IN PWSTR Key,
  310. IN ULONG Index,
  311. IN BOOLEAN Fatal
  312. )
  313. /*++
  314. Routine Description:
  315. Look up a value in a platform-specific section and if not found,
  316. then in a platform-independent section. The platform-specific
  317. section name is the platform-independent name with .<platform>
  318. appended to it (where <platform is x86, mips, etc).
  319. Arguments:
  320. SifHandle - supplies a handle to the open sif in which the
  321. value is to be found.
  322. Section - supplies the base section name of the section in which
  323. the value is to be found.
  324. Key - supplies the key name of the line in the section in which
  325. the value is to be found.
  326. Index - supplies the index (0-based) of the value to be looked up
  327. on the line with the given Key in the given section or its
  328. platform-specific analogue.
  329. Fatal - if TRUE and the value is not found, then this is a fatal error
  330. and this routine will not return. if FALSE and the value is not
  331. found, then this routine returns NULL.
  332. Return Value:
  333. Value located in the section or its platform-specific analog,
  334. or NULL if it cannot be found and Fatal was FALSE.
  335. --*/
  336. {
  337. PWSTR p = NULL;
  338. PWSTR PlatformSpecificSection;
  339. PlatformSpecificSection = SpMakePlatformSpecificSectionName(Section);
  340. if (PlatformSpecificSection) {
  341. p = SpGetSectionKeyIndex(SifHandle,PlatformSpecificSection,Key,Index);
  342. SpMemFree(PlatformSpecificSection);
  343. }
  344. if(!p) {
  345. p = SpGetSectionKeyIndex(SifHandle,Section,Key,Index);
  346. }
  347. if(!p && Fatal) {
  348. SpFatalSifError(SifHandle,Section,Key,0,Index);
  349. }
  350. return(p);
  351. }
  352. PWSTR
  353. SpLookUpTargetDirectory(
  354. IN PVOID SifHandle,
  355. IN PWSTR Symbol
  356. )
  357. /*++
  358. Routine Description:
  359. Retreive the target directory associated with a particular
  360. shortname. The symbol is looked for as a key in the platform-
  361. specific [WinntDirectories.xxx] section and if not found there,
  362. in the platform-independent [WinntDirectories] section.
  363. Arguments:
  364. SifHandle - supplies a handle to the open sif in which the
  365. [WinntDirectories] sections are to be found.
  366. Return Value:
  367. --*/
  368. {
  369. PWSTR p;
  370. p = SpPlatformSpecificLookup(
  371. SifHandle,
  372. SIF_NTDIRECTORIES,
  373. Symbol,
  374. 0,
  375. TRUE
  376. );
  377. return(p);
  378. }
  379. PWSTR
  380. SpLookUpValueForFile(
  381. IN PVOID SifHandle,
  382. IN PWSTR File,
  383. IN ULONG Index,
  384. IN BOOLEAN Fatal
  385. )
  386. /*++
  387. Routine Description:
  388. Arguments:
  389. Return Value:
  390. --*/
  391. {
  392. PWSTR p;
  393. p = SpPlatformSpecificLookup(
  394. SifHandle,
  395. SIF_FILESONSETUPMEDIA,
  396. File,
  397. Index,
  398. Fatal
  399. );
  400. return(p);
  401. }
  402. BOOLEAN
  403. IsFileFlagSet(
  404. IN PVOID SifHandle,
  405. IN PWSTR FileName,
  406. IN ULONG Flag
  407. )
  408. {
  409. PWSTR file;
  410. PWSTR p;
  411. ULONG flags;
  412. BOOLEAN b;
  413. //
  414. // Locate file name
  415. //
  416. if(file = wcsrchr(FileName,L'\\')) {
  417. file++;
  418. } else {
  419. file = FileName;
  420. }
  421. if(p = SpGetSectionKeyIndex(SifHandle,L"FileFlags",file,0)) {
  422. flags = SpStringToLong(p,NULL,10);
  423. b = (flags & Flag) ? TRUE : FALSE;
  424. } else {
  425. b = FALSE;
  426. }
  427. return(b);
  428. }