From f17eb0c2a1ae438d346617b3f9d74a4de0c07c9c Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 22 Oct 2006 18:40:37 +0000 Subject: [PATCH] - implement FormatPartition settings - fix a few bugs in the unattend setup code svn path=/trunk/; revision=24605 --- reactos/base/setup/usetup/usetup.c | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/reactos/base/setup/usetup/usetup.c b/reactos/base/setup/usetup/usetup.c index 4d226ebeb8b..6a5a8a7ddac 100644 --- a/reactos/base/setup/usetup/usetup.c +++ b/reactos/base/setup/usetup/usetup.c @@ -77,6 +77,7 @@ BOOLEAN IsUnattendedSetup = FALSE; LONG UnattendDestinationDiskNumber; LONG UnattendDestinationPartitionNumber; LONG UnattendMBRInstallType = -1; +LONG UnattendFormatPartition = 0; WCHAR UnattendInstallationDirectory[MAX_PATH]; /* LOCALS *******************************************************************/ @@ -501,7 +502,7 @@ CheckUnattendedSetup(VOID) SetupCloseInfFile(&UnattendInf); return; } - if (!SetupGetIntField(&Context, 0, &IntValue)) + if (!SetupGetIntField(&Context, 1, &IntValue)) { DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n"); SetupCloseInfFile(&UnattendInf); @@ -516,7 +517,7 @@ CheckUnattendedSetup(VOID) SetupCloseInfFile(UnattendInf); return; } - if (!SetupGetIntField(&Context, 0, &IntValue)) + if (!SetupGetIntField(&Context, 1, &IntValue)) { DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n"); SetupCloseInfFile(UnattendInf); @@ -544,19 +545,21 @@ CheckUnattendedSetup(VOID) IsUnattendedSetup = TRUE; /* Search for 'MBRInstallType' in the 'Unattend' section */ - if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"MBRInstallType", &Context)) + if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"MBRInstallType", &Context)) { - DPRINT("SetupFindFirstLine() failed for key 'MBRInstallType'\n"); - SetupCloseInfFile(UnattendInf); - return; + if (SetupGetIntField(&Context, 1, &IntValue)) + { + UnattendMBRInstallType = IntValue; + } } - if (!SetupGetIntField(&Context, 0, &IntValue)) + /* Search for 'FormatPartition' in the 'Unattend' section */ + if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context)) { - DPRINT("SetupGetIntField() failed for key 'MBRInstallType'\n"); - SetupCloseInfFile(UnattendInf); - return; + if (SetupGetIntField(&Context, 1, &IntValue)) + { + UnattendFormatPartition = IntValue; + } } - UnattendMBRInstallType = IntValue; SetupCloseInfFile(UnattendInf); @@ -2133,6 +2136,10 @@ SelectFileSystemPage (PINPUT_RECORD Ir) if (IsUnattendedSetup) { + if (UnattendFormatPartition) + { + return FORMAT_PARTITION_PAGE; + } return(CHECK_FILE_SYSTEM_PAGE); } @@ -2216,7 +2223,10 @@ FormatPartitionPage (PINPUT_RECORD Ir) while(TRUE) { - CONSOLE_ConInKey(Ir); + if (!IsUnattendedSetup) + { + CONSOLE_ConInKey(Ir); + } if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -2227,7 +2237,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) } break; } - else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */ + else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */ { CONSOLE_SetStatusText (" Please wait ...");