usetup.c
来自「一个类似windows」· C语言 代码 · 共 2,599 行 · 第 1/5 页
C
2,599 行
else if (Line == 12)
return DISPLAY_SETTINGS_PAGE;
else if (Line == 13)
return KEYBOARD_SETTINGS_PAGE;
else if (Line == 14)
return LAYOUT_SETTINGS_PAGE;
else if (Line == 16)
return SELECT_PARTITION_PAGE;
}
}
return DEVICE_SETTINGS_PAGE;
}
static PAGE_NUMBER
ComputerSettingsPage(PINPUT_RECORD Ir)
{
SHORT xScreen;
SHORT yScreen;
SetTextXY(6, 8, "You want to change the type of computer to be installed.");
SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type.");
SetTextXY(8, 11, " Then press ENTER.");
SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
SetTextXY(8, 14, " the computer type.");
GetScreenSize(&xScreen, &yScreen);
DrawGenericList(ComputerList,
2,
18,
xScreen - 3,
yScreen - 3);
SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
SaveGenericListState(ComputerList);
while(TRUE)
{
ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
ScrollDownGenericList (ComputerList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
ScrollUpGenericList (ComputerList);
}
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(ComputerList);
return DEVICE_SETTINGS_PAGE;
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return DEVICE_SETTINGS_PAGE;
}
}
return COMPUTER_SETTINGS_PAGE;
}
static PAGE_NUMBER
DisplaySettingsPage(PINPUT_RECORD Ir)
{
SHORT xScreen;
SHORT yScreen;
SetTextXY(6, 8, "You want to change the type of display to be installed.");
SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type.");
SetTextXY(8, 11, " Then press ENTER.");
SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
SetTextXY(8, 14, " the display type.");
GetScreenSize(&xScreen, &yScreen);
DrawGenericList(DisplayList,
2,
18,
xScreen - 3,
yScreen - 3);
SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
SaveGenericListState(DisplayList);
while(TRUE)
{
ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
ScrollDownGenericList (DisplayList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
ScrollUpGenericList (DisplayList);
}
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(DisplayList);
return DEVICE_SETTINGS_PAGE;
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return DEVICE_SETTINGS_PAGE;
}
}
return DISPLAY_SETTINGS_PAGE;
}
static PAGE_NUMBER
KeyboardSettingsPage(PINPUT_RECORD Ir)
{
SHORT xScreen;
SHORT yScreen;
SetTextXY(6, 8, "You want to change the type of keyboard to be installed.");
SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type.");
SetTextXY(8, 11, " Then press ENTER.");
SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
SetTextXY(8, 14, " the keyboard type.");
GetScreenSize(&xScreen, &yScreen);
DrawGenericList(KeyboardList,
2,
18,
xScreen - 3,
yScreen - 3);
SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
SaveGenericListState(KeyboardList);
while(TRUE)
{
ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
ScrollDownGenericList (KeyboardList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
ScrollUpGenericList (KeyboardList);
}
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(KeyboardList);
return DEVICE_SETTINGS_PAGE;
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return DEVICE_SETTINGS_PAGE;
}
}
return DISPLAY_SETTINGS_PAGE;
}
static PAGE_NUMBER
LayoutSettingsPage(PINPUT_RECORD Ir)
{
SHORT xScreen;
SHORT yScreen;
SetTextXY(6, 8, "You want to change the keyboard layout to be installed.");
SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard");
SetTextXY(8, 11, " layout. Then press ENTER.");
SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing");
SetTextXY(8, 14, " the keyboard layout.");
GetScreenSize(&xScreen, &yScreen);
DrawGenericList(LayoutList,
2,
18,
xScreen - 3,
yScreen - 3);
SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit");
SaveGenericListState(LayoutList);
while(TRUE)
{
ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
ScrollDownGenericList (LayoutList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
ScrollUpGenericList (LayoutList);
}
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(LayoutList);
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)
{
SHORT xScreen;
SHORT yScreen;
SetTextXY(6, 8, "The list below shows existing partitions and unused disk");
SetTextXY(6, 9, "space for new partitions.");
SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry.");
SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition.");
SetTextXY(8, 15, "\x07 Press C to create a new partition.");
SetTextXY(8, 17, "\x07 Press D to delete an existing partition.");
SetStatusText(" Please wait...");
GetScreenSize(&xScreen, &yScreen);
if (PartitionList == NULL)
{
PartitionList = CreatePartitionList (2,
19,
xScreen - 3,
yScreen - 3);
if (PartitionList == NULL)
{
/* FIXME: show an error dialog */
return QUIT_PAGE;
}
}
CheckActiveBootPartition (PartitionList);
DrawPartitionList (PartitionList);
/* Warn about partitions created by Linux Fdisk */
if (WarnLinuxPartitions == TRUE &&
CheckForLinuxFdiskPartitions (PartitionList) == TRUE)
{
PopupError ("Setup found that at least one harddisk contains an incompatible\n"
"partition table that can not be handled properly!\n"
"\n"
"Creating or deleting partitions can destroy the partiton table.\n"
"\n"
" \x07 Press F3 to quit Setup."
" \x07 Press ENTER to continue.",
"F3= Quit ENTER = Continue");
while (TRUE)
{
ConInKey (Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
{
return QUIT_PAGE;
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
{
WarnLinuxPartitions = FALSE;
return SELECT_PARTITION_PAGE;
}
}
}
if (IsUnattendedSetup)
{
SelectPartition(PartitionList,
UnattendDestinationDiskNumber,
UnattendDestinationPartitionNumber);
return(SELECT_FILE_SYSTEM_PAGE);
}
while(TRUE)
{
/* Update status text */
if (PartitionList->CurrentPartition == NULL ||
PartitionList->CurrentPartition->Unpartitioned == TRUE)
{
SetStatusText (" ENTER = Install C = Create Partition F3 = Quit");
}
else
{
SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit");
}
ConInKey(Ir);
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
{
if (ConfirmQuit(Ir) == TRUE)
{
DestroyPartitionList (PartitionList);
PartitionList = NULL;
return QUIT_PAGE;
}
break;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
ScrollDownPartitionList (PartitionList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
ScrollUpPartitionList (PartitionList);
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
{
if (PartitionList->CurrentPartition == NULL ||
PartitionList->CurrentPartition->Unpartitioned == TRUE)
{
CreateNewPartition (PartitionList,
0ULL,
TRUE);
}
return SELECT_FILE_SYSTEM_PAGE;
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */
{
if (PartitionList->CurrentPartition->Unpartitioned == FALSE)
{
PopupError ("You can not create a new Partition inside\n"
"of an already existing Partition!\n"
"\n"
" * Press any key to continue.",
NULL);
ConInKey (Ir);
return SELECT_PARTITION_PAGE;
}
return CREATE_PARTITION_PAGE;
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
{
if (PartitionList->CurrentPartition->Unpartitioned == TRUE)
{
PopupError ("You can not delete unpartitioned disk space!\n"
"\n"
" * Press any key to continue.",
NULL);
ConInKey (Ir);
return SELECT_PARTITION_PAGE;
}
return DELETE_PARTITION_PAGE;
}
}
return SELECT_PARTITION_PAGE;
}
static VOID
DrawInputField(ULONG FieldLength,
SHORT Left,
SHORT Top,
PCHAR FieldContent)
{
CHAR buf[100];
COORD coPos;
coPos.X = Left;
coPos.Y = Top;
memset(buf, '_', sizeof(buf));
buf[FieldLength - strlen(FieldContent)] = 0;
strcat(buf, FieldContent);
WriteConsoleOutputCharacters (buf,
strlen (buf),
coPos);
}
#define PARTITION_SIZE_INPUT_FIELD_LENGTH 6
static VOID
ShowPartitionSizeInputBox(SHORT Left,
SHORT Top,
SHORT Right,
SHORT Bottom,
ULONG MaxSize,
PCHAR InputBuffer,
PBOOLEAN Quit,
PBOOLEAN Cancel)
{
INPUT_RECORD Ir;
COORD coPos;
ULONG Written;
SHORT i;
CHAR Buffer[100];
ULONG Index;
CHAR ch;
SHORT iLeft;
SHORT iTop;
if (Quit != NULL)
*Quit = FALSE;
if (Cancel != NULL)
*Cancel = FALSE;
/* draw upper left corner */
coPos.X = Left;
coPos.Y = Top;
FillConsoleOutputCharacter(0xDA, // '+',
1,
coPos,
&Written);
/* draw upper edge */
coPos.X = Left + 1;
coPos.Y = Top;
FillConsoleOutputCharacter(0xC4, // '-',
Right - Left - 1,
coPos,
&Written);
/* draw upper right corner */
coPos.X = Right;
coPos.Y = Top;
FillConsoleOutputCharacter(0xBF, // '+',
1,
coPos,
&Written);
/* draw left and right edge */
for (i = Top + 1; i < Bottom; i++)
{
coPos.X = Left;
coPos.Y = i;
FillConsoleOutputCharacter(0xB3, // '|',
1,
coPos,
&Written);
coPos.X = Right;
FillConsoleOutputCharacter(0xB3, //'|',
1,
coPos,
&Written);
}
/* draw lower left corner */
coPos.X = Left;
coPos.Y = Bottom;
FillConsoleOutputCharacter(0xC0, // '+',
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?