前面把注册表初始化完成之后,就开始进行安装引导程序了。这里安装的引导程序是分区引导程序,或者安装到软盘引导程序。当然也可以选择跳过不安装它,界面如下:
#001 static PAGE_NUMBER
#002 BootLoaderPage(PINPUT_RECORD Ir)
#003 {
#004 UCHAR PartitionType;
#005 BOOLEAN InstallOnFloppy;
#006 USHORT Line = 12;
#007
#008 CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
#009
取得分区的磁盘类型。根据不同的分区类型进行检查是否可以安装引导程序。
#010 PartitionType = PartitionList->ActiveBootPartition->PartInfo[0].PartitionType;
#011
#012 if (PartitionType == PARTITION_ENTRY_UNUSED)
#013 {
#014 DPRINT("Error: active partition invalid (unused)/n");
#015 InstallOnFloppy = TRUE;
#016 }
#017 else if (PartitionType == 0x0A)
#018 {
#019 /* OS/2 boot manager partition */
#020 DPRINT("Found OS/2 boot manager partition/n");
#021 InstallOnFloppy = TRUE;
#022 }
#023 else if (PartitionType == 0x83)
#024 {
#025 /* Linux ext2 partition */
#026 DPRINT("Found Linux ext2 partition/n");
#027 InstallOnFloppy = TRUE;
#028 }
#029 else if (PartitionType == PARTITION_IFS)
#030 {
#031 /* NTFS partition */
#032 DPRINT("Found NTFS partition/n");
#033 InstallOnFloppy = TRUE;
#034 }
#035 else if ((PartitionType == PARTITION_FAT_12) ||
#036 (PartitionType == PARTITION_FAT_16) ||
#037 (PartitionType == PARTITION_HUGE) ||
#038 (PartitionType == PARTITION_XINT13) ||
#039 (PartitionType == PARTITION_FAT32) ||
#040 (PartitionType == PARTITION_FAT32_XINT13))
#041 {
目前只支持FAT12,FAT16,FAT32的文件系统安装引导程序。
#042 DPRINT("Found FAT partition/n");
#043 InstallOnFloppy = FALSE;
#044 }
#045 else
#046 {
#047 /* Unknown partition */
#048 DPRINT("Unknown partition found/n");
#049 InstallOnFloppy = TRUE;
#050 }
#051
#052 if (InstallOnFloppy == TRUE)
#053 {
#054 return BOOT_LOADER_FLOPPY_PAGE;
#055 }
#056
检查是否无人参与安装方式。
#057 if (IsUnattendedSetup)
#058 {
#059 if (UnattendMBRInstallType == 0) /* skip MBR installation */
#060 {
#061 return SUCCESS_PAGE;
#062 }
#063 else if (UnattendMBRInstallType == 1) /* install on floppy */
#064 {
#065 return BOOT_LOADER_FLOPPY_PAGE;
#066 }
#067 else if (UnattendMBRInstallType == 2) /* install on hdd */
#068 {
#069 return BOOT_LOADER_HARDDISK_PAGE;
#070 }
#071 }
#072
#073 MUIDisplayPage(BOOT_LOADER_PAGE);
#074 CONSOLE_InvertTextXY(8,Line,60,1);
#075
循环地检查用户的输入。
#076 while(TRUE)
#077 {
#078 CONSOLE_ConInKey(Ir);
#079
下一行的菜单选择。
#080 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
#081 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
#082 {
#083 CONSOLE_NormalTextXY(8,1);
#084
#085 Line++;
#086 if (Line<12) Line=14;
#087 if (Line>14) Line=12;
#088
#089 CONSOLE_InvertTextXY(8,1);
#090 }
上一行的菜单选择。
#091 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
#092 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
#093 {
#094 CONSOLE_NormalTextXY(8,1);
#095
#096 Line--;
#097 if (Line<12) Line=14;
#098 if (Line>14) Line=12;
#099
#100 CONSOLE_InvertTextXY(8,1);
#101 }
如果按F3就表示退出操作系统安装。
#102 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
#103 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
#104 {
#105 if (ConfirmQuit(Ir) == TRUE)
#106 return QUIT_PAGE;
#107
#108 break;
#109 }
如果按回车键就检查选择那一个选项,然后进入不同的页面操作。
#110 else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
#111 {
#112 if (Line == 12)
#113 {
#114 return BOOT_LOADER_HARDDISK_PAGE;
#115 }
#116 else if (Line == 13)
#117 {
#118 return BOOT_LOADER_FLOPPY_PAGE;
#119 }
#120 else if (Line == 14)
#121 {
#122 return SUCCESS_PAGE;;
#123 }
#124
#125 return BOOT_LOADER_PAGE;
#126 }
#127 }
#128
#129 return BOOT_LOADER_PAGE;
#130}
原文链接:https://www.f2er.com/react/308470.html