Fix the indentation mess in "usetup.c"

svn path=/trunk/; revision=31647
This commit is contained in:
Colin Finck 2008-01-07 16:50:40 +00:00
parent cfe56f2869
commit 65bd222a65

View file

@ -93,9 +93,7 @@ PrintString(char* fmt,...)
va_end(ap); va_end(ap);
RtlInitAnsiString(&AnsiString, buffer); RtlInitAnsiString(&AnsiString, buffer);
RtlAnsiStringToUnicodeString(&UnicodeString, RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, TRUE);
&AnsiString,
TRUE);
NtDisplayString(&UnicodeString); NtDisplayString(&UnicodeString);
RtlFreeUnicodeString(&UnicodeString); RtlFreeUnicodeString(&UnicodeString);
} }
@ -223,9 +221,11 @@ PopupError(PCHAR Text,
MaxLength = 0; MaxLength = 0;
Lines = 0; Lines = 0;
pnext = Text; pnext = Text;
while (TRUE) while (TRUE)
{ {
p = strchr(pnext, '\n'); p = strchr(pnext, '\n');
if (p == NULL) if (p == NULL)
{ {
Length = strlen(pnext); Length = strlen(pnext);
@ -238,6 +238,7 @@ PopupError(PCHAR Text,
} }
Lines++; Lines++;
if (Length > MaxLength) if (Length > MaxLength)
MaxLength = Length; MaxLength = Length;
@ -251,12 +252,14 @@ PopupError(PCHAR Text,
if (Status != NULL) if (Status != NULL)
{ {
Length = strlen(Status); Length = strlen(Status);
if (Length > MaxLength) if (Length > MaxLength)
MaxLength = Length; MaxLength = Length;
} }
Width = MaxLength + 4; Width = MaxLength + 4;
Height = Lines + 2; Height = Lines + 2;
if (Status != NULL) if (Status != NULL)
Height += 2; Height += 2;
@ -283,6 +286,7 @@ PopupError(PCHAR Text,
while (TRUE) while (TRUE)
{ {
p = strchr(pnext, '\n'); p = strchr(pnext, '\n');
if (p == NULL) if (p == NULL)
{ {
Length = strlen(pnext); Length = strlen(pnext);
@ -352,8 +356,8 @@ PopupError(PCHAR Text,
{ {
CONSOLE_ConInKey(Ir); CONSOLE_ConInKey(Ir);
if (WaitEvent == POPUP_WAIT_ANY_KEY if (WaitEvent == POPUP_WAIT_ANY_KEY ||
|| Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
{ {
return; return;
} }
@ -418,6 +422,7 @@ CheckUnattendedSetup(VOID)
NULL, NULL,
INF_STYLE_WIN4, INF_STYLE_WIN4,
&ErrorLine); &ErrorLine);
if (UnattendInf == INVALID_HANDLE_VALUE) if (UnattendInf == INVALID_HANDLE_VALUE)
{ {
DPRINT("SetupOpenInfFileW() failed\n"); DPRINT("SetupOpenInfFileW() failed\n");
@ -455,12 +460,14 @@ CheckUnattendedSetup(VOID)
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
if (!INF_GetData(&Context, NULL, &Value)) if (!INF_GetData(&Context, NULL, &Value))
{ {
DPRINT("Can't read key 'UnattendSetupEnabled'\n"); DPRINT("Can't read key 'UnattendSetupEnabled'\n");
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
if (_wcsicmp(Value, L"yes") != 0) if (_wcsicmp(Value, L"yes") != 0)
{ {
DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n"); DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n");
@ -475,12 +482,14 @@ CheckUnattendedSetup(VOID)
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
if (!SetupGetIntField(&Context, 1, &IntValue)) if (!SetupGetIntField(&Context, 1, &IntValue))
{ {
DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n"); DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n");
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
UnattendDestinationDiskNumber = (LONG)IntValue; UnattendDestinationDiskNumber = (LONG)IntValue;
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */ /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
@ -490,12 +499,14 @@ CheckUnattendedSetup(VOID)
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
if (!SetupGetIntField(&Context, 1, &IntValue)) if (!SetupGetIntField(&Context, 1, &IntValue))
{ {
DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n"); DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n");
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
UnattendDestinationPartitionNumber = IntValue; UnattendDestinationPartitionNumber = IntValue;
/* Search for 'DestinationPartitionNumber' in the 'Unattend' section */ /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
@ -513,6 +524,7 @@ CheckUnattendedSetup(VOID)
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
return; return;
} }
wcscpy(UnattendInstallationDirectory, Value); wcscpy(UnattendInstallationDirectory, Value);
IsUnattendedSetup = TRUE; IsUnattendedSetup = TRUE;
@ -525,6 +537,7 @@ CheckUnattendedSetup(VOID)
UnattendMBRInstallType = IntValue; UnattendMBRInstallType = IntValue;
} }
} }
/* Search for 'FormatPartition' in the 'Unattend' section */ /* Search for 'FormatPartition' in the 'Unattend' section */
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context)) if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context))
{ {
@ -533,6 +546,7 @@ CheckUnattendedSetup(VOID)
UnattendFormatPartition = IntValue; UnattendFormatPartition = IntValue;
} }
} }
if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"AutoPartition", &Context)) if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"AutoPartition", &Context))
{ {
if (SetupGetIntField(&Context, 1, &IntValue)) if (SetupGetIntField(&Context, 1, &IntValue))
@ -540,6 +554,7 @@ CheckUnattendedSetup(VOID)
AutoPartition = IntValue; AutoPartition = IntValue;
} }
} }
SetupCloseInfFile(UnattendInf); SetupCloseInfFile(UnattendInf);
DPRINT("Running unattended setup\n"); DPRINT("Running unattended setup\n");
@ -558,15 +573,18 @@ UpdateKBLayout()
{ {
LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout); LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
} }
Entry = LayoutList->ListHead.Flink; Entry = LayoutList->ListHead.Flink;
while (Entry != &LayoutList->ListHead) while (Entry != &LayoutList->ListHead)
{ {
ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry); ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
if (!wcscmp(szNewLayout, ListEntry->UserData)) if (!wcscmp(szNewLayout, ListEntry->UserData))
{ {
LayoutList->CurrentEntry = ListEntry; LayoutList->CurrentEntry = ListEntry;
break; break;
} }
Entry = Entry->Flink; Entry = Entry->Flink;
} }
} }
@ -578,6 +596,7 @@ LanguagePage(PINPUT_RECORD Ir)
if (LanguageList == NULL) if (LanguageList == NULL)
{ {
LanguageList = CreateLanguageList(SetupInf, DefaultLanguage); LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
if (LanguageList == NULL) if (LanguageList == NULL)
{ {
PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE); PopupError("Setup failed to initialize available translations", NULL, NULL, POPUP_WAIT_NONE);
@ -624,10 +643,12 @@ LanguagePage(PINPUT_RECORD Ir)
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{ {
SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData; SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData;
if (wcscmp(SelectedLanguageId, DefaultLanguage)) if (wcscmp(SelectedLanguageId, DefaultLanguage))
{ {
UpdateKBLayout(); UpdateKBLayout();
} }
return INTRO_PAGE; return INTRO_PAGE;
} }
} }
@ -660,6 +681,7 @@ SetupStartPage(PINPUT_RECORD Ir)
&Sdi, &Sdi,
sizeof(SYSTEM_DEVICE_INFORMATION), sizeof(SYSTEM_DEVICE_INFORMATION),
&ReturnSize); &ReturnSize);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
{ {
CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status); CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status);
@ -677,6 +699,7 @@ SetupStartPage(PINPUT_RECORD Ir)
Status = GetSourcePaths(&SourcePath, Status = GetSourcePaths(&SourcePath,
&SourceRootPath, &SourceRootPath,
&SourceRootDir); &SourceRootDir);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status); CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status);
@ -700,6 +723,7 @@ SetupStartPage(PINPUT_RECORD Ir)
NULL, NULL,
INF_STYLE_WIN4, INF_STYLE_WIN4,
&ErrorLine); &ErrorLine);
if (SetupInf == INVALID_HANDLE_VALUE) if (SetupInf == INVALID_HANDLE_VALUE)
{ {
MUIDisplayError(ERROR_LOAD_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); MUIDisplayError(ERROR_LOAD_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER);
@ -713,7 +737,6 @@ SetupStartPage(PINPUT_RECORD Ir)
return QUIT_PAGE; return QUIT_PAGE;
} }
/* Get pointer 'Signature' key */ /* Get pointer 'Signature' key */
if (!INF_GetData (&Context, NULL, &Value)) if (!INF_GetData (&Context, NULL, &Value))
{ {
@ -774,6 +797,7 @@ IntroPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -878,6 +902,7 @@ InstallIntroPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -914,6 +939,7 @@ ScsiControllerPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -1001,24 +1027,28 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{ {
CONSOLE_NormalTextXY (24, Line, 48, 1); CONSOLE_NormalTextXY (24, Line, 48, 1);
if (Line == 14) if (Line == 14)
Line = 16; Line = 16;
else if (Line == 16) else if (Line == 16)
Line = 11; Line = 11;
else else
Line++; Line++;
CONSOLE_InvertTextXY (24, Line, 48, 1); CONSOLE_InvertTextXY (24, Line, 48, 1);
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{ {
CONSOLE_NormalTextXY (24, Line, 48, 1); CONSOLE_NormalTextXY (24, Line, 48, 1);
if (Line == 11) if (Line == 11)
Line = 16; Line = 16;
else if (Line == 16) else if (Line == 16)
Line = 14; Line = 14;
else else
Line--; Line--;
CONSOLE_InvertTextXY (24, Line, 48, 1); CONSOLE_InvertTextXY (24, Line, 48, 1);
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -1026,6 +1056,7 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -1079,6 +1110,7 @@ ComputerSettingsPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -1131,6 +1163,7 @@ DisplaySettingsPage(PINPUT_RECORD Ir)
{ {
return QUIT_PAGE; return QUIT_PAGE;
} }
break; break;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -1160,8 +1193,6 @@ KeyboardSettingsPage(PINPUT_RECORD Ir)
xScreen - 3, xScreen - 3,
yScreen - 3); yScreen - 3);
SaveGenericListState(KeyboardList); SaveGenericListState(KeyboardList);
while(TRUE) while(TRUE)
@ -1183,6 +1214,7 @@ KeyboardSettingsPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -1233,6 +1265,7 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -1262,6 +1295,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
19, 19,
xScreen - 3, xScreen - 3,
yScreen - 3); yScreen - 3);
if (PartitionList == NULL) if (PartitionList == NULL)
{ {
/* FIXME: show an error dialog */ /* FIXME: show an error dialog */
@ -1278,6 +1312,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
CheckForLinuxFdiskPartitions(PartitionList) == TRUE) CheckForLinuxFdiskPartitions(PartitionList) == TRUE)
{ {
MUIDisplayError(ERROR_WARN_PARTITION, NULL, POPUP_WAIT_NONE); MUIDisplayError(ERROR_WARN_PARTITION, NULL, POPUP_WAIT_NONE);
while (TRUE) while (TRUE)
{ {
CONSOLE_ConInKey (Ir); CONSOLE_ConInKey (Ir);
@ -1303,9 +1338,11 @@ SelectPartitionPage(PINPUT_RECORD Ir)
{ {
PPARTENTRY PartEntry = PartEntry = PartitionList->CurrentPartition; PPARTENTRY PartEntry = PartEntry = PartitionList->CurrentPartition;
ULONG MaxSize = (PartEntry->UnpartitionedLength + (1 << 19)) >> 20; /* in MBytes (rounded) */ ULONG MaxSize = (PartEntry->UnpartitionedLength + (1 << 19)) >> 20; /* in MBytes (rounded) */
CreateNewPartition(PartitionList, CreateNewPartition(PartitionList,
MaxSize, MaxSize,
TRUE); TRUE);
return (SELECT_FILE_SYSTEM_PAGE); return (SELECT_FILE_SYSTEM_PAGE);
} }
} }
@ -1339,6 +1376,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
PartitionList = NULL; PartitionList = NULL;
return QUIT_PAGE; return QUIT_PAGE;
} }
break; break;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -1448,6 +1486,7 @@ ShowPartitionSizeInputBox(SHORT Left,
strcpy (Buffer, "Size of new partition:"); strcpy (Buffer, "Size of new partition:");
iLeft = coPos.X + strlen (Buffer) + 1; iLeft = coPos.X + strlen (Buffer) + 1;
iTop = coPos.Y; iTop = coPos.Y;
WriteConsoleOutputCharacterA(StdOutput, WriteConsoleOutputCharacterA(StdOutput,
Buffer, Buffer,
strlen (Buffer), strlen (Buffer),
@ -1479,6 +1518,7 @@ ShowPartitionSizeInputBox(SHORT Left,
{ {
if (Quit != NULL) if (Quit != NULL)
*Quit = TRUE; *Quit = TRUE;
Buffer[0] = 0; Buffer[0] = 0;
break; break;
} }
@ -1490,6 +1530,7 @@ ShowPartitionSizeInputBox(SHORT Left,
{ {
if (Cancel != NULL) if (Cancel != NULL)
*Cancel = TRUE; *Cancel = TRUE;
Buffer[0] = 0; Buffer[0] = 0;
break; break;
} }
@ -1498,6 +1539,7 @@ ShowPartitionSizeInputBox(SHORT Left,
{ {
Index--; Index--;
Buffer[Index] = 0; Buffer[Index] = 0;
DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH, DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH,
iLeft, iLeft,
iTop, iTop,
@ -1507,11 +1549,13 @@ ShowPartitionSizeInputBox(SHORT Left,
(Index < PARTITION_SIZE_INPUT_FIELD_LENGTH)) (Index < PARTITION_SIZE_INPUT_FIELD_LENGTH))
{ {
ch = Ir.Event.KeyEvent.uChar.AsciiChar; ch = Ir.Event.KeyEvent.uChar.AsciiChar;
if ((ch >= '0') && (ch <= '9')) if ((ch >= '0') && (ch <= '9'))
{ {
Buffer[Index] = ch; Buffer[Index] = ch;
Index++; Index++;
Buffer[Index] = 0; Buffer[Index] = 0;
DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH, DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH,
iLeft, iLeft,
iTop, iTop,
@ -1520,8 +1564,7 @@ ShowPartitionSizeInputBox(SHORT Left,
} }
} }
strcpy (InputBuffer, strcpy (InputBuffer, Buffer);
Buffer);
} }
@ -1563,8 +1606,10 @@ CreatePartitionPage (PINPUT_RECORD Ir)
#endif #endif
{ {
DiskSize = (DiskEntry->DiskSize + (1 << 19)) >> 20; DiskSize = (DiskEntry->DiskSize + (1 << 19)) >> 20;
if (DiskSize == 0) if (DiskSize == 0)
DiskSize = 1; DiskSize = 1;
Unit = "MB"; Unit = "MB";
} }
@ -1592,7 +1637,6 @@ CreatePartitionPage (PINPUT_RECORD Ir)
DiskEntry->Id); DiskEntry->Id);
} }
CONSOLE_SetTextXY (6, 12, "Please enter the size of the new partition in megabytes."); CONSOLE_SetTextXY (6, 12, "Please enter the size of the new partition in megabytes.");
#if 0 #if 0
@ -1608,6 +1652,7 @@ CreatePartitionPage (PINPUT_RECORD Ir)
MaxSize = (PartEntry->UnpartitionedLength + (1 << 19)) >> 20; /* in MBytes (rounded) */ MaxSize = (PartEntry->UnpartitionedLength + (1 << 19)) >> 20; /* in MBytes (rounded) */
ShowPartitionSizeInputBox (12, 14, xScreen - 12, 17, /* left, top, right, bottom */ ShowPartitionSizeInputBox (12, 14, xScreen - 12, 17, /* left, top, right, bottom */
MaxSize, InputBuffer, &Quit, &Cancel); MaxSize, InputBuffer, &Quit, &Cancel);
if (Quit == TRUE) if (Quit == TRUE)
{ {
if (ConfirmQuit (Ir) == TRUE) if (ConfirmQuit (Ir) == TRUE)
@ -1622,6 +1667,7 @@ CreatePartitionPage (PINPUT_RECORD Ir)
else else
{ {
PartSize = atoi(InputBuffer); PartSize = atoi(InputBuffer);
if (PartSize < 1) if (PartSize < 1)
{ {
/* Too small */ /* Too small */
@ -1764,8 +1810,10 @@ DeletePartitionPage (PINPUT_RECORD Ir)
#endif #endif
{ {
DiskSize = (DiskEntry->DiskSize + (1 << 19)) >> 20; DiskSize = (DiskEntry->DiskSize + (1 << 19)) >> 20;
if (DiskSize == 0) if (DiskSize == 0)
DiskSize = 1; DiskSize = 1;
Unit = "MB"; Unit = "MB";
} }
@ -1804,6 +1852,7 @@ DeletePartitionPage (PINPUT_RECORD Ir)
{ {
return QUIT_PAGE; return QUIT_PAGE;
} }
break; break;
} }
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */ else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) /* ESC */
@ -1977,7 +2026,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
if (RepairUpdateFlag) if (RepairUpdateFlag)
{ {
return (CHECK_FILE_SYSTEM_PAGE); return CHECK_FILE_SYSTEM_PAGE;
//return SELECT_PARTITION_PAGE; //return SELECT_PARTITION_PAGE;
} }
@ -1987,6 +2036,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
{ {
return FORMAT_PARTITION_PAGE; return FORMAT_PARTITION_PAGE;
} }
return(CHECK_FILE_SYSTEM_PAGE); return(CHECK_FILE_SYSTEM_PAGE);
} }
@ -2001,6 +2051,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir)
{ {
return QUIT_PAGE; return QUIT_PAGE;
} }
break; break;
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -2076,6 +2127,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
{ {
return QUIT_PAGE; return QUIT_PAGE;
} }
break; break;
} }
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */ else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
@ -2143,13 +2195,13 @@ FormatPartitionPage (PINPUT_RECORD Ir)
Line = 13; Line = 13;
DiskEntry = PartitionList->CurrentDisk; DiskEntry = PartitionList->CurrentDisk;
Entry = DiskEntry->PartListHead.Flink; Entry = DiskEntry->PartListHead.Flink;
while (Entry != &DiskEntry->PartListHead) while (Entry != &DiskEntry->PartListHead)
{ {
PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry); PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
if (PartEntry->Unpartitioned == FALSE) if (PartEntry->Unpartitioned == FALSE)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
CONSOLE_PrintTextXY (6, Line, CONSOLE_PrintTextXY (6, Line,
@ -2222,8 +2274,8 @@ FormatPartitionPage (PINPUT_RECORD Ir)
if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0) if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
{ {
/* FIXME: Install boot code. This is a hack! */ /* FIXME: Install boot code. This is a hack! */
if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13) if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13) ||
|| (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32)) (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32))
{ {
wcscpy(PathBuffer, SourceRootPath.Buffer); wcscpy(PathBuffer, SourceRootPath.Buffer);
wcscat(PathBuffer, L"\\loader\\fat32.bin"); wcscat(PathBuffer, L"\\loader\\fat32.bin");
@ -2232,6 +2284,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
DestinationRootPath.Buffer); DestinationRootPath.Buffer);
Status = InstallFat32BootCodeToDisk(PathBuffer, Status = InstallFat32BootCodeToDisk(PathBuffer,
DestinationRootPath.Buffer); DestinationRootPath.Buffer);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status);
@ -2250,6 +2303,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
DestinationRootPath.Buffer); DestinationRootPath.Buffer);
Status = InstallFat16BootCodeToDisk(PathBuffer, Status = InstallFat16BootCodeToDisk(PathBuffer,
DestinationRootPath.Buffer); DestinationRootPath.Buffer);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status); DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status);
@ -2324,8 +2378,8 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
" \x07 Press ENTER to continue Setup.\n" " \x07 Press ENTER to continue Setup.\n"
" \x07 Press F3 to quit Setup.", " \x07 Press F3 to quit Setup.",
CurrentFileSystem->FileSystem); CurrentFileSystem->FileSystem);
PopupError(
Buffer, PopupError(Buffer,
"F3= Quit ENTER = Continue", "F3= Quit ENTER = Continue",
NULL, POPUP_WAIT_NONE); NULL, POPUP_WAIT_NONE);
@ -2333,8 +2387,8 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
{ {
CONSOLE_ConInKey(Ir); CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00 &&
&& Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */ Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
{ {
if (ConfirmQuit(Ir)) if (ConfirmQuit(Ir))
return QUIT_PAGE; return QUIT_PAGE;
@ -2355,9 +2409,11 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status); DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status);
sprintf(Buffer, "Setup failed to verify the selected partition.\n" sprintf(Buffer, "Setup failed to verify the selected partition.\n"
"(Status 0x%08lx).\n", Status); "(Status 0x%08lx).\n", Status);
PopupError(Buffer, PopupError(Buffer,
"ENTER = Reboot computer", "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER); Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE; return QUIT_PAGE;
} }
@ -2378,14 +2434,13 @@ InstallDirectoryPage1(PWCHAR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEn
/* Create 'DestinationPath' string */ /* Create 'DestinationPath' string */
RtlFreeUnicodeString(&DestinationPath); RtlFreeUnicodeString(&DestinationPath);
wcscpy(PathBuffer, wcscpy(PathBuffer, DestinationRootPath.Buffer);
DestinationRootPath.Buffer);
if (InstallDir[0] != L'\\') if (InstallDir[0] != L'\\')
wcscat(PathBuffer, wcscat(PathBuffer, L"\\");
L"\\");
wcscat(PathBuffer, InstallDir); wcscat(PathBuffer, InstallDir);
RtlCreateUnicodeString(&DestinationPath, RtlCreateUnicodeString(&DestinationPath, PathBuffer);
PathBuffer);
/* Create 'DestinationArcPath' */ /* Create 'DestinationArcPath' */
RtlFreeUnicodeString(&DestinationArcPath); RtlFreeUnicodeString(&DestinationArcPath);
@ -2393,12 +2448,12 @@ InstallDirectoryPage1(PWCHAR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEn
L"multi(0)disk(0)rdisk(%lu)partition(%lu)", L"multi(0)disk(0)rdisk(%lu)partition(%lu)",
DiskEntry->BiosDiskNumber, DiskEntry->BiosDiskNumber,
PartEntry->PartInfo[0].PartitionNumber); PartEntry->PartInfo[0].PartitionNumber);
if (InstallDir[0] != L'\\') if (InstallDir[0] != L'\\')
wcscat(PathBuffer, wcscat(PathBuffer, L"\\");
L"\\");
wcscat(PathBuffer, InstallDir); wcscat(PathBuffer, InstallDir);
RtlCreateUnicodeString(&DestinationArcPath, RtlCreateUnicodeString(&DestinationArcPath, PathBuffer);
PathBuffer);
return(PREPARE_COPY_PAGE); return(PREPARE_COPY_PAGE);
} }
@ -2441,6 +2496,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
{ {
wcscpy(InstallDir, L"\\ReactOS"); wcscpy(InstallDir, L"\\ReactOS");
} }
Length = wcslen(InstallDir); Length = wcslen(InstallDir);
CONSOLE_SetInputTextXY(8, 11, 51, InstallDir); CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
MUIDisplayPage(INSTALL_DIRECTORY_PAGE); MUIDisplayPage(INSTALL_DIRECTORY_PAGE);
@ -2459,6 +2515,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return(QUIT_PAGE); return(QUIT_PAGE);
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -2558,8 +2615,7 @@ AddSectionToCopyQueueCab(HINF InfFile,
/* FIXME: Handle error! */ /* FIXME: Handle error! */
DPRINT1("SetupQueueCopy() failed\n"); DPRINT1("SetupQueueCopy() failed\n");
} }
} } while (SetupFindNextLine(&FilesContext, &FilesContext));
while (SetupFindNextLine(&FilesContext, &FilesContext));
return TRUE; return TRUE;
} }
@ -2587,7 +2643,7 @@ AddSectionToCopyQueue(HINF InfFile,
char Buffer[128]; char Buffer[128];
sprintf(Buffer, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName); sprintf(Buffer, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName);
PopupError(Buffer, "ENTER = Reboot computer", Ir, POPUP_WAIT_ENTER); PopupError(Buffer, "ENTER = Reboot computer", Ir, POPUP_WAIT_ENTER);
return(FALSE); return FALSE;
} }
/* /*
@ -2646,8 +2702,7 @@ AddSectionToCopyQueue(HINF InfFile,
/* FIXME: Handle error! */ /* FIXME: Handle error! */
DPRINT1("SetupQueueCopy() failed\n"); DPRINT1("SetupQueueCopy() failed\n");
} }
} } while (SetupFindNextLine(&FilesContext, &FilesContext));
while (SetupFindNextLine(&FilesContext, &FilesContext));
return TRUE; return TRUE;
} }
@ -2673,6 +2728,7 @@ PrepareCopyPageInfFile(HINF InfFile,
{ {
if (!ProcessComputerFiles(InfFile, ComputerList, &AdditionalSectionName)) if (!ProcessComputerFiles(InfFile, ComputerList, &AdditionalSectionName))
return FALSE; return FALSE;
if (AdditionalSectionName) if (AdditionalSectionName)
{ {
if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir)) if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir))
@ -2703,10 +2759,9 @@ PrepareCopyPageInfFile(HINF InfFile,
{ {
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status); DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
MUIDisplayError(ERROR_CREATE_INSTALL_DIR, Ir, POPUP_WAIT_ENTER); MUIDisplayError(ERROR_CREATE_INSTALL_DIR, Ir, POPUP_WAIT_ENTER);
return(FALSE); return FALSE;
} }
/* Search for the 'Directories' section */ /* Search for the 'Directories' section */
if (!SetupFindFirstLineW(InfFile, L"Directories", NULL, &DirContext)) if (!SetupFindFirstLineW(InfFile, L"Directories", NULL, &DirContext))
{ {
@ -2718,7 +2773,8 @@ PrepareCopyPageInfFile(HINF InfFile,
{ {
MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER); MUIDisplayError(ERROR_TXTSETUP_SECTION, Ir, POPUP_WAIT_ENTER);
} }
return(FALSE);
return FALSE;
} }
/* Enumerate the directory values and create the subdirectories */ /* Enumerate the directory values and create the subdirectories */
@ -2753,13 +2809,12 @@ PrepareCopyPageInfFile(HINF InfFile,
{ {
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status); DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
MUIDisplayError(ERROR_CREATE_DIR, Ir, POPUP_WAIT_ENTER); MUIDisplayError(ERROR_CREATE_DIR, Ir, POPUP_WAIT_ENTER);
return(FALSE); return FALSE;
} }
} }
} } while (SetupFindNextLine (&DirContext, &DirContext));
while (SetupFindNextLine (&DirContext, &DirContext));
return(TRUE); return TRUE;
} }
static PAGE_NUMBER static PAGE_NUMBER
@ -2835,6 +2890,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
(const CHAR*) NULL, (const CHAR*) NULL,
INF_STYLE_WIN4, INF_STYLE_WIN4,
&ErrorLine); &ErrorLine);
if (InfHandle == INVALID_HANDLE_VALUE) if (InfHandle == INVALID_HANDLE_VALUE)
{ {
MUIDisplayError(ERROR_INVALID_CABINET_INF, Ir, POPUP_WAIT_ENTER); MUIDisplayError(ERROR_INVALID_CABINET_INF, Ir, POPUP_WAIT_ENTER);
@ -2848,8 +2904,7 @@ PrepareCopyPage(PINPUT_RECORD Ir)
return QUIT_PAGE; return QUIT_PAGE;
} }
#endif #endif
} } while (SetupFindNextLine (&CabinetsContext, &CabinetsContext));
while (SetupFindNextLine (&CabinetsContext, &CabinetsContext));
return FILE_COPY_PAGE; return FILE_COPY_PAGE;
} }
@ -3074,8 +3129,7 @@ RegistryPage(PINPUT_RECORD Ir)
MUIDisplayError(ERROR_IMPORT_HIVE, Ir, POPUP_WAIT_ENTER); MUIDisplayError(ERROR_IMPORT_HIVE, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE; return QUIT_PAGE;
} }
} } while (SetupFindNextLine (&InfContext, &InfContext));
while (SetupFindNextLine (&InfContext, &InfContext));
/* Update display registry settings */ /* Update display registry settings */
CONSOLE_SetStatusText(" Updating display registry settings..."); CONSOLE_SetStatusText(" Updating display registry settings...");
@ -3198,8 +3252,6 @@ BootLoaderPage(PINPUT_RECORD Ir)
if (Line<12) Line=14; if (Line<12) Line=14;
if (Line>14) Line=12; if (Line>14) Line=12;
CONSOLE_InvertTextXY (8, Line, 60, 1); CONSOLE_InvertTextXY (8, Line, 60, 1);
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -3211,7 +3263,6 @@ BootLoaderPage(PINPUT_RECORD Ir)
if (Line<12) Line=14; if (Line<12) Line=14;
if (Line>14) Line=12; if (Line>14) Line=12;
CONSOLE_InvertTextXY (8, Line, 48, 1); CONSOLE_InvertTextXY (8, Line, 48, 1);
} }
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
@ -3219,6 +3270,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -3238,7 +3290,6 @@ BootLoaderPage(PINPUT_RECORD Ir)
return BOOT_LOADER_PAGE; return BOOT_LOADER_PAGE;
} }
} }
return BOOT_LOADER_PAGE; return BOOT_LOADER_PAGE;
@ -3263,6 +3314,7 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir)
{ {
if (ConfirmQuit(Ir) == TRUE) if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE; return QUIT_PAGE;
break; break;
} }
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
@ -3273,8 +3325,7 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir)
return BOOT_LOADER_FLOPPY_PAGE; return BOOT_LOADER_FLOPPY_PAGE;
} }
Status = InstallFatBootcodeToFloppy(&SourceRootPath, Status = InstallFatBootcodeToFloppy(&SourceRootPath, &DestinationArcPath);
&DestinationArcPath);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Print error message */ /* Print error message */
@ -3438,6 +3489,7 @@ RunUSetup(VOID)
Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, PnpEventThread, &SetupInf, &hPnpThread, NULL); Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, PnpEventThread, &SetupInf, &hPnpThread, NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
hPnpThread = INVALID_HANDLE_VALUE; hPnpThread = INVALID_HANDLE_VALUE;
if (!CONSOLE_Init()) if (!CONSOLE_Init())
{ {
PrintString("Unable to open the console\n\n"); PrintString("Unable to open the console\n\n");
@ -3477,10 +3529,12 @@ RunUSetup(VOID)
case START_PAGE: case START_PAGE:
Page = SetupStartPage(&Ir); Page = SetupStartPage(&Ir);
break; break;
/* Language page */ /* Language page */
case LANGUAGE_PAGE: case LANGUAGE_PAGE:
Page = LanguagePage(&Ir); Page = LanguagePage(&Ir);
break; break;
/* License page */ /* License page */
case LICENSE_PAGE: case LICENSE_PAGE:
Page = LicensePage(&Ir); Page = LicensePage(&Ir);