- Check the number of harddisks and fail if no harddisk is available.

- Updated some texts.
- Disabled debugging messages.

svn path=/trunk/; revision=6203
This commit is contained in:
Eric Kohl 2003-10-01 14:54:21 +00:00
parent 960aa79c36
commit 14faffecc0

View file

@ -398,15 +398,55 @@ ConfirmQuit(PINPUT_RECORD Ir)
static PAGE_NUMBER static PAGE_NUMBER
StartPage(PINPUT_RECORD Ir) StartPage(PINPUT_RECORD Ir)
{ {
SYSTEM_DEVICE_INFORMATION Sdi;
NTSTATUS Status; NTSTATUS Status;
WCHAR FileNameBuffer[MAX_PATH]; WCHAR FileNameBuffer[MAX_PATH];
UNICODE_STRING FileName; UNICODE_STRING FileName;
INFCONTEXT Context; INFCONTEXT Context;
PWCHAR Value; PWCHAR Value;
ULONG ErrorLine; ULONG ErrorLine;
ULONG ReturnSize;
SetStatusText(" Please wait..."); SetStatusText(" Please wait...");
/* Check whether a harddisk is available */
Status = NtQuerySystemInformation (SystemDeviceInformation,
&Sdi,
sizeof(SYSTEM_DEVICE_INFORMATION),
&ReturnSize);
if (!NT_SUCCESS (Status))
{
PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status);
PopupError("Setup could not retrieve system drive information.\n",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
if (Sdi.NumberOfDisks == 0)
{
PopupError("Setup could not find a harddisk.\n",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
/* Get the source path and source root path */
Status = GetSourcePaths(&SourcePath, Status = GetSourcePaths(&SourcePath,
&SourceRootPath); &SourceRootPath);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -638,17 +678,19 @@ InstallIntroPage(PINPUT_RECORD Ir)
SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet");
SetTextXY(6, 9, "support all the functions of a fully usable setup application."); SetTextXY(6, 9, "support all the functions of a fully usable setup application.");
SetTextXY(6, 12, "The following functions are missing:"); SetTextXY(6, 12, "The following limitations apply:");
SetTextXY(8, 13, "- Creating and deleting harddisk partitions."); SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk.");
SetTextXY(8, 14, "- Formatting partitions."); SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk");
SetTextXY(8, 15, "- Support for non-FAT file systems."); SetTextXY(8, 15, " as long as extended partitions exist on this disk.");
SetTextXY(8, 16, "- Checking file systems."); SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk");
SetTextXY(8, 17, " as long as other extended partitions exist on this disk.");
SetTextXY(8, 18, "- Setup supports FAT file systems only.");
SetTextXY(8, 19, "- File system checks are not implemented yet.");
SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS.");
SetTextXY(8, 21, "\x07 Press ENTER to install ReactOS."); SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS.");
SetTextXY(8, 23, "\x07 Press F3 to quit without installing ReactOS.");
SetStatusText(" ENTER = Continue F3 = Quit"); SetStatusText(" ENTER = Continue F3 = Quit");
@ -1538,10 +1580,10 @@ FormatPartitionPage (PINPUT_RECORD Ir)
PLIST_ENTRY Entry; PLIST_ENTRY Entry;
NTSTATUS Status; NTSTATUS Status;
//#ifndef NDEBUG #ifndef NDEBUG
ULONG Line; ULONG Line;
ULONG i; ULONG i;
//#endif #endif
SetTextXY(6, 8, "Format partition"); SetTextXY(6, 8, "Format partition");
@ -1636,7 +1678,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
CheckActiveBootPartition (PartitionList); CheckActiveBootPartition (PartitionList);
//#ifndef NDEBUG #ifndef NDEBUG
PrintTextXY (6, 12, PrintTextXY (6, 12,
"Disk: %I64u Cylinder: %I64u Track: %I64u", "Disk: %I64u Cylinder: %I64u Track: %I64u",
DiskEntry->DiskSize, DiskEntry->DiskSize,
@ -1676,7 +1718,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
/* Restore the old entry */ /* Restore the old entry */
PartEntry = PartitionList->CurrentPartition; PartEntry = PartitionList->CurrentPartition;
//#endif #endif
if (WritePartitionsToDisk (PartitionList) == FALSE) if (WritePartitionsToDisk (PartitionList) == FALSE)
{ {
@ -1996,6 +2038,7 @@ PrepareCopyPageInfFile(HINF InfFile, PWCHAR SourceCabinet, PINPUT_RECORD Ir)
PWCHAR FileKeyValue; PWCHAR FileKeyValue;
PWCHAR DirKeyName; PWCHAR DirKeyName;
PWCHAR DirKeyValue; PWCHAR DirKeyValue;
PWCHAR TargetFileName;
/* Search for the 'SourceFiles' section */ /* Search for the 'SourceFiles' section */
if (!InfFindFirstLine (InfFile, L"SourceFiles", NULL, &FilesContext)) if (!InfFindFirstLine (InfFile, L"SourceFiles", NULL, &FilesContext))
@ -2021,11 +2064,17 @@ PrepareCopyPageInfFile(HINF InfFile, PWCHAR SourceCabinet, PINPUT_RECORD Ir)
*/ */
do do
{ {
/* Get source file name and target directory id */
if (!InfGetData (&FilesContext, &FileKeyName, &FileKeyValue)) if (!InfGetData (&FilesContext, &FileKeyName, &FileKeyValue))
{ {
DPRINT("break\n"); /* FIXME: Handle error! */
break; DPRINT1("InfGetData() failed\n");
} break;
}
/* Get optional target file name */
if (!InfGetDataField (&FilesContext, 2, &TargetFileName))
TargetFileName = NULL;
DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue);
@ -2045,12 +2094,12 @@ PrepareCopyPageInfFile(HINF InfFile, PWCHAR SourceCabinet, PINPUT_RECORD Ir)
} }
if (!SetupQueueCopy(SetupFileQueue, if (!SetupQueueCopy(SetupFileQueue,
SourceCabinet, SourceCabinet,
SourceRootPath.Buffer, SourceRootPath.Buffer,
L"\\reactos", L"\\reactos",
FileKeyName, FileKeyName,
DirKeyValue, DirKeyValue,
NULL)) TargetFileName))
{ {
/* FIXME: Handle error! */ /* FIXME: Handle error! */
DPRINT1("SetupQueueCopy() failed\n"); DPRINT1("SetupQueueCopy() failed\n");
@ -2100,14 +2149,14 @@ PrepareCopyPageInfFile(HINF InfFile, PWCHAR SourceCabinet, PINPUT_RECORD Ir)
if (!InfFindFirstLine(InfFile, L"Directories", NULL, &DirContext)) if (!InfFindFirstLine(InfFile, L"Directories", NULL, &DirContext))
{ {
if (SourceCabinet) if (SourceCabinet)
{ {
PopupError("Setup failed to find the 'Directories' section\n" PopupError("Setup failed to find the 'Directories' section\n"
"in the cabinet.\n", "ENTER = Reboot computer"); "in the cabinet.\n", "ENTER = Reboot computer");
} }
else else
{ {
PopupError("Setup failed to find the 'Directories' section\n" PopupError("Setup failed to find the 'Directories' section\n"
"in TXTSETUP.SIF.\n", "ENTER = Reboot computer"); "in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
} }
while(TRUE) while(TRUE)
@ -2125,19 +2174,19 @@ PrepareCopyPageInfFile(HINF InfFile, PWCHAR SourceCabinet, PINPUT_RECORD Ir)
do do
{ {
if (!InfGetData (&DirContext, NULL, &KeyValue)) if (!InfGetData (&DirContext, NULL, &KeyValue))
{ {
DPRINT1("break\n"); DPRINT1("break\n");
break; break;
} }
if (KeyValue[0] == L'\\' && KeyValue[1] != 0) if (KeyValue[0] == L'\\' && KeyValue[1] != 0)
{ {
DPRINT("Absolute Path: '%S'\n", KeyValue); DPRINT("Absolute Path: '%S'\n", KeyValue);
wcscpy(PathBuffer, DestinationRootPath.Buffer); wcscpy(PathBuffer, DestinationRootPath.Buffer);
wcscat(PathBuffer, KeyValue); wcscat(PathBuffer, KeyValue);
DPRINT("FullPath: '%S'\n", PathBuffer); DPRINT("FullPath: '%S'\n", PathBuffer);
} }
else if (KeyValue[0] != L'\\') else if (KeyValue[0] != L'\\')
{ {
@ -2245,73 +2294,74 @@ PrepareCopyPage(PINPUT_RECORD Ir)
do do
{ {
if (!InfGetData (&CabinetsContext, NULL, &KeyValue)) if (!InfGetData (&CabinetsContext, NULL, &KeyValue))
break; break;
wcscpy(PathBuffer, SourcePath.Buffer); wcscpy(PathBuffer, SourcePath.Buffer);
wcscat(PathBuffer, L"\\"); wcscat(PathBuffer, L"\\");
wcscat(PathBuffer, KeyValue); wcscat(PathBuffer, KeyValue);
CabinetInitialize(); CabinetInitialize();
CabinetSetEventHandlers(NULL, NULL, NULL); CabinetSetEventHandlers(NULL, NULL, NULL);
CabinetSetCabinetName(PathBuffer); CabinetSetCabinetName(PathBuffer);
if (CabinetOpen() == CAB_STATUS_SUCCESS) if (CabinetOpen() == CAB_STATUS_SUCCESS)
{ {
DPRINT("Cabinet %S\n", CabinetGetCabinetName()); DPRINT("Cabinet %S\n", CabinetGetCabinetName());
InfFileData = CabinetGetCabinetReservedArea(&InfFileSize); InfFileData = CabinetGetCabinetReservedArea(&InfFileSize);
if (InfFileData == NULL) if (InfFileData == NULL)
{ {
PopupError("Cabinet has no setup script.\n", PopupError("Cabinet has no setup script.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer");
while(TRUE) while(TRUE)
{ {
ConInKey(Ir); ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
}
else
{
DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
PopupError("Cabinet not found.\n", "ENTER = Reboot computer"); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
while(TRUE) return(QUIT_PAGE);
{ }
ConInKey(Ir); }
}
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ }
{ else
return(QUIT_PAGE); {
} DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
}
}
Status = InfOpenBufferedFile(&InfHandle, PopupError("Cabinet not found.\n",
InfFileData, "ENTER = Reboot computer");
InfFileSize,
&ErrorLine); while(TRUE)
if (!NT_SUCCESS(Status)) {
{ ConInKey(Ir);
PopupError("Cabinet has no valid inf file.\n",
"ENTER = Reboot computer"); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
while(TRUE) return(QUIT_PAGE);
{ }
ConInKey(Ir); }
}
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{ Status = InfOpenBufferedFile(&InfHandle,
return(QUIT_PAGE); InfFileData,
} InfFileSize,
} &ErrorLine);
} if (!NT_SUCCESS(Status))
{
PopupError("Cabinet has no valid inf file.\n",
"ENTER = Reboot computer");
while(TRUE)
{
ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
}
CabinetCleanup(); CabinetCleanup();
@ -2547,6 +2597,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
} }
} }
} }
if (PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == 0x0A) if (PartitionList->ActiveBootPartition->PartInfo[0].PartitionType == 0x0A)
{ {
/* OS/2 boot manager partition */ /* OS/2 boot manager partition */