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.

885 lines
27 KiB

  1. #include <precomp.h>
  2. //
  3. // Global Coordinates
  4. //
  5. #define COL_TITLE 0
  6. #define ROW_TITLE 0
  7. #define COL_OSOPTIONS 2
  8. #define ROW_OSOPTIONS 2
  9. #define COL_PROMPT 0
  10. #define ROW_PROMPT 2
  11. #define CLEAR_LINE L" "
  12. #define PROMPT L"Select> "
  13. #define NUMBER_OF_USER_OPTIONS 3 // options, plus a space seperator
  14. #define MAX_OPTIONS_PER_VAR 7
  15. #define BACKUPNVRFILE L"\\bootentries.bak"
  16. VOID
  17. InitializeStdOut(
  18. IN struct _EFI_SYSTEM_TABLE *SystemTable
  19. )
  20. {
  21. //
  22. // Stash some of the efi stdout pointers
  23. //
  24. ConOut = SystemTable->ConOut;
  25. ClearScreen = ConOut->ClearScreen;
  26. SetCursorPosition = ConOut->SetCursorPosition;
  27. SetMode = ConOut->SetMode;
  28. CursorRow = ConOut->Mode->CursorRow;
  29. CursorColumn = ConOut->Mode->CursorColumn;
  30. EnableCursor = ConOut->EnableCursor;
  31. ConIn = SystemTable->ConIn;
  32. //
  33. // Set the mode to 80, 25 and clear the screen
  34. //
  35. SetMode( ConOut, 0 );
  36. }
  37. VOID
  38. PrintTitle(
  39. )
  40. {
  41. CHAR16 Buffer[256];
  42. ClearScreen( ConOut );
  43. #if 0
  44. PrintAt( 0, 30, L"%H%s%N\n", TITLE1 );
  45. PrintAt( 0, 30, L"%H%s%N", VER_PRODUCTBUILD );
  46. #endif
  47. SPrint(
  48. Buffer,
  49. sizeof(Buffer),
  50. L"%s [Version %d.%d.%d]",
  51. TITLE1,
  52. VER_PRODUCTMAJORVERSION,
  53. VER_PRODUCTMINORVERSION,
  54. VER_PRODUCTBUILD
  55. );
  56. PrintAt( 0, 30, L"%H%s%N\n", Buffer);
  57. }
  58. BOOLEAN
  59. isWindowsOsUserSelection(
  60. UINTN userSelection
  61. )
  62. {
  63. BOOLEAN status;
  64. status = isWindowsOsBootOption((char*)LoadOptions[userSelection],
  65. LoadOptionsSize[userSelection]
  66. );
  67. return status;
  68. }
  69. INTN
  70. BackupBootOptions(
  71. CHAR16* filePath
  72. )
  73. {
  74. INTN status;
  75. //
  76. // backup current boot options
  77. //
  78. Print(L"\nBacking up boot options...\n");
  79. status = SaveAllBootOptions(filePath);
  80. if(status != -1) {
  81. Print(L"Backed up Boot Options to file: %H%s%N\n",filePath);
  82. Print(L"Use %HImport%N command to retrieve saved boot options\n");
  83. } else {
  84. Print(L"Could not backup Boot Options to file: %H%s%N!\n",filePath);
  85. }
  86. return status;
  87. }
  88. VOID
  89. DisplayMainMenu(
  90. )
  91. {
  92. UINT32 done = FALSE;
  93. UINT32 nUserSelection, nSubUserSelection, nModifyVar;
  94. CHAR16 szUserSelection[1024];
  95. CHAR16 szOsLoader[1024];
  96. CHAR16 szInput[512];
  97. VOID* SourceBuffer = NULL;
  98. UINT32 PartitionCount;
  99. EFI_DEVICE_PATH *FilePath;
  100. //
  101. // Display boot options from nvram.
  102. //
  103. PrintTitle();
  104. GetBootManagerVars();
  105. DisplayBootOptions();
  106. //
  107. // Process user input.
  108. //
  109. while( !done ) {
  110. GetUserSelection( szUserSelection );
  111. //
  112. // Handle char string commands
  113. //
  114. if( (!StriCmp( szUserSelection, L"q")) || (!StriCmp( szUserSelection, L"quit"))
  115. || (!StriCmp( szUserSelection, L"Q")) || (!StriCmp( szUserSelection, L"exit")) ) {
  116. //
  117. // Quit
  118. //
  119. done = TRUE;
  120. }
  121. else if( (!StriCmp( szUserSelection, L"d")) || (!StriCmp( szUserSelection, L"D"))
  122. || (!StriCmp( szUserSelection, L"display")) ) {
  123. //
  124. // Display command
  125. //
  126. //
  127. // Choose selection
  128. //
  129. Print( L"\n" );
  130. nSubUserSelection = GetSubUserSelection( L"Enter boot option to display: ", (UINT32) GetBootOrderCount() );
  131. if( nSubUserSelection != 0 ) {
  132. nSubUserSelection--;
  133. if (isWindowsOsUserSelection(nSubUserSelection) == FALSE) {
  134. Print (L"\n\nThis tool only displays Windows OS boot options\n");
  135. } else {
  136. if(DisplayExtended( nSubUserSelection ))
  137. ;
  138. else {
  139. Print( L"\n" );
  140. Print( L"Wrong Boot Option %d Selected\n", nSubUserSelection+1 );
  141. }
  142. }
  143. Print( L"\n" );
  144. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  145. }
  146. //
  147. // Display boot options from nvram
  148. //
  149. PrintTitle();
  150. DisplayBootOptions();
  151. }
  152. else if( (!StriCmp( szUserSelection, L"e")) || (!StriCmp( szUserSelection, L"E"))
  153. || (!StriCmp( szUserSelection, L"erase")) ) {
  154. //
  155. // Erase command
  156. //
  157. BOOLEAN selectedAll;
  158. //
  159. // Choose selection
  160. //
  161. Print( L"\n" );
  162. nSubUserSelection = GetSubUserSelectionOrAll( L"Enter OS boot option to erase (* = All): ",
  163. (UINT32) GetBootOrderCount(),
  164. &selectedAll
  165. );
  166. //
  167. // choose the path based on if the user wants all the os boot options whacked or not
  168. //
  169. if (selectedAll) {
  170. //
  171. // get user confirmation
  172. //
  173. Print( L"\n" );
  174. Input( L"This will erase all OS boot options. Are you Sure? ", szInput, sizeof(szInput) );
  175. if( (!StriCmp( szInput, L"y")) || (!StriCmp( szInput, L"Y"))) {
  176. //
  177. // backup current boot options first
  178. //
  179. if (BackupBootOptions(BACKUPNVRFILE) != -1) {
  180. if(EraseAllOsBootOptions()) {
  181. Print(L"\nAll OS Boot Options Erased.\n");
  182. GetBootManagerVars();
  183. }
  184. else {
  185. Print(L"\nThere are no OS Boot Options to Erase.\n");
  186. }
  187. }
  188. Print( L"\n" );
  189. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  190. }
  191. } else {
  192. CHAR16 buf[256];
  193. if( nSubUserSelection > 0 ) {
  194. SPrint (buf, sizeof(buf), L"This will erase OS boot option %d. Are you Sure? ", nSubUserSelection);
  195. // get user confirmation
  196. //
  197. Print( L"\n" );
  198. Input( buf, szInput, sizeof(szInput) );
  199. if( (!StriCmp( szInput, L"y")) || (!StriCmp( szInput, L"Y"))) {
  200. nSubUserSelection--;
  201. if(EraseOsBootOption(nSubUserSelection)) {
  202. Print(L"\nBoot Option %d erased.\n", nSubUserSelection + 1);
  203. FreeBootManagerVars();
  204. GetBootManagerVars();
  205. }
  206. else {
  207. Print(L"\nInvalid OS Boot Options specified.\n");
  208. }
  209. Print( L"\n" );
  210. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  211. }
  212. }
  213. }
  214. //
  215. // Display boot options from nvram
  216. //
  217. PrintTitle();
  218. DisplayBootOptions();
  219. } else if( (!StriCmp( szUserSelection, L"p")) || (!StriCmp( szUserSelection, L"P"))
  220. || (!StriCmp( szUserSelection, L"push")) ) {
  221. //
  222. // Push command
  223. //
  224. //
  225. // Choose selection
  226. //
  227. Print( L"\n" );
  228. nSubUserSelection = GetSubUserSelection( L"Enter the boot option you want to push to top? ", (UINT32) GetBootOrderCount() );
  229. if( nSubUserSelection > 0 ) {
  230. nSubUserSelection--;
  231. if(PushToTop( nSubUserSelection )) {
  232. FreeBootManagerVars();
  233. GetBootManagerVars();
  234. Print( L"\n" );
  235. Print( L"OS Boot Option %d pushed to top of boot order\n", nSubUserSelection+1 );
  236. }
  237. else {
  238. Print( L"\n" );
  239. Print( L"Wrong Boot Option %d Selected\n", nSubUserSelection+1 );
  240. }
  241. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  242. }
  243. //
  244. // Display boot options from nvram
  245. //
  246. PrintTitle();
  247. DisplayBootOptions();
  248. } else if( (!StriCmp( szUserSelection, L"c")) || (!StriCmp( szUserSelection, L"C"))
  249. || (!StriCmp( szUserSelection, L"copy")) ) {
  250. //
  251. // Copy command
  252. //
  253. //
  254. // Choose selection
  255. //
  256. Print( L"\n" );
  257. nSubUserSelection = GetSubUserSelection( L"Enter OS boot option to copy: ", (UINT32) GetBootOrderCount() );
  258. if( nSubUserSelection != 0 ) {
  259. nSubUserSelection--;
  260. if(!CopyVar( nSubUserSelection )) {
  261. Print( L"\n" );
  262. Print( L"Wrong Boot Option %d Selected\n",nSubUserSelection+1);
  263. }
  264. else {
  265. SetBootManagerVars();
  266. FreeBootManagerVars();
  267. GetBootManagerVars();
  268. Print( L"\n" );
  269. Print( L"Boot Option %d Copied. ",nSubUserSelection+1);
  270. }
  271. Print( L"\n" );
  272. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  273. }
  274. //
  275. // Display boot options from nvram
  276. //
  277. PrintTitle();
  278. DisplayBootOptions();
  279. } else if( (!StriCmp( szUserSelection, L"x")) || (!StriCmp( szUserSelection, L"X"))
  280. || (!StriCmp( szUserSelection, L"export")) ) {
  281. //
  282. // Save command
  283. //
  284. CHAR16 filePath[512];
  285. BOOLEAN selectedAll;
  286. //
  287. // Choose selection
  288. //
  289. Print( L"\n" );
  290. nSubUserSelection = GetSubUserSelectionOrAll( L"Enter OS boot option to export (* = All): ",
  291. (UINT32) GetBootOrderCount(),
  292. &selectedAll
  293. );
  294. if (nSubUserSelection > 0 || selectedAll) {
  295. Print( L"\n" );
  296. Input( L"Enter EXPORT file path: ", filePath, sizeof(filePath) );
  297. if (StrLen(filePath) > 0) {
  298. //
  299. // choose the path based on if the user wants all the os boot options exported or just one
  300. //
  301. if (selectedAll) {
  302. Print(L"\nSaving %d boot options...\n", GetBootOrderCount());
  303. if(SaveAllBootOptions(filePath) != -1) {
  304. Print(L"Saved Boot Options to file: %H%s%N\n",filePath);
  305. Print(L"Use %HImport%N command to retrieve saved boot options\n");
  306. } else {
  307. Print(L"Could not save Boot Options to file: %H%s%N!\n",filePath);
  308. }
  309. } else {
  310. Print(L"\nSaving boot option %d...\n", nSubUserSelection);
  311. if(SaveBootOption(filePath, nSubUserSelection-1) != -1) {
  312. Print(L"Saved Boot Option %d to file: %H%s%N\n",nSubUserSelection, filePath);
  313. Print(L"Use %HImport%N command to retrieve saved boot option\n");
  314. } else {
  315. Print(L"Could not save Boot Option to file: %H%s%N!\n",filePath);
  316. }
  317. }
  318. }
  319. }
  320. Print( L"\n" );
  321. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  322. //
  323. // Display boot options from nvram
  324. //
  325. PrintTitle();
  326. DisplayBootOptions();
  327. } else if( (!StriCmp( szUserSelection, L"i")) || (!StriCmp( szUserSelection, L"I"))
  328. || (!StriCmp( szUserSelection, L"import")) ) {
  329. //
  330. // Restore command
  331. //
  332. CHAR16 filePath[512];
  333. Print( L"\n" );
  334. Input( L"Enter IMPORT file path: ", filePath, sizeof(filePath) );
  335. if (StrLen(filePath) > 0) {
  336. if(RestoreFileExists(filePath) == TRUE) {
  337. if(RestoreNvr(filePath) != -1) {
  338. Print( L"\n" );
  339. Print(L"Imported Boot Options from file: %H%s%N\n",filePath);
  340. FreeBootManagerVars();
  341. GetBootManagerVars();
  342. }
  343. else {
  344. Print(L"Restore failed!\n");
  345. }
  346. } else {
  347. Print(L"\n\nError: Restore file not found: %s\n\n", filePath);
  348. }
  349. }
  350. Print( L"\n" );
  351. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  352. //
  353. // Display boot options from nvram
  354. //
  355. PrintTitle();
  356. DisplayBootOptions();
  357. }
  358. #if 0
  359. else if( (!StriCmp( szUserSelection, L"a")) || (!StriCmp( szUserSelection, L"A"))
  360. || (!StriCmp( szUserSelection, L"add")) ) {
  361. //
  362. // Add command
  363. //
  364. //
  365. // Get EFI system partition
  366. //
  367. PartitionCount = GetPartitions();
  368. if( PartitionCount > 0 ) {
  369. Print( L"\n" );
  370. Input( L"Name of New BootOption: ", szInput, sizeof(szInput) );
  371. FilePath = FileDevicePath(
  372. GetDeviceHandleForPartition(),
  373. L"os\\winnt50\\ia64ldr.efi"
  374. );
  375. PackAndWriteToNvr(
  376. -1,
  377. "multi(0)disk(0)rdisk(0)partition(1)",
  378. "multi(0)disk(0)rdisk(0)partition(1)\\os\\winnt50\\ia64ldr.efi",
  379. "multi(0)disk(0)rdisk(0)partition(2)",
  380. "\\WINNT64",
  381. szInput[0] ? szInput : L"New Boot Option",
  382. "",
  383. (char*) FilePath
  384. );
  385. Print( L"\nAdded %H%s%N. Use %HModify%N command to change any of the default values.\n",
  386. szInput[0] ? szInput : L"New Boot Option" );
  387. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  388. FreeBootManagerVars();
  389. GetBootManagerVars();
  390. } else {
  391. Print( L"No partitions found. To use this option, you must have an EFI or FAT16\n" );
  392. Print( L"partition that will be used as your System Partition.\n" );
  393. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  394. }
  395. //
  396. // Display boot options from nvram
  397. //
  398. PrintTitle();
  399. DisplayBootOptions();
  400. }
  401. #endif
  402. else if( (!StriCmp( szUserSelection, L"h")) || (!StriCmp( szUserSelection, L"H"))
  403. || (!StriCmp( szUserSelection, L"help")) ) {
  404. //
  405. // Help command
  406. //
  407. PrintTitle();
  408. //
  409. // Display Help text.
  410. //
  411. Print( L"\n" );
  412. Print( L"%HDisplay%N - Display an OS boot option's environment variables.\n" );
  413. Print( L"%HModify%N - Modify an OS boot option's environment variable.\n" );
  414. Print( L"%HCopy%N - Copy (duplicate) an OS boot option.\n" );
  415. Print( L"%HExport%N - Export all/one OS boot option(s) to disk.\n" );
  416. Print( L"%HImport%N - Import (and append) OS boot option(s) from disk.\n" );
  417. Print( L"%HErase%N - Erase all OS boot options from NVRAM.\n" );
  418. Print( L"%HPush%N - Push a OS boot option to top of boot order.\n" );
  419. Print( L"%HHelp%N - This display.\n" );
  420. Print( L"%HQuit%N - Quit.\n" );
  421. Print( L"\n");
  422. Print( L"Note: When importing/exporting boot options, all specified file paths\n");
  423. Print( L" are absolute and relative to the current disk device.\n");
  424. Print( L"\n");
  425. Print( L" Example: To import Boot0000 from the Windows loader directory WINNT50.0\n");
  426. Print( L" on fs1, you would run nvrboot.efi on fs1 and use the path:\n");
  427. Print( L"\n");
  428. Print( L" \\EFI\\Microsoft\\WINNT50.0\\Boot0000\n");
  429. Print( L"\n");
  430. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  431. //
  432. // Display boot options from nvram
  433. //
  434. PrintTitle();
  435. DisplayBootOptions();
  436. }
  437. else if( (!StriCmp( szUserSelection, L"m")) || (!StriCmp( szUserSelection, L"M"))
  438. || (!StriCmp( szUserSelection, L"modify")) ) {
  439. //
  440. // Modify command
  441. //
  442. //
  443. // Choose selection
  444. //
  445. Print( L"\n" );
  446. nSubUserSelection = GetSubUserSelection( L"Enter OS boot option to modify: ", (UINT32) GetBootOrderCount() );
  447. if( nSubUserSelection > 0 ) {
  448. nSubUserSelection--;
  449. if (isWindowsOsUserSelection(nSubUserSelection) == FALSE) {
  450. Print( L"\n\nThis tool only modifies Windows OS boot options\n" );
  451. } else {
  452. if(DisplayExtended( nSubUserSelection )) {
  453. //
  454. // Choose var
  455. //
  456. nModifyVar = GetSubUserSelection( L"Enter var to modify: ", MAX_OPTIONS_PER_VAR );
  457. if( nModifyVar > 0) {
  458. Print( L"\n" );
  459. //
  460. // Map variable to env var
  461. //
  462. switch( nModifyVar ) {
  463. case 1:
  464. Input( L"LoadIdentifier = ", szInput, sizeof(szInput) );
  465. nModifyVar = DESCRIPTION;
  466. break;
  467. case 2:
  468. Input( L"OsLoadOptions = ", szInput, sizeof(szInput) );
  469. nModifyVar = OSLOADOPTIONS;
  470. break;
  471. case 3:
  472. Print (L"This field currently not modifiable\n");
  473. #if 0
  474. Input( L"EfiOsLoaderFilePath = ", szInput, sizeof(szInput) );
  475. #endif
  476. nModifyVar = EFIFILEPATHLIST;
  477. break;
  478. case 4:
  479. Print (L"This field currently not modifiable\n");
  480. #if 0
  481. Input( L"OsLoaderFilePath = ", szInput, sizeof(szInput) );
  482. #endif
  483. nModifyVar = OSFILEPATHLIST;
  484. break;
  485. default:
  486. break;
  487. }
  488. //
  489. // Write all vars to NV-RAM
  490. //
  491. SetFieldFromLoadOption(
  492. nSubUserSelection,
  493. nModifyVar,
  494. szInput
  495. );
  496. DisplayExtended(nSubUserSelection);
  497. FreeBootManagerVars();
  498. GetBootManagerVars();
  499. }
  500. Print( L"\n" );
  501. }
  502. }
  503. Input( L"Press enter to continue", szInput, sizeof(szInput) );
  504. }
  505. }
  506. //
  507. // Display boot options from nvram
  508. //
  509. PrintTitle();
  510. DisplayBootOptions();
  511. }
  512. }
  513. UINT32
  514. GetConfirmation(
  515. IN CHAR16 *szConfirm
  516. )
  517. {
  518. CHAR16 szIn[80];
  519. UINT32 saveRow;
  520. Print( L"\n" );
  521. saveRow = CursorRow;
  522. if( szConfirm ) {
  523. Input( szConfirm, szIn, sizeof(szIn) );
  524. } else {
  525. Input( L"Are you sure? ", szIn, sizeof(szIn) );
  526. }
  527. // Clear previous input
  528. SetCursorPosition( ConOut, 0, saveRow );
  529. PrintAt( 0, saveRow, CLEAR_LINE );
  530. if( (!StriCmp( szIn, L"y")) || (!StriCmp( szIn, L"yes")) )
  531. return TRUE;
  532. return FALSE;
  533. }
  534. VOID
  535. GetUserSelection(
  536. OUT CHAR16 *szUserSelection
  537. )
  538. {
  539. UINT32 numSelections;
  540. UINT32 row, col;
  541. numSelections = (UINT32) GetOsBootOptionsCount();
  542. numSelections += NUMBER_OF_USER_OPTIONS;
  543. // note, we use ROW_PROMPT as an offset
  544. row = ROW_OSOPTIONS + numSelections + ROW_PROMPT;
  545. col = COL_PROMPT;
  546. // Clear previous input
  547. SetCursorPosition( ConOut, col, row );
  548. PrintAt( col, row, CLEAR_LINE );
  549. // Get the input
  550. SetCursorPosition( ConOut, col, row );
  551. Input( PROMPT, szUserSelection, 1024 );
  552. }
  553. VOID
  554. DisplayBootOptions(
  555. )
  556. {
  557. UINT32 i;
  558. UINT32 j;
  559. CHAR16 LoadIdentifier[200];
  560. UINTN bootOrderCount;
  561. bootOrderCount = GetBootOrderCount();
  562. if (bootOrderCount > 0) {
  563. for ( i=0,j=0; i<GetBootOrderCount(); i++ ) {
  564. if(LoadOptionsSize[i] == 0) {
  565. //
  566. // It's possible a null load option could be in the list
  567. // we naturally want to catch this...
  568. //
  569. #if EFI_DEBUG
  570. Print(L"\nNVRAM Boot Entry %d has 0 length!\n", i);
  571. ASSERT(LoadOptionsSize[i] > 0);
  572. #endif
  573. //
  574. // if we are not in debug mode, just let the use know what is
  575. // going on other wise the menu may be screwed up
  576. //
  577. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + j, L"%2d. (0 length Boot Entry)\n", i+1);
  578. } else if(GetLoadIdentifier( i, LoadIdentifier)) {
  579. if (isWindowsOsBootOption((char*)LoadOptions[i], LoadOptionsSize[i]) == TRUE)
  580. {
  581. PrintAt( COL_OSOPTIONS - 1, ROW_OSOPTIONS + j, L"*%2d. %s\n", i+1, LoadIdentifier );
  582. }
  583. else {
  584. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + j, L"%2d. %s\n", i+1, LoadIdentifier );
  585. }
  586. j++;
  587. }
  588. }
  589. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + ++j, L"* = Windows OS boot option\n" );
  590. j++;
  591. } else {
  592. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS, L"[No Boot Entries Present]\n");
  593. j = 2;
  594. }
  595. //
  596. // Display Maitainence Menu
  597. //
  598. #if 0
  599. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + ++j, L"%H(D)%Nisplay %H(M)%Nodify %H(C)%Nopy\n" );
  600. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + ++j, L"%H(S)%Nave %H(R)%Nestore %H(E)%Nrase\n" );
  601. // PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + ++j, L"%H(A)%Ndd %H(P)%Nush %H(H)%Nelp %H(Q)%Nuit\n" );
  602. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + ++j, L"%H(P)%Nush %H(H)%Nelp %H(Q)%Nuit\n" );
  603. #endif
  604. PrintAt( COL_OSOPTIONS, ROW_OSOPTIONS + ++j, L"%H(D)%Nisplay %H(M)%Nodify %H(C)%Nopy E%H(x)%Nport %H(I)%Nmport %H(E)%Nrase %H(P)%Nush %H(H)%Nelp %H(Q)%Nuit\n" );
  605. }
  606. #if 0
  607. #define L_SYSTEMPARTITION L"SystemPartition"
  608. #define L_OSLOADER L"OsLoader"
  609. #define L_OSLOADPARTITION L"OsLoadPartition"
  610. #define L_OSLOADFILENAME L"OsLoadFilename"
  611. #define L_LOADIDENTIFIER L"LoadIdentifier"
  612. #define L_OSLOADOPTIONS L"OsLoadOptions"
  613. #define L_OSLOADPATH L"OsLoadOptions"
  614. #define L_EFIFILEPATH L"EfiOsLoaderFilePath"
  615. #define L_COUNTDOWN L"COUNTDOWN"
  616. #define L_AUTOLOAD L"AUTOLOAD"
  617. #define L_LASTKNOWNGOOD L"LastKnownGood"
  618. #define L_BOOTSELECTION L"BootSelection"
  619. #endif
  620. BOOLEAN
  621. DisplayExtended(
  622. IN UINT32 Selection
  623. )
  624. {
  625. char OsLoadOptions[200];
  626. CHAR16 LoadIdentifier[200];
  627. unsigned char EfiFilePath[1024];
  628. unsigned char OsLoadPath[1024];
  629. CHAR16 FilePathShort[200];
  630. BOOLEAN status;
  631. PFILE_PATH pFilePath;
  632. #if DEBUG_PACK
  633. DisplayELOFromLoadOption(Selection);
  634. #endif
  635. status = GetOsLoadOptionVars(
  636. Selection,
  637. LoadIdentifier,
  638. OsLoadOptions,
  639. EfiFilePath,
  640. OsLoadPath
  641. );
  642. if (status == FALSE) {
  643. return status;
  644. }
  645. Print( L"\n" );
  646. Print( L"1. LoadIdentifier = %s\n", LoadIdentifier );
  647. Print( L"2. OsLoadOptions = %s\n", OsLoadOptions );
  648. GetFilePathShort( (EFI_DEVICE_PATH*) EfiFilePath, FilePathShort );
  649. Print( L"3. EfiOsLoaderFilePath = %s\n", FilePathShort );
  650. pFilePath = (FILE_PATH*)OsLoadPath;
  651. GetFilePathShort( (EFI_DEVICE_PATH*)pFilePath->FilePath, FilePathShort );
  652. Print( L"4. OsLoaderFilePath = %s\n", FilePathShort );
  653. return TRUE;
  654. }
  655. UINT32
  656. GetSubUserSelectionOrAll(
  657. IN CHAR16* szConfirm,
  658. IN UINT32 MaxSelection,
  659. OUT BOOLEAN* selectedAll
  660. )
  661. {
  662. CHAR16 szIn[80];
  663. UINT32 nUserSelection = 0;
  664. if( szConfirm ) {
  665. Input( szConfirm, szIn, sizeof(szIn) );
  666. } else {
  667. Input( L"Enter Selection (* = ALL)? ", szIn, sizeof(szIn) );
  668. }
  669. *selectedAll = FALSE;
  670. if (StrCmp(szIn, L"*") == 0) {
  671. *selectedAll = TRUE;
  672. } else {
  673. nUserSelection = (int) Atoi( szIn );
  674. if(( nUserSelection>0 ) && ( nUserSelection <= MaxSelection))
  675. return nUserSelection;
  676. }
  677. return 0;
  678. }
  679. UINT32
  680. GetSubUserSelection(
  681. IN CHAR16 *szConfirm,
  682. IN UINT32 MaxSelection
  683. )
  684. {
  685. CHAR16 szIn[80];
  686. UINT32 nUserSelection = 0;
  687. if( szConfirm ) {
  688. Input( szConfirm, szIn, sizeof(szIn) );
  689. } else {
  690. Input( L"Enter Selection? ", szIn, sizeof(szIn) );
  691. }
  692. nUserSelection = (int) Atoi( szIn );
  693. if(( nUserSelection>0 ) && ( nUserSelection <= MaxSelection))
  694. return nUserSelection;
  695. return 0;
  696. }