* Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
-
-#include "precomp.h"
-#include <ntdll/rtl.h>
-
-#include <ntos/minmax.h>
-#include <reactos/resource.h>
-#include <rosrtl/string.h>
-
-#include "usetup.h"
-#include "console.h"
-#include "partlist.h"
-#include "inicache.h"
-#include "infcache.h"
-#include "filequeue.h"
-#include "progress.h"
-#include "bootsup.h"
-#include "registry.h"
-#include "format.h"
-#include "fslist.h"
-#include "cabinet.h"
-#include "filesup.h"
-#include "drivesup.h"
-#include "genlist.h"
-#include "settings.h"
+#include <usetup.h>
#define NDEBUG
#include <debug.h>
-
typedef enum _PAGE_NUMBER
{
START_PAGE,
DISPLAY_SETTINGS_PAGE,
KEYBOARD_SETTINGS_PAGE,
LAYOUT_SETTINGS_PAGE,
- POINTER_SETTINGS_PAGE,
SELECT_PARTITION_PAGE,
CREATE_PARTITION_PAGE,
static PGENERIC_LIST DisplayList = NULL;
static PGENERIC_LIST KeyboardList = NULL;
static PGENERIC_LIST LayoutList = NULL;
-static PGENERIC_LIST PointerList = NULL;
/* FUNCTIONS ****************************************************************/
coPos.Y++;
coPos.X = xLeft + 2;
WriteConsoleOutputCharacters(Status,
- min(strlen(Status), Width - 4),
+ min(strlen(Status), (SIZE_T)Width - 4),
coPos);
}
}
* Number of the next page.
*/
static PAGE_NUMBER
-StartPage(PINPUT_RECORD Ir)
+SetupStartPage(PINPUT_RECORD Ir)
{
SYSTEM_DEVICE_INFORMATION Sdi;
NTSTATUS Status;
static PAGE_NUMBER
DeviceSettingsPage(PINPUT_RECORD Ir)
{
- static ULONG Line = 17;
+ static ULONG Line = 16;
/* Initialize the computer settings list */
if (ComputerList == NULL)
}
}
- /* Initialize the pointer settings list */
- if (PointerList == NULL)
- {
- PointerList = CreateMouseDriverList(SetupInf);
- if (PointerList == NULL)
- {
- /* FIXME: report error */
- }
- }
-
SetTextXY(6, 8, "The list below shows the current device settings.");
SetTextXY(8, 11, " Computer:");
SetTextXY(8, 12, " Display:");
SetTextXY(8, 13, " Keyboard:");
SetTextXY(8, 14, "Keyboard layout:");
- SetTextXY(8, 15, " Pointer device:");
- SetTextXY(8, 17, " Accept:");
+ SetTextXY(8, 16, " Accept:");
SetTextXY(25, 11, GetGenericListEntry(ComputerList)->Text);
SetTextXY(25, 12, GetGenericListEntry(DisplayList)->Text);
SetTextXY(25, 13, GetGenericListEntry(KeyboardList)->Text);
SetTextXY(25, 14, GetGenericListEntry(LayoutList)->Text);
- SetTextXY(25, 15, GetGenericListEntry(PointerList)->Text);
- SetTextXY(25, 17, "Accept these device settings");
+ SetTextXY(25, 16, "Accept these device settings");
InvertTextXY (24, Line, 48, 1);
- SetTextXY(6, 20, "You can change the hardware settings by pressing the UP or DOWN keys");
- SetTextXY(6, 21, "to select an entry. Then press the ENTER key to select alternative");
- SetTextXY(6, 22, "settings.");
+ SetTextXY(6, 19, "You can change the hardware settings by pressing the UP or DOWN keys");
+ SetTextXY(6, 20, "to select an entry. Then press the ENTER key to select alternative");
+ SetTextXY(6, 21, "settings.");
- SetTextXY(6, 24, "When all settings are correct, select \"Accept these device settings\"");
- SetTextXY(6, 25, "and press ENTER.");
+ SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\"");
+ SetTextXY(6, 24, "and press ENTER.");
SetStatusText(" ENTER = Continue F3 = Quit");
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
NormalTextXY (24, Line, 48, 1);
- if (Line == 15)
- Line = 17;
- else if (Line == 17)
+ if (Line == 14)
+ Line = 16;
+ else if (Line == 16)
Line = 11;
else
Line++;
{
NormalTextXY (24, Line, 48, 1);
if (Line == 11)
- Line = 17;
- else if (Line == 17)
- Line = 15;
+ Line = 16;
+ else if (Line == 16)
+ Line = 14;
else
Line--;
InvertTextXY (24, Line, 48, 1);
return KEYBOARD_SETTINGS_PAGE;
else if (Line == 14)
return LAYOUT_SETTINGS_PAGE;
- else if (Line == 15)
- return POINTER_SETTINGS_PAGE;
- else if (Line == 17)
+ else if (Line == 16)
return SELECT_PARTITION_PAGE;
}
}
}
-static PAGE_NUMBER
-PointerSettingsPage(PINPUT_RECORD Ir)
-{
- SHORT xScreen;
- SHORT yScreen;
-
- SetTextXY(6, 8, "You want to change the pointing device to be installed.");
-
- SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired pointing");
- SetTextXY(8, 11, " device. Then press ENTER.");
-
- SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
- SetTextXY(8, 14, " the pointing device.");
-
- GetScreenSize(&xScreen, &yScreen);
-
- DrawGenericList(PointerList,
- 2,
- 18,
- xScreen - 3,
- yScreen - 3);
-
- SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
-
- SaveGenericListState(PointerList);
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
- {
- ScrollDownGenericList(PointerList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
- {
- ScrollUpGenericList(PointerList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
- {
- if (ConfirmQuit(Ir) == TRUE)
- return QUIT_PAGE;
- break;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
- {
- RestoreGenericListState(PointerList);
- return DEVICE_SETTINGS_PAGE;
- }
- else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return DEVICE_SETTINGS_PAGE;
- }
- }
-
- return DISPLAY_SETTINGS_PAGE;
-}
-
-
static PAGE_NUMBER
SelectPartitionPage(PINPUT_RECORD Ir)
{
return SELECT_FILE_SYSTEM_PAGE;
}
- else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_C) /* C */
+ else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
{
if (PartitionList->CurrentPartition->Unpartitioned == FALSE)
{
return CREATE_PARTITION_PAGE;
}
- else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_D) /* D */
+ else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
{
if (PartitionList->CurrentPartition->Unpartitioned == TRUE)
{
strlen (Buffer),
coPos);
- sprintf(Buffer, "%d", MaxSize);
+ sprintf(Buffer, "%lu", MaxSize);
Index = strlen(Buffer);
DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH,
iLeft,
}
#if 0
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000ULL) /* 10 GB */
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
{
PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
Unit = "GB";
}
else
#endif
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000ULL) /* 10 MB */
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */
{
PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20;
Unit = "MB";
{
return SELECT_PARTITION_PAGE;
}
- else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_D) /* D */
+ else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
{
DeleteCurrentPartition (PartitionList);
}
/* adjust partition size */
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000ULL) /* 10 GB */
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
{
PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
PartUnit = "GB";
switch (FileSystemList->CurrentFileSystem)
{
case FsFat:
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200ULL * 1024ULL))
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200LL * 1024LL))
{
/* FAT12 CHS partition (disk is smaller than 4.1MB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_12;
}
- else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024ULL * 255ULL * 63ULL * 512ULL))
+ else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024LL * 255LL * 63LL * 512LL))
{
/* Partition starts below the 8.4GB boundary ==> CHS partition */
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32LL * 1024LL * 1024LL))
{
/* FAT16 CHS partition (partiton size < 32MB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
}
- else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
+ else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
{
/* FAT16 CHS partition (partition size < 512MB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
{
/* Partition starts above the 8.4GB boundary ==> LBA partition */
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
{
/* FAT16 LBA partition (partition size < 512MB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
RtlFreeUnicodeString(&DestinationArcPath);
swprintf(PathBuffer,
L"multi(0)disk(0)rdisk(%lu)partition(%lu)",
- DiskEntry->DiskNumber,
+ DiskEntry->BiosDiskNumber,
PartEntry->PartInfo[0].PartitionNumber);
if (InstallDir[0] != L'\\')
wcscat(PathBuffer,
}
/* Create the install directory */
- Status = CreateDirectory(PathBuffer);
+ Status = SetupCreateDirectory(PathBuffer);
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
{
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
DPRINT("FullPath: '%S'\n", PathBuffer);
- Status = CreateDirectory(PathBuffer);
+ Status = SetupCreateDirectory(PathBuffer);
if (!NT_SUCCESS(Status) && Status != STATUS_OBJECT_NAME_COLLISION)
{
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
}
}
- /* Update mouse registry settings */
- SetStatusText(" Updating mouse registry settings...");
- if (!ProcessMouseRegistry(SetupInf, PointerList))
- {
- PopupError("Setup failed to update mouse registry settings.",
- "ENTER = Reboot computer");
-
- while(TRUE)
- {
- ConInKey(Ir);
-
- if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return QUIT_PAGE;
- }
- }
- }
+ /* Update the mounted devices list */
+ SetMountedDeviceValues(PartitionList);
SetStatusText(" Done...");
LayoutList = NULL;
}
- /* Destroy pointer device list */
- if (PointerList != NULL)
- {
- DestroyGenericList(PointerList, TRUE);
- PointerList = NULL;
- }
-
SetStatusText(" ENTER = Reboot computer");
while(TRUE)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
- UNICODE_STRING UnicodeString;
+ UNICODE_STRING UnicodeString = RTL_CONSTANT_STRING(L"\\ReactOSInitDone");
HANDLE ReactOSInitEvent;
- RtlRosInitUnicodeStringFromLiteral(&UnicodeString, L"\\ReactOSInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
- EVENT_ALL_ACCESS,
+ 0,
0,
NULL);
Status = NtOpenEvent(&ReactOSInitEvent,
{
/* Start page */
case START_PAGE:
- Page = StartPage(&Ir);
+ Page = SetupStartPage(&Ir);
break;
/* License page */
Page = LayoutSettingsPage(&Ir);
break;
- case POINTER_SETTINGS_PAGE:
- Page = PointerSettingsPage(&Ir);
- break;
-
case SELECT_PARTITION_PAGE:
Page = SelectPartitionPage(&Ir);
break;
/* Reboot */
FreeConsole();
NtShutdownSystem(ShutdownReboot);
+ NtTerminateProcess(NtCurrentProcess(), 0);
}
/* EOF */