* Hervé Poussineau (hpoussin@reactos.org)
*/
-#include "usetup.h"
+#include <usetup.h>
+
+#include "bootsup.h"
+#include "chkdsk.h"
+#include "format.h"
+#include "drivesup.h"
+#include "settings.h"
#define NDEBUG
#include <debug.h>
static UNICODE_STRING DestinationArcPath;
static UNICODE_STRING DestinationRootPath;
+static WCHAR DestinationDriveLetter;
+
/* Path to the active partition (boot manager) */
static UNICODE_STRING SystemRootPath;
UnattendDestinationPartitionNumber = IntValue;
- /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */
- if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context))
+ /* Search for 'InstallationDirectory' in the 'Unattend' section */
+ if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"InstallationDirectory", &Context))
{
- DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n");
+ DPRINT("SetupFindFirstLine() failed for key 'InstallationDirectory'\n");
SetupCloseInfFile(UnattendInf);
return;
}
static PAGE_NUMBER
LanguagePage(PINPUT_RECORD Ir)
{
+ PWCHAR NewLanguageId;
+ BOOL RefreshPage = FALSE;
+
/* Initialize the computer settings list */
if (LanguageList == NULL)
{
}
}
+ /* Load the font */
+ SelectedLanguageId = DefaultLanguage;
+ SetConsoleCodePage();
+
DrawGenericList(LanguageList,
2,
18,
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
-#if 0
- SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
-
- /* Redraw language selection page in native language */
- MUIDisplayPage(LANGUAGE_PAGE);
-#endif
-
ScrollDownGenericList (LanguageList);
+ RefreshPage = TRUE;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
-#if 0
- SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
-
- /* Redraw language selection page in native language */
- MUIDisplayPage(LANGUAGE_PAGE);
-#endif
-
ScrollUpGenericList(LanguageList);
+ RefreshPage = TRUE;
}
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
{
ScrollPageDownGenericList(LanguageList);
+ RefreshPage = TRUE;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
{
ScrollPageUpGenericList(LanguageList);
+ RefreshPage = TRUE;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
{
if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE;
+ else
+ RedrawGenericList(LanguageList);
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
UpdateKBLayout();
}
- // Load the font
+ /* Load the font */
SetConsoleCodePage();
return INTRO_PAGE;
{
/* a-z */
GenericListKeyPress (LanguageList, Ir->Event.KeyEvent.uChar.AsciiChar);
+ RefreshPage = TRUE;
+ }
+
+ if (RefreshPage)
+ {
+ NewLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
+
+ if (SelectedLanguageId != NewLanguageId)
+ {
+ /* Clear the language page */
+ MUIClearPage(LANGUAGE_PAGE);
+
+ SelectedLanguageId = NewLanguageId;
+
+ /* Load the font */
+ SetConsoleCodePage();
+
+ /* Redraw language selection page in native language */
+ MUIDisplayPage(LANGUAGE_PAGE);
+ }
+
+ RefreshPage = FALSE;
}
}
static PAGE_NUMBER
SetupStartPage(PINPUT_RECORD Ir)
{
- SYSTEM_DEVICE_INFORMATION Sdi;
+ //SYSTEM_DEVICE_INFORMATION Sdi;
NTSTATUS Status;
WCHAR FileNameBuffer[MAX_PATH];
INFCONTEXT Context;
PWCHAR Value;
UINT ErrorLine;
- ULONG ReturnSize;
+ //ULONG ReturnSize;
PGENERIC_LIST_ENTRY ListEntry;
INT IntValue;
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
-
+#if 0
/* Check whether a harddisk is available */
Status = NtQuerySystemInformation(SystemDeviceInformation,
&Sdi,
MUIDisplayError(ERROR_NO_HDD, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}
+#endif
/* Get the source path and source root path */
Status = GetSourcePaths(&SourcePath,
}
}
- return DISPLAY_SETTINGS_PAGE;
+ return KEYBOARD_SETTINGS_PAGE;
}
}
}
- return DISPLAY_SETTINGS_PAGE;
+ return LAYOUT_SETTINGS_PAGE;
}
/* FIXME: show an error dialog */
return QUIT_PAGE;
}
+ else if (IsListEmpty (&PartitionList->DiskListHead))
+ {
+ MUIDisplayError(ERROR_NO_HDD, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
}
- CheckActiveBootPartition(PartitionList);
-
DrawPartitionList(PartitionList);
/* Warn about partitions created by Linux Fdisk */
TRUE);
}
+ DestinationDriveLetter = (WCHAR)PartitionList->CurrentPartition->DriveLetter[0];
+
return SELECT_FILE_SYSTEM_PAGE;
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
else if (!FileSystemList->Selected->FormatFunc)
return QUIT_PAGE;
- CheckActiveBootPartition(PartitionList);
-
#ifndef NDEBUG
CONSOLE_PrintTextXY(6, 12,
"Disk: %I64u Cylinder: %I64u Track: %I64u",
PathBuffer);
DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath);
-
- /* Set SystemRootPath */
- RtlFreeUnicodeString(&SystemRootPath);
- swprintf(PathBuffer,
- L"\\Device\\Harddisk%lu\\Partition%lu",
- PartitionList->ActiveBootDisk->DiskNumber,
- PartitionList->ActiveBootPartition->
- PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionNumber);
- RtlCreateUnicodeString(&SystemRootPath,
- PathBuffer);
- DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
-
-
if (FileSystemList->Selected->FormatFunc)
{
Status = FormatPartition(&DestinationRootPath,
RtlCreateUnicodeString(&DestinationRootPath, PathBuffer);
DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath);
- /* Set SystemRootPath */
- RtlFreeUnicodeString(&SystemRootPath);
- swprintf(PathBuffer,
- L"\\Device\\Harddisk%lu\\Partition%lu",
- PartitionList->ActiveBootDisk->DiskNumber,
- PartitionList->ActiveBootPartition->PartInfo[PartNum].PartitionNumber);
- RtlCreateUnicodeString(&SystemRootPath, PathBuffer);
- DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
-
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART));
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
WCHAR InstallDir[51];
- PWCHAR DefaultPath;
- INFCONTEXT Context;
ULONG Length;
if (PartitionList == NULL ||
DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
- /* Search for 'DefaultPath' in the 'SetupData' section */
- if (!SetupFindFirstLineW(SetupInf, L"SetupData", L"DefaultPath", &Context))
- {
- MUIDisplayError(ERROR_FIND_SETUPDATA, Ir, POPUP_WAIT_ENTER);
- return QUIT_PAGE;
- }
-
- /* Read the 'DefaultPath' data */
- if (INF_GetData(&Context, NULL, &DefaultPath))
- {
- wcscpy(InstallDir, DefaultPath);
- }
+ if (IsUnattendedSetup)
+ wcscpy(InstallDir, UnattendInstallationDirectory);
else
- {
wcscpy(InstallDir, L"\\ReactOS");
- }
Length = wcslen(InstallDir);
CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
case SPFILENOTIFY_ENDCOPY:
CopyContext->CompletedOperations++;
+
+ /* SYSREG checkpoint */
+ if (CopyContext->TotalOperations >> 1 == CopyContext->CompletedOperations)
+ DPRINT1("CHECKPOINT:HALF_COPIED\n");
+
ProgressNextStep(CopyContext->ProgressBar);
SetupUpdateMemoryInfo(CopyContext, FALSE);
break;
return QUIT_PAGE;
}
+ /* Set the default pagefile entry */
+ SetDefaultPagefile(DestinationDriveLetter);
+
/* Update the mounted devices list */
SetMountedDeviceValues(PartitionList);
UCHAR PartitionType;
BOOLEAN InstallOnFloppy;
USHORT Line = 12;
+ WCHAR PathBuffer[MAX_PATH];
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
+ /* Find or set the active partition */
+ CheckActiveBootPartition(PartitionList);
+
+ /* Update the partition table because we may have changed the active partition */
+ if (WritePartitionsToDisk(PartitionList) == FALSE)
+ {
+ DPRINT("WritePartitionsToDisk() failed\n");
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
+
+ RtlFreeUnicodeString(&SystemRootPath);
+ swprintf(PathBuffer,
+ L"\\Device\\Harddisk%lu\\Partition%lu",
+ PartitionList->ActiveBootDisk->DiskNumber,
+ PartitionList->ActiveBootPartition->
+ PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionNumber);
+ RtlCreateUnicodeString(&SystemRootPath,
+ PathBuffer);
+ DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
+
PartitionType = PartitionList->ActiveBootPartition->
PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionType;