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.

283 lines
6.7 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name:
  4. spboot.h
  5. Abstract:
  6. Header file for functions to deal with boot variables.
  7. Author:
  8. Sunil Pai (sunilp) 26-Oct-1993
  9. Revision History:
  10. --*/
  11. #ifndef _SPBOOTVARS_DEFN_
  12. #define _SPBOOTVARS_DEFN_
  13. //
  14. // Define a Unicode string type to be used for storing drive letter
  15. // specifications in upgrade messages (useful because we may not
  16. // have a drive letter, but rather a localizable designator stating
  17. // that the partition is a mirror (eg. "(Mirror):"))
  18. //
  19. typedef WCHAR DRIVELTR_STRING[32];
  20. //
  21. // SP_BOOT_ENTRY is the internal representation of a boot item (or "boot set").
  22. // EFI and ARC NVRAM entries, and boot.ini entries, are kept in this format.
  23. // The NtBootEntry item is the structure passed to/from the NT boot entry APIs.
  24. //
  25. typedef struct _SP_BOOT_ENTRY {
  26. struct _SP_BOOT_ENTRY *Next;
  27. PUCHAR AllocationEnd;
  28. ULONG_PTR Status;
  29. PWSTR FriendlyName;
  30. ULONG_PTR FriendlyNameLength;
  31. PWSTR OsLoadOptions;
  32. ULONG_PTR OsLoadOptionsLength;
  33. PFILE_PATH LoaderPath;
  34. PWSTR LoaderPartitionNtName;
  35. PDISK_REGION LoaderPartitionDiskRegion;
  36. PWSTR LoaderFile;
  37. PFILE_PATH OsPath;
  38. PWSTR OsPartitionNtName;
  39. PDISK_REGION OsPartitionDiskRegion;
  40. PWSTR OsDirectory;
  41. LOGICAL Processable;
  42. LOGICAL FailedUpgrade;
  43. NT_PRODUCT_TYPE ProductType;
  44. ULONG MajorVersion;
  45. ULONG MinorVersion;
  46. ULONG ProductSuiteMask;
  47. ULONG BuildNumber;
  48. ULONG ServicePack;
  49. ULONGLONG KernelVersion;
  50. LCID LangId;
  51. PWSTR Pid20Array;
  52. DRIVELTR_STRING DriveLetterString;
  53. BOOLEAN UpgradeOnlyCompliance;
  54. BOOT_ENTRY NtBootEntry;
  55. } SP_BOOT_ENTRY, *PSP_BOOT_ENTRY;
  56. //
  57. //
  58. //
  59. typedef enum {
  60. UseDefaultSwitches = 0,
  61. DisableRedirect,
  62. UseUserDefinedRedirect,
  63. UseUserDefinedRedirectAndBaudRate
  64. } RedirectSwitchesModeEnum;
  65. #define MAXSIZE_REDIRECT_SWITCH 128
  66. typedef struct _REDIRECT_SWITCHES_ {
  67. CHAR port[MAXSIZE_REDIRECT_SWITCH];
  68. CHAR baudrate[MAXSIZE_REDIRECT_SWITCH];
  69. } REDIRECT_SWITCHES, PREDIRECT_SWITCHES;
  70. extern RedirectSwitchesModeEnum RedirectSwitchesMode;
  71. extern REDIRECT_SWITCHES RedirectSwitches;
  72. NTSTATUS
  73. SpSetRedirectSwitchMode(
  74. RedirectSwitchesModeEnum mode,
  75. PCHAR redirectSwitch,
  76. PCHAR redirectBaudRateSwitch
  77. );
  78. //
  79. // node for the linked list used to communicate the contents
  80. // of a boot entry outside this library
  81. //
  82. typedef struct _SP_EXPORTED_BOOT_ENTRY_ {
  83. LIST_ENTRY ListEntry;
  84. PWSTR LoadIdentifier;
  85. PWSTR OsLoadOptions;
  86. WCHAR DriverLetter;
  87. PWSTR OsDirectory;
  88. } SP_EXPORTED_BOOT_ENTRY, *PSP_EXPORTED_BOOT_ENTRY;
  89. NTSTATUS
  90. SpExportBootEntries(
  91. PLIST_ENTRY BootEntries,
  92. PULONG BootEntryCnt
  93. );
  94. NTSTATUS
  95. SpFreeExportedBootEntries(
  96. PLIST_ENTRY BootEntries,
  97. ULONG BootEntryCnt
  98. );
  99. NTSTATUS
  100. SpAddNTInstallToBootList(
  101. IN PVOID SifHandle,
  102. IN PDISK_REGION SystemPartitionRegion,
  103. IN PWSTR SystemPartitionDirectory,
  104. IN PDISK_REGION NtPartitionRegion,
  105. IN PWSTR Sysroot,
  106. IN PWSTR OsLoadOptions, OPTIONAL
  107. IN PWSTR LoadIdentifier OPTIONAL
  108. );
  109. NTSTATUS
  110. SpAddUserDefinedInstallationToBootList(
  111. IN PVOID SifHandle,
  112. IN PDISK_REGION SystemPartitionRegion,
  113. IN PWSTR SystemPartitionDirectory,
  114. IN PDISK_REGION NtPartitionRegion,
  115. IN PWSTR Sysroot,
  116. IN PWSTR OSLoadOptions, OPTIONAL
  117. IN PWSTR LoadIdentifier OPTIONAL
  118. );
  119. NTSTATUS
  120. SpSetDefaultBootEntry(
  121. ULONG BootEntryNumber
  122. );
  123. #define BE_STATUS_ORDERED 0x00000001
  124. #define BE_STATUS_NEW 0x00000002
  125. #define BE_STATUS_DELETED 0x00000004
  126. #define BE_STATUS_FROM_BOOT_INI 0x00000008
  127. #define IS_BOOT_ENTRY_ACTIVE(_be) \
  128. (((_be)->NtBootEntry.Attributes & BOOT_ENTRY_ATTRIBUTE_ACTIVE) != 0)
  129. #define IS_BOOT_ENTRY_WINDOWS(_be) \
  130. (((_be)->NtBootEntry.Attributes & BOOT_ENTRY_ATTRIBUTE_WINDOWS) != 0)
  131. #define IS_BOOT_ENTRY_REMOVABLE_MEDIA(_be) \
  132. (((_be)->NtBootEntry.Attributes & BOOT_ENTRY_ATTRIBUTE_REMOVABLE_MEDIA) != 0)
  133. #define IS_BOOT_ENTRY_ORDERED(_be) \
  134. (((_be)->Status & BE_STATUS_ORDERED) != 0)
  135. #define IS_BOOT_ENTRY_NEW(_be) \
  136. (((_be)->Status & BE_STATUS_NEW) != 0)
  137. #define IS_BOOT_ENTRY_DELETED(_be) \
  138. (((_be)->Status & BE_STATUS_DELETED) != 0)
  139. #define IS_BOOT_ENTRY_FROM_BOOT_INI(_be) \
  140. (((_be)->Status & BE_STATUS_FROM_BOOT_INI) != 0)
  141. extern PSP_BOOT_ENTRY SpBootEntries;
  142. BOOLEAN
  143. SpInitBootVars(
  144. );
  145. VOID
  146. SpFreeBootVars(
  147. );
  148. VOID
  149. SpUpdateRegionForBootEntries(
  150. VOID
  151. );
  152. VOID
  153. SpGetNtDirectoryList(
  154. OUT PWSTR **DirectoryList,
  155. OUT PULONG DirectoryCount
  156. );
  157. VOID
  158. SpCleanSysPartOrphan(
  159. VOID
  160. );
  161. VOID
  162. SpDetermineUniqueAndPresentBootEntries(
  163. VOID
  164. );
  165. VOID
  166. SpAddInstallationToBootList(
  167. IN PVOID SifHandle,
  168. IN PDISK_REGION SystemPartitionRegion,
  169. IN PWSTR SystemPartitionDirectory,
  170. IN PDISK_REGION NtPartitionRegion,
  171. IN PWSTR Sysroot,
  172. IN BOOLEAN BaseVideoOption,
  173. IN PWSTR OldOsLoadOptions OPTIONAL
  174. );
  175. VOID
  176. SpRemoveInstallationFromBootList(
  177. IN PDISK_REGION SysPartitionRegion, OPTIONAL
  178. IN PDISK_REGION NtPartitionRegion, OPTIONAL
  179. IN PWSTR SysRoot, OPTIONAL
  180. IN PWSTR SystemLoadIdentifier, OPTIONAL
  181. IN PWSTR SystemLoadOptions, OPTIONAL
  182. IN ENUMARCPATHTYPE ArcPathType,
  183. #if defined(REMOTE_BOOT)
  184. IN BOOLEAN RemoteBootPath,
  185. #endif // defined(REMOTE_BOOT)
  186. OUT PWSTR *OldOsLoadOptions OPTIONAL
  187. );
  188. VOID
  189. SpPtDeleteBootSetsForRegion(
  190. PDISK_REGION region
  191. );
  192. #if defined(REMOTE_BOOT)
  193. BOOLEAN
  194. SpFlushRemoteBootVars(
  195. IN PDISK_REGION TargetRegion
  196. );
  197. #endif // defined(REMOTE_BOOT)
  198. //
  199. // IsArc() is always true on non-x86 machines except AMD64 for which it is
  200. // always false. On x86, this determination has to be made at run time.
  201. //
  202. #ifdef _X86_
  203. BOOLEAN
  204. SpIsArc(
  205. VOID
  206. );
  207. #elif defined(_AMD64_)
  208. #define SpIsArc() FALSE
  209. #else
  210. #define SpIsArc() TRUE
  211. #endif
  212. //
  213. // IsEfi() is always true on IA64 machines. Therefore this determination can
  214. // be made at compile time. When x86 EFI machines are supported, the check
  215. // will need to be made at run time on x86.
  216. //
  217. // Note that EFI_NVRAM_ENABLED is defined in ia64\sources.
  218. //
  219. #if defined(EFI_NVRAM_ENABLED)
  220. #if defined(_IA64_)
  221. #define SpIsEfi() TRUE
  222. #else
  223. BOOLEAN
  224. SpIsEfi(
  225. VOID
  226. );
  227. #endif
  228. #else
  229. #define SpIsEfi() FALSE
  230. #endif
  231. PWSTR
  232. SpGetDefaultBootEntry (
  233. OUT UINT *DefaultSignatureOut
  234. );
  235. #ifdef _X86_
  236. #include "i386\bootini.h"
  237. #endif // def _X86_
  238. #endif // ndef _SPBOOTVARS_DEFN_