mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 07:35:10 +00:00
Remove some code duplication when calling PopupError
Add ConAttachConsole stub svn path=/trunk/; revision=23840
This commit is contained in:
parent
8b597b0970
commit
1ebc320243
|
@ -36,21 +36,21 @@
|
|||
HANDLE StdInput = INVALID_HANDLE_VALUE;
|
||||
HANDLE StdOutput = INVALID_HANDLE_VALUE;
|
||||
|
||||
static SHORT xScreen = 0;
|
||||
static SHORT yScreen = 0;
|
||||
SHORT xScreen = 0;
|
||||
SHORT yScreen = 0;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
#ifndef WIN32_USETUP
|
||||
|
||||
BOOL WINAPI
|
||||
ConAllocConsole(
|
||||
IN DWORD dwProcessId)
|
||||
ConAllocConsole(VOID)
|
||||
{
|
||||
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
|
||||
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
NTSTATUS Status;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
/* Open the screen */
|
||||
InitializeObjectAttributes(
|
||||
|
@ -86,15 +86,16 @@ ConAllocConsole(
|
|||
if (!NT_SUCCESS(Status))
|
||||
return FALSE;
|
||||
|
||||
if (!GetConsoleScreenBufferInfo(StdOutput, &csbi))
|
||||
return FALSE;
|
||||
|
||||
xScreen = csbi.dwSize.X;
|
||||
yScreen = csbi.dwSize.Y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
ConAttachConsole(
|
||||
IN DWORD dwProcessId)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
ConFreeConsole(VOID)
|
||||
{
|
||||
|
@ -138,6 +139,21 @@ ConWriteConsole(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE WINAPI
|
||||
ConGetStdHandle(
|
||||
IN DWORD nStdHandle)
|
||||
{
|
||||
switch (nStdHandle)
|
||||
{
|
||||
case STD_INPUT_HANDLE:
|
||||
return StdInput;
|
||||
case STD_OUTPUT_HANDLE:
|
||||
return StdOutput;
|
||||
default:
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
ConReadConsoleInput(
|
||||
IN HANDLE hConsoleInput,
|
||||
|
@ -436,6 +452,8 @@ ConSetConsoleTextAttribute(
|
|||
return NT_SUCCESS(Status);
|
||||
}
|
||||
|
||||
#endif /* !WIN32_USETUP */
|
||||
|
||||
VOID
|
||||
CONSOLE_ConInKey(
|
||||
OUT PINPUT_RECORD Buffer)
|
||||
|
|
|
@ -27,15 +27,31 @@
|
|||
#ifndef __CONSOLE_H__
|
||||
#define __CONSOLE_H__
|
||||
|
||||
#define FOREGROUND_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
|
||||
#define FOREGROUND_YELLOW (FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN)
|
||||
#define BACKGROUND_WHITE (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
|
||||
|
||||
extern HANDLE StdInput, StdOutput;
|
||||
extern SHORT xScreen, yScreen;
|
||||
|
||||
#ifdef WIN32_USETUP
|
||||
|
||||
#define NtDisplayString(str) printf("%S", (str)->Buffer)
|
||||
#define NtRaiseHardError(status, a, b, c, d, e) exit(1)
|
||||
|
||||
#else /* WIN32_USETUP */
|
||||
|
||||
#undef WriteConsole
|
||||
#undef ReadConsoleInput
|
||||
#undef FillConsoleOutputCharacter
|
||||
|
||||
#define AllocConsole ConAllocConsole
|
||||
#define AttachConsole ConAttachConsole
|
||||
#define FillConsoleOutputAttribute ConFillConsoleOutputAttribute
|
||||
#define FillConsoleOutputCharacterA ConFillConsoleOutputCharacterA
|
||||
#define FreeConsole ConFreeConsole
|
||||
#define GetConsoleScreenBufferInfo ConGetConsoleScreenBufferInfo
|
||||
#define GetStdHandle ConGetStdHandle
|
||||
#define ReadConsoleInput ConReadConsoleInput
|
||||
#define SetConsoleCursorInfo ConSetConsoleCursorInfo
|
||||
#define SetConsoleCursorPosition ConSetConsoleCursorPosition
|
||||
|
@ -44,15 +60,8 @@
|
|||
#define WriteConsoleOutputCharacterA ConWriteConsoleOutputCharacterA
|
||||
#define WriteConsoleOutputCharacterW ConWriteConsoleOutputCharacterW
|
||||
|
||||
#define FOREGROUND_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
|
||||
#define FOREGROUND_YELLOW (FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN)
|
||||
#define BACKGROUND_WHITE (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
|
||||
|
||||
extern HANDLE StdInput, StdOutput;
|
||||
|
||||
BOOL WINAPI
|
||||
ConAllocConsole(
|
||||
IN DWORD dwProcessId);
|
||||
ConAllocConsole(VOID);
|
||||
|
||||
BOOL WINAPI
|
||||
ConFillConsoleOutputAttribute(
|
||||
|
@ -78,6 +87,10 @@ ConGetConsoleScreenBufferInfo(
|
|||
IN HANDLE hConsoleOutput,
|
||||
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
|
||||
|
||||
HANDLE WINAPI
|
||||
ConGetStdHandle(
|
||||
IN DWORD nStdHandle);
|
||||
|
||||
BOOL WINAPI
|
||||
ConReadConsoleInput(
|
||||
IN HANDLE hConsoleInput,
|
||||
|
@ -124,6 +137,7 @@ ConWriteConsoleOutputCharacterA(
|
|||
IN COORD dwWriteCoord,
|
||||
OUT LPDWORD lpNumberOfCharsWritten);
|
||||
|
||||
#endif /* !WIN32_USETUP */
|
||||
|
||||
VOID
|
||||
CONSOLE_ClearScreen(VOID);
|
||||
|
|
|
@ -141,9 +141,15 @@ PrintString(char* fmt,...)
|
|||
}
|
||||
|
||||
|
||||
#define POPUP_WAIT_NONE 0
|
||||
#define POPUP_WAIT_ANY_KEY 1
|
||||
#define POPUP_WAIT_ENTER 2
|
||||
|
||||
static VOID
|
||||
PopupError(PCHAR Text,
|
||||
PCHAR Status)
|
||||
PCHAR Status,
|
||||
PINPUT_RECORD Ir,
|
||||
ULONG WaitEvent)
|
||||
{
|
||||
SHORT xScreen;
|
||||
SHORT yScreen;
|
||||
|
@ -364,6 +370,20 @@ PopupError(PCHAR Text,
|
|||
coPos,
|
||||
&Written);
|
||||
}
|
||||
|
||||
if (WaitEvent == POPUP_WAIT_NONE)
|
||||
return;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (WaitEvent == POPUP_WAIT_ANY_KEY
|
||||
|| Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -384,7 +404,8 @@ ConfirmQuit(PINPUT_RECORD Ir)
|
|||
"\n"
|
||||
" \x07 Press ENTER to continue Setup.\n"
|
||||
" \x07 Press F3 to quit Setup.",
|
||||
"F3= Quit ENTER = Continue");
|
||||
"F3= Quit ENTER = Continue",
|
||||
NULL, POPUP_WAIT_NONE);
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
|
@ -560,56 +581,35 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status);
|
||||
PopupError("Setup could not retrieve system drive information.\n",
|
||||
"ENTER = Reboot computer");
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Sdi.NumberOfDisks == 0)
|
||||
{
|
||||
PopupError("Setup could not find a harddisk.\n",
|
||||
"ENTER = Reboot computer");
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the source path and source root path */
|
||||
Status = GetSourcePaths(&SourcePath,
|
||||
&SourceRootPath);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CONSOLE_PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status);
|
||||
CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status);
|
||||
PopupError("Setup could not find its source drive.\n",
|
||||
"ENTER = Reboot computer");
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath);
|
||||
PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath);
|
||||
CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath);
|
||||
CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -624,70 +624,38 @@ SetupStartPage(PINPUT_RECORD Ir)
|
|||
if (SetupInf == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Open 'Version' section */
|
||||
if (!SetupFindFirstLineW (SetupInf, L"Version", L"Signature", &Context))
|
||||
{
|
||||
PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get pointer 'Signature' key */
|
||||
if (!INF_GetData (&Context, NULL, &Value))
|
||||
{
|
||||
PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check 'Signature' string */
|
||||
if (_wcsicmp(Value, L"$ReactOS$") != 0)
|
||||
{
|
||||
PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckUnattendedSetup();
|
||||
|
||||
|
@ -977,19 +945,11 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
/* FIXME: report error */
|
||||
PopupError("Setup failed to load the keyboard layout list.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CONSOLE_SetTextXY(6, 8, "The list below shows the current device settings.");
|
||||
|
||||
|
@ -1372,7 +1332,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
"\n"
|
||||
" \x07 Press F3 to quit Setup."
|
||||
" \x07 Press ENTER to continue.",
|
||||
"F3= Quit ENTER = Continue");
|
||||
"F3= Quit ENTER = Continue",
|
||||
NULL, POPUP_WAIT_NONE);
|
||||
while (TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey (Ir);
|
||||
|
@ -1454,8 +1415,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
"of an already existing Partition!\n"
|
||||
"\n"
|
||||
" * Press any key to continue.",
|
||||
NULL);
|
||||
CONSOLE_ConInKey (Ir);
|
||||
NULL,
|
||||
Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
||||
return SELECT_PARTITION_PAGE;
|
||||
}
|
||||
|
@ -1469,8 +1430,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
PopupError ("You can not delete unpartitioned disk space!\n"
|
||||
"\n"
|
||||
" * Press any key to continue.",
|
||||
NULL);
|
||||
CONSOLE_ConInKey (Ir);
|
||||
NULL,
|
||||
Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
||||
return SELECT_PARTITION_PAGE;
|
||||
}
|
||||
|
@ -2363,18 +2324,10 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
DPRINT ("WritePartitionsToDisk() failed\n");
|
||||
|
||||
PopupError ("Setup failed to write partition tables.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey (Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set DestinationRootPath */
|
||||
RtlFreeUnicodeString (&DestinationRootPath);
|
||||
|
@ -2600,18 +2553,10 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
PopupError("Setup failed to find the 'SetupData' section\n"
|
||||
"in TXTSETUP.SIF.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey (Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the 'DefaultPath' data */
|
||||
if (INF_GetData (&Context, NULL, &DefaultPath))
|
||||
|
@ -2698,18 +2643,9 @@ AddSectionToCopyQueue(HINF InfFile,
|
|||
{
|
||||
char Buffer[128];
|
||||
sprintf(Buffer, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName);
|
||||
PopupError(Buffer, "ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
PopupError(Buffer, "ENTER = Reboot computer", Ir, POPUP_WAIT_ENTER);
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Enumerate the files in the section
|
||||
|
@ -2814,18 +2750,10 @@ PrepareCopyPageInfFile(HINF InfFile,
|
|||
{
|
||||
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
|
||||
PopupError("Setup could not create the install directory.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Search for the 'Directories' section */
|
||||
|
@ -2834,24 +2762,17 @@ PrepareCopyPageInfFile(HINF InfFile,
|
|||
if (SourceCabinet)
|
||||
{
|
||||
PopupError("Setup failed to find the 'Directories' section\n"
|
||||
"in the cabinet.\n", "ENTER = Reboot computer");
|
||||
"in the cabinet.\n", "ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
PopupError("Setup failed to find the 'Directories' section\n"
|
||||
"in TXTSETUP.SIF.\n", "ENTER = Reboot computer");
|
||||
"in TXTSETUP.SIF.\n", "ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
}
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Enumerate the directory values and create the subdirectories */
|
||||
do
|
||||
|
@ -2885,20 +2806,12 @@ PrepareCopyPageInfFile(HINF InfFile,
|
|||
{
|
||||
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
|
||||
PopupError("Setup could not create install directories.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (SetupFindNextLine (&DirContext, &DirContext));
|
||||
|
||||
return(TRUE);
|
||||
|
@ -2925,18 +2838,10 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
|||
if (SetupFileQueue == NULL)
|
||||
{
|
||||
PopupError("Setup failed to open the copy file queue.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return(QUIT_PAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir))
|
||||
{
|
||||
|
@ -2974,36 +2879,20 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
|||
if (InfFileData == NULL)
|
||||
{
|
||||
PopupError("Cabinet has no setup script.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
|
||||
|
||||
PopupError("Cabinet not found.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InfHandle = INF_OpenBufferedFileA(InfFileData,
|
||||
InfFileSize,
|
||||
|
@ -3013,18 +2902,10 @@ PrepareCopyPage(PINPUT_RECORD Ir)
|
|||
if (InfHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
PopupError("Cabinet has no valid inf file.\n",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CabinetCleanup();
|
||||
|
||||
|
@ -3126,18 +3007,10 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
DPRINT("SetInstallPathValue() failed\n");
|
||||
PopupError("Setup failed to set the initialize the registry.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the default hives */
|
||||
Status = NtInitializeRegistry(TRUE);
|
||||
|
@ -3145,18 +3018,10 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status);
|
||||
PopupError("Setup failed to create the registry hives.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update registry */
|
||||
CONSOLE_SetStatusText(" Updating registry hives...");
|
||||
|
@ -3165,18 +3030,10 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
DPRINT1("SetupFindFirstLine() failed\n");
|
||||
PopupError("Setup failed to find the registry data files.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -3206,19 +3063,11 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
DPRINT("Importing %S failed\n", File);
|
||||
|
||||
PopupError("Setup failed to import a hive file.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (SetupFindNextLine (&InfContext, &InfContext));
|
||||
|
||||
/* Update display registry settings */
|
||||
|
@ -3226,36 +3075,20 @@ RegistryPage(PINPUT_RECORD Ir)
|
|||
if (!ProcessDisplayRegistry(SetupInf, DisplayList))
|
||||
{
|
||||
PopupError("Setup failed to update display registry settings.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update keyboard layout settings */
|
||||
CONSOLE_SetStatusText(" Updating keyboard layout settings...");
|
||||
if (!ProcessKeyboardLayoutRegistry(LayoutList))
|
||||
{
|
||||
PopupError("Setup failed to update keyboard layout settings.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the mounted devices list */
|
||||
SetMountedDeviceValues(PartitionList);
|
||||
|
@ -3438,15 +3271,8 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir)
|
|||
if (DoesFileExist(L"\\Device\\Floppy0", L"\\") == FALSE)
|
||||
{
|
||||
PopupError("No disk in drive A:.",
|
||||
"ENTER = Continue");
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
break;
|
||||
}
|
||||
|
||||
"ENTER = Continue",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return BOOT_LOADER_FLOPPY_PAGE;
|
||||
}
|
||||
|
||||
|
@ -3487,36 +3313,20 @@ BootLoaderHarddiskPage(PINPUT_RECORD Ir)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
PopupError("Setup failed to install the FAT bootcode on the system partition.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS_PAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
PopupError("failed to install FAT bootcode on the system partition.",
|
||||
"ENTER = Reboot computer");
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
|
||||
{
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BOOT_LOADER_HARDDISK_PAGE;
|
||||
}
|
||||
|
@ -3669,22 +3479,24 @@ SignalInitEvent()
|
|||
}
|
||||
|
||||
|
||||
VOID NTAPI
|
||||
NtProcessStartup(PPEB Peb)
|
||||
static VOID
|
||||
RunUSetup(VOID)
|
||||
{
|
||||
INPUT_RECORD Ir;
|
||||
PAGE_NUMBER Page;
|
||||
BOOL ret;
|
||||
|
||||
RtlNormalizeProcessParams(Peb->ProcessParameters);
|
||||
|
||||
ProcessHeap = Peb->ProcessHeap;
|
||||
INF_SetHeap(ProcessHeap);
|
||||
|
||||
SignalInitEvent();
|
||||
|
||||
ret = AllocConsole(0);
|
||||
if (!ret)
|
||||
ret = AllocConsole();
|
||||
if (ret)
|
||||
ret = AttachConsole(ATTACH_PARENT_PROCESS);
|
||||
|
||||
if (!ret
|
||||
#ifdef WIN32_USETUP
|
||||
&& GetLastError() != ERROR_ACCESS_DENIED
|
||||
#endif
|
||||
)
|
||||
{
|
||||
PrintString("Unable to open the console\n\n");
|
||||
PrintString("The most common cause of this is using an USB keyboard\n");
|
||||
|
@ -3694,6 +3506,16 @@ NtProcessStartup(PPEB Peb)
|
|||
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
|
||||
0,0,0,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
|
||||
StdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
StdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
GetConsoleScreenBufferInfo(StdOutput, &csbi);
|
||||
xScreen = csbi.dwSize.X;
|
||||
yScreen = csbi.dwSize.Y;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize global unicode strings */
|
||||
|
@ -3850,4 +3672,27 @@ NtProcessStartup(PPEB Peb)
|
|||
NtTerminateProcess(NtCurrentProcess(), 0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32_USETUP
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
ProcessHeap = GetProcessHeap();
|
||||
RunUSetup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
VOID NTAPI
|
||||
NtProcessStartup(PPEB Peb)
|
||||
{
|
||||
RtlNormalizeProcessParams(Peb->ProcessParameters);
|
||||
|
||||
ProcessHeap = Peb->ProcessHeap;
|
||||
INF_SetHeap(ProcessHeap);
|
||||
RunUSetup();
|
||||
}
|
||||
#endif /* !WIN32_USETUP */
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue