- {
- continue;
- }
-
- SetStatusText(" Importing %S...", File);
-
- if (!ImportRegistryFile(File, Section, Delete))
- {
- DPRINT1("Importing %S failed\n", File);
-
- PopupError("Setup failed to import a hive file.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- }
- while (InfFindNextLine (&InfContext, &InfContext));
-
- SetStatusText(" Done...");
-
- return(BOOT_LOADER_PAGE);
-}
-
-
-static PAGE_NUMBER
-BootLoaderPage(PINPUT_RECORD Ir)
-{
- WCHAR SrcPath[MAX_PATH];
- WCHAR DstPath[MAX_PATH];
- PINICACHE IniCache;
- PINICACHESECTION IniSection;
- NTSTATUS Status;
- BOOLEAN InstallMBR = FALSE;
-
- SetTextXY(6, 8, "Installing the boot loader");
-
- SetStatusText(" Please wait...");
-
-#if 0
- if (ActivePartitionValid == FALSE)
- {
- /* Mark the chosen partition as active since there is no active
- partition now */
-
- if (!MarkPartitionActive(PartData.DiskNumber,
- PartData.PartNumber, &ActivePartition))
- {
- PopupError("Setup could not mark the system partiton active\n",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- InstallMBR = TRUE;
- }
-
- if (InstallMBR)
- {
- WCHAR PathBuffer[MAX_PATH];
- UNICODE_STRING SystemRootMBRPath;
-
- RtlFreeUnicodeString(&SystemRootMBRPath);
- swprintf(PathBuffer,
- L"\\Device\\Harddisk%lu\\Partition0",
- PartData.DiskNumber);
- RtlCreateUnicodeString(&SystemRootMBRPath,
- PathBuffer);
-
- /* Install MBR bootcode */
- wcscpy(SrcPath, SourceRootPath.Buffer);
- wcscat(SrcPath, L"\\loader\\dosmbr.bin");
-
- DPRINT1("Install MBR bootcode: %S ==> %S\n", SrcPath, SystemRootMBRPath.Buffer);
- Status = InstallMBRBootCodeToDisk(SrcPath,
- SystemRootMBRPath.Buffer);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("InstallMBRBootCodeToDisk() failed (Status %lx)\n", Status);
- PopupError("Setup failed to install the MBR bootcode.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- }
-#endif
-
- if (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
- {
- DPRINT1("Error: active partition invalid (unused)\n");
- PopupError("The active partition is unused (invalid).\n",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
-
- if (ActiveBootPartition->PartInfo[0].PartitionType == 0x0A)
- {
- /* OS/2 boot manager partition */
- DPRINT1("Found OS/2 boot manager partition\n");
- PopupError("Setup found an OS/2 boot manager partiton.\n"
- "The OS/2 boot manager is not supported yet!",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- else if (ActiveBootPartition->PartInfo[0].PartitionType == 0x83)
- {
- /* Linux ext2 partition */
- DPRINT1("Found Linux ext2 partition\n");
- PopupError("Setup found a Linux ext2 partiton.\n"
- "Linux ext2 partitions are not supported yet!",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- else if (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_IFS)
- {
- /* NTFS partition */
- DPRINT1("Found NTFS partition\n");
- PopupError("Setup found an NTFS partiton.\n"
- "NTFS partitions are not supported yet!",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- else if ((ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
- (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
- (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_HUGE) ||
- (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_XINT13) ||
- (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
- (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
- {
- /* FAT or FAT32 partition */
- DPRINT1("System path: '%wZ'\n", &SystemRootPath);
-
- if (DoesFileExist(SystemRootPath.Buffer, L"ntldr") == TRUE ||
- DoesFileExist(SystemRootPath.Buffer, L"boot.ini") == TRUE)
- {
- /* Search root directory for 'ntldr' and 'boot.ini'. */
- DPRINT1("Found Microsoft Windows NT/2000/XP boot loader\n");
-
- /* Copy FreeLoader to the boot partition */
- wcscpy(SrcPath, SourceRootPath.Buffer);
- wcscat(SrcPath, L"\\loader\\freeldr.sys");
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\freeldr.sys");
-
- DPRINT1("Copy: %S ==> %S\n", SrcPath, DstPath);
- Status = SetupCopyFile(SrcPath, DstPath);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status);
- PopupError("Setup failed to copy 'freeldr.sys'.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
-
- /* Create or update freeldr.ini */
- if (DoesFileExist(SystemRootPath.Buffer, L"freeldr.ini") == FALSE)
- {
- /* Create new 'freeldr.ini' */
- DPRINT1("Create new 'freeldr.ini'\n");
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\freeldr.ini");
-
- Status = CreateFreeLoaderIniForReactos(DstPath,
- DestinationArcPath.Buffer);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status);
- PopupError("Setup failed to create 'freeldr.ini'.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
-
- /* Install new bootcode */
- if ((ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32) ||
- (ActiveBootPartition->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
- {
- /* Install FAT32 bootcode */
- wcscpy(SrcPath, SourceRootPath.Buffer);
- wcscat(SrcPath, L"\\loader\\fat32.bin");
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\bootsect.ros");
-
- DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, DstPath);
- Status = InstallFat32BootCodeToFile(SrcPath,
- DstPath,
- SystemRootPath.Buffer);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("InstallFat32BootCodeToFile() failed (Status %lx)\n", Status);
- PopupError("Setup failed to install the FAT32 bootcode.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- }
- else
- {
- /* Install FAT16 bootcode */
- wcscpy(SrcPath, SourceRootPath.Buffer);
- wcscat(SrcPath, L"\\loader\\fat.bin");
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\bootsect.ros");
-
- DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath);
- Status = InstallFat16BootCodeToFile(SrcPath,
- DstPath,
- SystemRootPath.Buffer);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("InstallFat16BootCodeToFile() failed (Status %lx)\n", Status);
- PopupError("Setup failed to install the FAT bootcode.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- }
-
- /* Update 'boot.ini' */
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\boot.ini");
-
- DPRINT1("Update 'boot.ini': %S\n", DstPath);
- Status = UpdateBootIni(DstPath,
- L"C:\\bootsect.ros",
- L"\"ReactOS\"");
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("UpdateBootIni() failed (Status %lx)\n", Status);
- PopupError("Setup failed to update \'boot.ini\'.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- }
- else
- {
- /* Update existing 'freeldr.ini' */
- DPRINT1("Update existing 'freeldr.ini'\n");
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\freeldr.ini");
-
- Status = UpdateFreeLoaderIni(DstPath,
- DestinationArcPath.Buffer);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status);
- PopupError("Setup failed to update 'freeldr.ini'.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }
- }
- }
- }
- }
- else if (DoesFileExist(SystemRootPath.Buffer, L"io.sys") == TRUE ||
- DoesFileExist(SystemRootPath.Buffer, L"msdos.sys") == TRUE)
- {
- /* Search for root directory for 'io.sys' and 'msdos.sys'. */
- DPRINT1("Found Microsoft DOS or Windows 9x boot loader\n");
-
- /* Copy FreeLoader to the boot partition */
- wcscpy(SrcPath, SourceRootPath.Buffer);
- wcscat(SrcPath, L"\\loader\\freeldr.sys");
- wcscpy(DstPath, SystemRootPath.Buffer);
- wcscat(DstPath, L"\\freeldr.sys");
-
- DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
- Status = SetupCopyFile(SrcPath, DstPath);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status);
- PopupError("Setup failed to copy 'freeldr.sys'.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return(QUIT_PAGE);
- }