- Added error messages

- Added support for multiple installations

Please wait until the Disk-LED stopps flashing or your installation will be corrupted. :-/

svn path=/trunk/; revision=4081
This commit is contained in:
Eric Kohl 2003-01-30 14:41:45 +00:00
parent 40e995eed2
commit 6002d83db8
3 changed files with 792 additions and 356 deletions

View file

@ -46,13 +46,6 @@ CreateCommonFreeLoaderSections(PINICACHE IniCache)
IniSection = IniCacheAppendSection(IniCache,
L"FREELOADER");
#if 0
MessageLine=Welcome to FreeLoader!
MessageLine=Copyright (c) 2002 by Brian Palmer <brianp@sginet.com>
MessageLine=
MessageBox=Edit your FREELDR.INI file to change your boot settings.
#endif
/* DefaultOS=ReactOS */
IniCacheInsertKey(IniSection,
NULL,
@ -80,15 +73,6 @@ MessageBox=Edit your FREELDR.INI file to change your boot settings.
L"TitleText",
L"ReactOS Boot Manager");
#if 0
/* DisplayMode=NORMAL_VGA */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"DisplayMode",
L"NORMAL_VGA");
#endif
/* StatusBarColor=Cyan */
IniCacheInsertKey(IniSection,
NULL,
@ -211,6 +195,13 @@ CreateFreeLoaderIniForDos(PWCHAR IniPath,
L"ReactOS",
L"\"ReactOS\"");
/* ReactOS_Debug="ReactOS (Debug)" */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"ReactOS_Debug",
L"\"ReactOS (Debug)\"");
/* DOS=Dos/Windows */
IniCacheInsertKey(IniSection,
NULL,
@ -229,7 +220,25 @@ CreateFreeLoaderIniForDos(PWCHAR IniPath,
L"BootType",
L"ReactOS");
/* SystemPath=multi(0)disk(0)rdisk(0)partition(1)\reactos */
/* SystemPath=<ArcPath> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"SystemPath",
ArcPath);
/* Create "ReactOS_Debug" section */
IniSection = IniCacheAppendSection(IniCache,
L"ReactOS_Debug");
/* BootType=ReactOS */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"BootType",
L"ReactOS");
/* SystemPath=<ArcPath> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
@ -243,25 +252,6 @@ CreateFreeLoaderIniForDos(PWCHAR IniPath,
L"Options",
L"/DEBUGPORT=SCREEN");
/* Kernel=\REACTOS\SYSTEM32\NTOSKRNL.EXE */
#if 0
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"Options",
L"/DEBUGPORT=SCREEN");
#endif
/* Hal=\REACTOS\SYSTEM32\HAL.DLL */
#if 0
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"Hal",
L"/DEBUGPORT=SCREEN");
#endif
/* Create "DOS" section */
IniSection = IniCacheAppendSection(IniCache,
L"DOS");
@ -296,6 +286,8 @@ CreateFreeLoaderIniForDos(PWCHAR IniPath,
IniCacheSave(IniCache, IniPath);
IniCacheDestroy(IniCache);
return(STATUS_SUCCESS);
}
@ -321,6 +313,13 @@ CreateFreeLoaderIniForReactos(PWCHAR IniPath,
L"ReactOS",
L"\"ReactOS\"");
/* ReactOS_Debug="ReactOS (Debug)" */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"ReactOS_Debug",
L"\"ReactOS (Debug)\"");
/* Create "ReactOS" section */
IniSection = IniCacheAppendSection(IniCache,
L"ReactOS");
@ -332,7 +331,25 @@ CreateFreeLoaderIniForReactos(PWCHAR IniPath,
L"BootType",
L"ReactOS");
/* SystemPath=multi(0)disk(0)rdisk(0)partition(1)\reactos */
/* SystemPath=<ArcPath> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"SystemPath",
ArcPath);
/* Create "ReactOS_Debug" section */
IniSection = IniCacheAppendSection(IniCache,
L"ReactOS_Debug");
/* BootType=ReactOS */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"BootType",
L"ReactOS");
/* SystemPath=<ArcPath> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
@ -346,27 +363,87 @@ CreateFreeLoaderIniForReactos(PWCHAR IniPath,
L"Options",
L"/DEBUGPORT=SCREEN");
/* Save the ini file */
IniCacheSave(IniCache, IniPath);
IniCacheDestroy(IniCache);
/* Kernel=\REACTOS\SYSTEM32\NTOSKRNL.EXE */
#if 0
return(STATUS_SUCCESS);
}
NTSTATUS
UpdateFreeLoaderIni(PWCHAR IniPath,
PWCHAR ArcPath)
{
UNICODE_STRING Name;
PINICACHE IniCache;
PINICACHESECTION IniSection;
WCHAR SectionName[80];
WCHAR OsName[80];
PWCHAR KeyData;
ULONG i;
NTSTATUS Status;
RtlInitUnicodeString(&Name,
IniPath);
Status = IniCacheLoad(&IniCache,
&Name);
if (!NT_SUCCESS(Status))
return(Status);
/* Get "Operating Systems" section */
IniSection = IniCacheGetSection(IniCache,
L"Operating Systems");
if (IniSection == NULL)
return(STATUS_UNSUCCESSFUL);
/* Find an unused section name */
i = 1;
wcscpy(SectionName, L"ReactOS");
wcscpy(OsName, L"\"ReactOS\"");
while(TRUE)
{
Status = IniCacheGetKey(IniSection,
SectionName,
&KeyData);
if (!NT_SUCCESS(Status))
break;
swprintf(SectionName, L"ReactOS_%lu", i);
swprintf(OsName, L"\"ReactOS %lu\"", i);
i++;
}
/* <SectionName>=<OsName> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"Kernel",
L"/DEBUGPORT=SCREEN");
#endif
SectionName,
OsName);
/* Hal=\REACTOS\SYSTEM32\HAL.DLL */
#if 0
/* Create <SectionName> section */
IniSection = IniCacheAppendSection(IniCache,
SectionName);
/* BootType=ReactOS */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"Hal",
L"/DEBUGPORT=SCREEN");
#endif
L"BootType",
L"ReactOS");
/* SystemPath=<ArcPath> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"SystemPath",
ArcPath);
IniCacheSave(IniCache, IniPath);
IniCacheDestroy(IniCache);
return(STATUS_SUCCESS);
}
@ -406,7 +483,6 @@ SaveCurrentBootSector(PWSTR RootPath,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, BootSector);
return(Status);
}
@ -423,7 +499,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, BootSector);
return(Status);
}
@ -451,7 +526,6 @@ CHECKPOINT1;
0);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, BootSector);
return(Status);
}
@ -512,7 +586,6 @@ InstallFat16BootCodeToFile(PWSTR SrcPath,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -529,7 +602,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -541,7 +613,6 @@ CHECKPOINT1;
SECTORSIZE);
if (NewBootSector == NULL)
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(STATUS_INSUFFICIENT_RESOURCES);
}
@ -564,7 +635,6 @@ CHECKPOINT1;
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -582,7 +652,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -617,7 +686,6 @@ CHECKPOINT1;
0);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
}
@ -682,7 +750,6 @@ InstallFat32BootCodeToFile(PWSTR SrcPath,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -710,7 +777,6 @@ CHECKPOINT1;
2 * SECTORSIZE);
if (NewBootSector == NULL)
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(STATUS_INSUFFICIENT_RESOURCES);
}
@ -733,7 +799,6 @@ CHECKPOINT1;
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -751,7 +816,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -792,7 +856,6 @@ CHECKPOINT1;
0);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
}
@ -809,7 +872,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
}
@ -832,7 +894,6 @@ CHECKPOINT1;
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
}
@ -849,7 +910,6 @@ CHECKPOINT1;
NULL);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
}
NtClose(FileHandle);
@ -897,7 +957,6 @@ InstallFat16BootCodeToDisk(PWSTR SrcPath,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -914,7 +973,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -926,7 +984,6 @@ CHECKPOINT1;
SECTORSIZE);
if (NewBootSector == NULL)
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(STATUS_INSUFFICIENT_RESOURCES);
}
@ -949,7 +1006,6 @@ CHECKPOINT1;
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -967,7 +1023,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -1002,7 +1057,6 @@ CHECKPOINT1;
0);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
}
@ -1067,7 +1121,6 @@ InstallFat32BootCodeToDisk(PWSTR SrcPath,
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -1084,7 +1137,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(Status);
}
@ -1096,7 +1148,6 @@ CHECKPOINT1;
2 * SECTORSIZE);
if (NewBootSector == NULL)
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return(STATUS_INSUFFICIENT_RESOURCES);
}
@ -1119,7 +1170,6 @@ CHECKPOINT1;
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -1137,7 +1187,6 @@ CHECKPOINT1;
NtClose(FileHandle);
if (!NT_SUCCESS(Status))
{
CHECKPOINT1;
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return(Status);
@ -1151,10 +1200,6 @@ CHECKPOINT1;
/* Get the location of the backup boot sector */
BackupBootSector = (OrigBootSector[0x33] << 8) + OrigBootSector[0x33];
/* Disable the backup boot sector */
// NewBootSector[0x32] = 0xFF;
// NewBootSector[0x33] = 0xFF;
/* Free the original boot sector */
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: bootsup.h,v 1.2 2003/01/28 17:29:22 ekohl Exp $
/* $Id: bootsup.h,v 1.3 2003/01/30 14:41:45 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/bootsup.h
@ -35,6 +35,13 @@ NTSTATUS
CreateFreeLoaderIniForReactos(PWCHAR IniPath,
PWCHAR ArcPath);
NTSTATUS
UpdateFreeLoaderIni(PWCHAR IniPath,
PWCHAR ArcPath);
NTSTATUS
SaveCurrentBootSector(PWSTR RootPath,
PWSTR DstPath);
NTSTATUS
InstallFat16BootCodeToFile(PWSTR SrcPath,

View file

@ -134,7 +134,6 @@ PopupError(PCHAR Text,
SHORT Width;
SHORT Height;
/* Count text lines and longest line */
MaxLength = 0;
Lines = 0;
@ -602,7 +601,6 @@ InstallIntroPage(PINPUT_RECORD Ir)
SetTextXY(8, 14, "- Formatting partitions.");
SetTextXY(8, 15, "- Support for non-FAT file systems.");
SetTextXY(8, 16, "- Checking file systems.");
SetTextXY(8, 17, "- Installing the bootloader.");
@ -988,17 +986,18 @@ PrepareCopyPage(PINPUT_RECORD Ir)
SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. ");
SetTextXY(8, 12, "Build file copy list");
// SetTextXY(8, 12, "Build file copy list");
SetTextXY(8, 14, "Create directories");
// SetTextXY(8, 14, "Create directories");
SetStatusText(" Please wait...");
// SetStatusText(" Please wait...");
/*
* Build the file copy list
*/
SetInvertedTextXY(8, 12, "Build file copy list");
SetStatusText(" Building the file copy list...");
// SetInvertedTextXY(8, 12, "Build file copy list");
/* Open 'Directories' section */
@ -1071,7 +1070,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
{
do
{
DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
DPRINT1("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
/* Lookup target directory */
Status = IniCacheGetKey(DirSection,
@ -1100,11 +1099,12 @@ PrepareCopyPage(PINPUT_RECORD Ir)
}
/* Report that the file queue has been built */
SetTextXY(8, 12, "Build file copy list");
SetHighlightedTextXY(50, 12, "Done");
// SetTextXY(8, 12, "Build file copy list");
// SetHighlightedTextXY(50, 12, "Done");
/* create directories */
SetInvertedTextXY(8, 14, "Create directories");
SetStatusText(" Creating directories...");
// SetInvertedTextXY(8, 14, "Create directories");
/*
@ -1124,7 +1124,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
Status = CreateDirectory(PathBuffer);
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
{
DPRINT1("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
PopupError("Setup could not create the install directory.",
"ENTER = Reboot computer");
@ -1170,7 +1170,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
Status = CreateDirectory(PathBuffer);
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
{
DPRINT1("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
PopupError("Setup could not create install directories.",
"ENTER = Reboot computer");
@ -1194,6 +1194,9 @@ PrepareCopyPage(PINPUT_RECORD Ir)
}
return(FILE_COPY_PAGE);
#if 0
SetTextXY(8, 14, "Create directories");
SetHighlightedTextXY(50, 14, "Done");
@ -1218,6 +1221,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
}
return(PREPARE_COPY_PAGE);
#endif
}
@ -1289,6 +1293,9 @@ FileCopyPage(PINPUT_RECORD Ir)
DestroyProgressBar(CopyContext.ProgressBar);
return(REGISTRY_PAGE);
#if 0
SetStatusText(" ENTER = Continue F3 = Quit");
while(TRUE)
@ -1309,6 +1316,7 @@ FileCopyPage(PINPUT_RECORD Ir)
}
return(FILE_COPY_PAGE);
#endif
}
@ -1322,16 +1330,17 @@ RegistryPage(PINPUT_RECORD Ir)
HANDLE KeyHandle;
NTSTATUS Status;
SetTextXY(6, 8, "Initializing system settings");
SetTextXY(6, 8, "Setup initializes system settings");
SetTextXY(6, 12, "Create registry hives");
// SetTextXY(6, 12, "Create registry hives");
SetTextXY(6, 14, "Update registry hives");
// SetTextXY(6, 14, "Update registry hives");
SetStatusText(" Please wait...");
// SetStatusText(" Please wait...");
SetStatusText(" Creating registry hives...");
/* Create the 'secret' InstallPath key */
RtlInitUnicodeStringFromLiteral(&KeyName,
@ -1347,6 +1356,18 @@ RegistryPage(PINPUT_RECORD Ir)
if (!NT_SUCCESS(Status))
{
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
PopupError("Setup failed to open the HARDWARE registry key.",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
RtlInitUnicodeStringFromLiteral(&ValueName,
@ -1362,6 +1383,18 @@ RegistryPage(PINPUT_RECORD Ir)
if (!NT_SUCCESS(Status))
{
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
PopupError("Setup failed to set the \'InstallPath\' registry value.",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/* Create the standard hives */
@ -1369,18 +1402,32 @@ RegistryPage(PINPUT_RECORD Ir)
if (!NT_SUCCESS(Status))
{
DPRINT1("NtInitializeRegistry() failed (Status %lx)\n", Status);
PopupError("Setup failed to initialize the registry.",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/* Update registry */
SetStatusText(" Updating registry hives...");
/* FIXME: Create key '\Registry\Machine\System\Setup' */
/* FIXME: Create value 'SystemSetupInProgress' */
return(BOOT_LOADER_PAGE);
#if 0
SetStatusText(" ENTER = Continue F3 = Quit");
while(TRUE)
@ -1401,6 +1448,7 @@ RegistryPage(PINPUT_RECORD Ir)
}
return(REGISTRY_PAGE);
#endif
}
@ -1419,33 +1467,91 @@ BootLoaderPage(PINPUT_RECORD Ir)
if (ActivePartitionValid == FALSE)
{
SetTextXY(6, 10, "Error: no active partition found");
for(;;);
DPRINT1("Error: no active partition found\n");
PopupError("Setup could not find an active partiton\n",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
if (ActivePartition.PartType == PARTITION_ENTRY_UNUSED)
{
SetTextXY(6, 10, "Error: active partition invalid (unused)");
for(;;);
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 (ActivePartition.PartType == 0x0A)
{
/* OS/2 boot manager partition */
SetTextXY(6, 12, "Found OS/2 boot manager");
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 (ActivePartition.PartType == 0x83)
{
/* Linux ext2 partition */
SetTextXY(6, 12, "Found 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 (ActivePartition.PartType == PARTITION_IFS)
{
/* NTFS partition */
SetTextXY(6, 12, "Found 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 ((ActivePartition.PartType == PARTITION_FAT_12) ||
(ActivePartition.PartType == PARTITION_FAT_16) ||
@ -1455,13 +1561,13 @@ BootLoaderPage(PINPUT_RECORD Ir)
(ActivePartition.PartType == PARTITION_FAT32_XINT13))
{
/* FAT or FAT32 partition */
PrintTextXY(6, 10, "System path: '%wZ'", &SystemRootPath);
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'. */
SetTextXY(6, 12, "Found Microsoft Windows NT/2000/XP boot loader");
DPRINT1("Found Microsoft Windows NT/2000/XP boot loader\n");
/* Copy FreeLoader to the boot partition */
wcscpy(SrcPath, SourceRootPath.Buffer);
@ -1469,14 +1575,30 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\freeldr.sys");
// PrintTextXY(6, 14, "Copy: %S ==> %S", SrcPath, DstPath);
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 freeldr.ini */
/* 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");
@ -1485,44 +1607,78 @@ BootLoaderPage(PINPUT_RECORD Ir)
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 bootsector */
/* Install new bootcode */
if ((ActivePartition.PartType == PARTITION_FAT32) ||
(ActivePartition.PartType == 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");
// PrintTextXY(6, 16, "Install FAT32 bootcode: %S ==> %S",
// SrcPath, DstPath);
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");
// PrintTextXY(6, 16, "Install FAT bootcode: %S ==> %S",
// SrcPath, DstPath);
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);
}
}
}
}
@ -1530,20 +1686,59 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\boot.ini");
// PrintTextXY(6, 18, "Update 'boot.ini': %S", DstPath);
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'. */
SetTextXY(6, 12, "Found Microsoft DOS or Windows 9x boot loader");
DPRINT1("Found Microsoft DOS or Windows 9x boot loader\n");
/* Copy FreeLoader to the boot partition */
wcscpy(SrcPath, SourceRootPath.Buffer);
@ -1551,14 +1746,30 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\freeldr.sys");
// PrintTextXY(6, 14, "Copy: %S ==> %S", SrcPath, DstPath);
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);
}
}
}
/* Create freeldr.ini */
/* 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");
@ -1567,6 +1778,18 @@ BootLoaderPage(PINPUT_RECORD Ir)
if (!NT_SUCCESS(Status))
{
DPRINT1("CreateFreeLoaderIniForDos() 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);
}
}
}
/* Save current bootsector as 'BOOTSECT.DOS' */
@ -1574,12 +1797,24 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\bootsect.dos");
// PrintTextXY(6, 16, "Save bootsector: %S ==> %S", SrcPath, DstPath);
DPRINT1("Save bootsector: %S ==> %S\n", SrcPath, DstPath);
Status = SaveCurrentBootSector(SrcPath,
DstPath);
if (!NT_SUCCESS(Status))
{
DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status);
PopupError("Setup failed to save the current bootsector.",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/* Install new bootsector */
@ -1589,13 +1824,24 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(SrcPath, SourceRootPath.Buffer);
wcscat(SrcPath, L"\\loader\\fat32.bin");
// PrintTextXY(6, 18, "Install FAT32 bootcode: %S ==> %S",
// SrcPath, SystemRootPath.Buffer);
DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath.Buffer);
Status = InstallFat32BootCodeToDisk(SrcPath,
SystemRootPath.Buffer);
if (!NT_SUCCESS(Status))
{
DPRINT1("InstallFat32BootCodeToDisk() 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
@ -1603,19 +1849,57 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(SrcPath, SourceRootPath.Buffer);
wcscat(SrcPath, L"\\loader\\fat.bin");
// PrintTextXY(6, 18, "Install FAT bootcode: %S ==> %S",
// SrcPath, SystemRootPath.Buffer);
DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, SystemRootPath.Buffer);
Status = InstallFat16BootCodeToDisk(SrcPath,
SystemRootPath.Buffer);
if (!NT_SUCCESS(Status))
{
DPRINT1("InstallFat16BootCodeToDisk() 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);
}
}
}
}
}
else
{
SetTextXY(6, 12, "No or unknown boot loader found");
/* Update existing 'freeldr.ini' */
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
{
/* No or unknown boot loader */
DPRINT1("No or unknown boot loader found\n");
/* Copy FreeLoader to the boot partition */
wcscpy(SrcPath, SourceRootPath.Buffer);
@ -1623,26 +1907,50 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\freeldr.sys");
// PrintTextXY(6, 14, "Copy: %S ==> %S", SrcPath, DstPath);
DPRINT1("Copy: %S ==> %S", SrcPath, DstPath);
DPRINT1("Copy: %S ==> %S\n", SrcPath, DstPath);
Status = SetupCopyFile(SrcPath, DstPath);
DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status);
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 freeldr.ini */
/* Create or update 'freeldr.ini' */
if (DoesFileExist(SystemRootPath.Buffer, L"freeldr.ini") == FALSE)
{
/* Create new freeldr.ini */
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\freeldr.ini");
// DPRINT1("Copy: %S ==> %S", SrcPath, DstPath);
DPRINT1("Copy: %S ==> %S\n", SrcPath, DstPath);
Status = CreateFreeLoaderIniForReactos(DstPath,
DestinationArcPath.Buffer);
DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status);
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);
}
}
}
/* Save current bootsector as 'BOOTSECT.OLD' */
@ -1650,13 +1958,24 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(DstPath, SystemRootPath.Buffer);
wcscat(DstPath, L"\\bootsect.old");
// PrintTextXY(6, 16, "Save bootsector: %S ==> %S", SrcPath, DstPath);
DPRINT1("Save bootsector: %S ==> %S\n", SrcPath, DstPath);
Status = SaveCurrentBootSector(SrcPath,
DstPath);
DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status);
if (!NT_SUCCESS(Status))
{
DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status);
PopupError("Setup failed save the current bootsector.",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/* Install new bootsector */
@ -1666,13 +1985,24 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(SrcPath, SourceRootPath.Buffer);
wcscat(SrcPath, L"\\loader\\fat32.bin");
// PrintTextXY(6, 18, "Install FAT32 bootcode: %S ==> %S",
// SrcPath, SystemRootPath.Buffer);
DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath.Buffer);
Status = InstallFat32BootCodeToDisk(SrcPath,
SystemRootPath.Buffer);
if (!NT_SUCCESS(Status))
{
DPRINT1("InstallFat32BootCodeToDisk() 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
@ -1680,23 +2010,76 @@ BootLoaderPage(PINPUT_RECORD Ir)
wcscpy(SrcPath, SourceRootPath.Buffer);
wcscat(SrcPath, L"\\loader\\fat.bin");
// PrintTextXY(6, 18, "Install FAT bootcode: %S ==> %S",
// SrcPath, SystemRootPath.Buffer);
DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, SystemRootPath.Buffer);
Status = InstallFat16BootCodeToDisk(SrcPath,
SystemRootPath.Buffer);
if (!NT_SUCCESS(Status))
{
DPRINT1("InstallFat16BootCodeToDisk() 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);
}
}
}
}
}
else
{
/* unknown partition */
SetTextXY(6, 12, "Unknown partition found");
/* Update existing 'freeldr.ini' */
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
{
/* Unknown partition */
DPRINT1("Unknown partition found\n");
PopupError("Setup found an unknown partiton type.\n"
"This partition type is not supported!",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
return(SUCCESS_PAGE);
#if 0
SetStatusText(" ENTER = Continue F3 = Quit");
while(TRUE)
@ -1717,6 +2100,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
}
return(BOOT_LOADER_PAGE);
#endif
}
@ -1727,7 +2111,7 @@ QuitPage(PINPUT_RECORD Ir)
SetTextXY(10, 6, "ReactOS is not completely installed");
SetTextXY(10, 8, "Remove floppy disk from Drive A: and");
SetTextXY(10, 9, "all CD-ROMs from CD-Drive.");
SetTextXY(10, 9, "all CD-ROMs from CD-Drives.");
SetTextXY(10, 11, "Press ENTER to reboot your computer.");