Remove some code duplication when calling PopupError

Add ConAttachConsole stub

svn path=/trunk/; revision=23840
This commit is contained in:
Hervé Poussineau 2006-08-31 12:35:39 +00:00
parent 8b597b0970
commit 1ebc320243
3 changed files with 208 additions and 331 deletions

View file

@ -36,21 +36,21 @@
HANDLE StdInput = INVALID_HANDLE_VALUE; HANDLE StdInput = INVALID_HANDLE_VALUE;
HANDLE StdOutput = INVALID_HANDLE_VALUE; HANDLE StdOutput = INVALID_HANDLE_VALUE;
static SHORT xScreen = 0; SHORT xScreen = 0;
static SHORT yScreen = 0; SHORT yScreen = 0;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
#ifndef WIN32_USETUP
BOOL WINAPI BOOL WINAPI
ConAllocConsole( ConAllocConsole(VOID)
IN DWORD dwProcessId)
{ {
UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen"); UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen");
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0"); UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status; NTSTATUS Status;
CONSOLE_SCREEN_BUFFER_INFO csbi;
/* Open the screen */ /* Open the screen */
InitializeObjectAttributes( InitializeObjectAttributes(
@ -86,15 +86,16 @@ ConAllocConsole(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return FALSE; return FALSE;
if (!GetConsoleScreenBufferInfo(StdOutput, &csbi))
return FALSE;
xScreen = csbi.dwSize.X;
yScreen = csbi.dwSize.Y;
return TRUE; return TRUE;
} }
BOOL WINAPI
ConAttachConsole(
IN DWORD dwProcessId)
{
return FALSE;
}
BOOL WINAPI BOOL WINAPI
ConFreeConsole(VOID) ConFreeConsole(VOID)
{ {
@ -138,6 +139,21 @@ ConWriteConsole(
return TRUE; 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 BOOL WINAPI
ConReadConsoleInput( ConReadConsoleInput(
IN HANDLE hConsoleInput, IN HANDLE hConsoleInput,
@ -436,6 +452,8 @@ ConSetConsoleTextAttribute(
return NT_SUCCESS(Status); return NT_SUCCESS(Status);
} }
#endif /* !WIN32_USETUP */
VOID VOID
CONSOLE_ConInKey( CONSOLE_ConInKey(
OUT PINPUT_RECORD Buffer) OUT PINPUT_RECORD Buffer)

View file

@ -27,15 +27,31 @@
#ifndef __CONSOLE_H__ #ifndef __CONSOLE_H__
#define __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 WriteConsole
#undef ReadConsoleInput #undef ReadConsoleInput
#undef FillConsoleOutputCharacter #undef FillConsoleOutputCharacter
#define AllocConsole ConAllocConsole #define AllocConsole ConAllocConsole
#define AttachConsole ConAttachConsole
#define FillConsoleOutputAttribute ConFillConsoleOutputAttribute #define FillConsoleOutputAttribute ConFillConsoleOutputAttribute
#define FillConsoleOutputCharacterA ConFillConsoleOutputCharacterA #define FillConsoleOutputCharacterA ConFillConsoleOutputCharacterA
#define FreeConsole ConFreeConsole #define FreeConsole ConFreeConsole
#define GetConsoleScreenBufferInfo ConGetConsoleScreenBufferInfo #define GetConsoleScreenBufferInfo ConGetConsoleScreenBufferInfo
#define GetStdHandle ConGetStdHandle
#define ReadConsoleInput ConReadConsoleInput #define ReadConsoleInput ConReadConsoleInput
#define SetConsoleCursorInfo ConSetConsoleCursorInfo #define SetConsoleCursorInfo ConSetConsoleCursorInfo
#define SetConsoleCursorPosition ConSetConsoleCursorPosition #define SetConsoleCursorPosition ConSetConsoleCursorPosition
@ -44,15 +60,8 @@
#define WriteConsoleOutputCharacterA ConWriteConsoleOutputCharacterA #define WriteConsoleOutputCharacterA ConWriteConsoleOutputCharacterA
#define WriteConsoleOutputCharacterW ConWriteConsoleOutputCharacterW #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 BOOL WINAPI
ConAllocConsole( ConAllocConsole(VOID);
IN DWORD dwProcessId);
BOOL WINAPI BOOL WINAPI
ConFillConsoleOutputAttribute( ConFillConsoleOutputAttribute(
@ -78,6 +87,10 @@ ConGetConsoleScreenBufferInfo(
IN HANDLE hConsoleOutput, IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
HANDLE WINAPI
ConGetStdHandle(
IN DWORD nStdHandle);
BOOL WINAPI BOOL WINAPI
ConReadConsoleInput( ConReadConsoleInput(
IN HANDLE hConsoleInput, IN HANDLE hConsoleInput,
@ -124,6 +137,7 @@ ConWriteConsoleOutputCharacterA(
IN COORD dwWriteCoord, IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten); OUT LPDWORD lpNumberOfCharsWritten);
#endif /* !WIN32_USETUP */
VOID VOID
CONSOLE_ClearScreen(VOID); CONSOLE_ClearScreen(VOID);

View file

@ -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 static VOID
PopupError(PCHAR Text, PopupError(PCHAR Text,
PCHAR Status) PCHAR Status,
PINPUT_RECORD Ir,
ULONG WaitEvent)
{ {
SHORT xScreen; SHORT xScreen;
SHORT yScreen; SHORT yScreen;
@ -364,6 +370,20 @@ PopupError(PCHAR Text,
coPos, coPos,
&Written); &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" "\n"
" \x07 Press ENTER to continue Setup.\n" " \x07 Press ENTER to continue Setup.\n"
" \x07 Press F3 to quit Setup.", " \x07 Press F3 to quit Setup.",
"F3= Quit ENTER = Continue"); "F3= Quit ENTER = Continue",
NULL, POPUP_WAIT_NONE);
while(TRUE) while(TRUE)
{ {
@ -560,31 +581,17 @@ SetupStartPage(PINPUT_RECORD Ir)
{ {
CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status); CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status);
PopupError("Setup could not retrieve system drive information.\n", PopupError("Setup could not retrieve system drive information.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
while(TRUE) Ir, POPUP_WAIT_ENTER);
{ return QUIT_PAGE;
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
if (Sdi.NumberOfDisks == 0) if (Sdi.NumberOfDisks == 0)
{ {
PopupError("Setup could not find a harddisk.\n", PopupError("Setup could not find a harddisk.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
while(TRUE) Ir, POPUP_WAIT_ENTER);
{ return QUIT_PAGE;
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Get the source path and source root path */ /* Get the source path and source root path */
@ -592,24 +599,17 @@ SetupStartPage(PINPUT_RECORD Ir)
&SourceRootPath); &SourceRootPath);
if (!NT_SUCCESS(Status)) 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", PopupError("Setup could not find its source drive.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
while(TRUE) Ir, POPUP_WAIT_ENTER);
{ return QUIT_PAGE;
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
#if 0 #if 0
else else
{ {
PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath); CONSOLE_PrintTextXY(6, 15, "SourcePath: '%wZ'", &SourcePath);
PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath); CONSOLE_PrintTextXY(6, 16, "SourceRootPath: '%wZ'", &SourceRootPath);
} }
#endif #endif
@ -624,34 +624,18 @@ SetupStartPage(PINPUT_RECORD Ir)
if (SetupInf == INVALID_HANDLE_VALUE) if (SetupInf == INVALID_HANDLE_VALUE)
{ {
PopupError("Setup failed to load the file TXTSETUP.SIF.\n", PopupError("Setup failed to load the file TXTSETUP.SIF.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Open 'Version' section */ /* Open 'Version' section */
if (!SetupFindFirstLineW (SetupInf, L"Version", L"Signature", &Context)) if (!SetupFindFirstLineW (SetupInf, L"Version", L"Signature", &Context))
{ {
PopupError("Setup found a corrupt TXTSETUP.SIF.\n", PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
@ -659,34 +643,18 @@ SetupStartPage(PINPUT_RECORD Ir)
if (!INF_GetData (&Context, NULL, &Value)) if (!INF_GetData (&Context, NULL, &Value))
{ {
PopupError("Setup found a corrupt TXTSETUP.SIF.\n", PopupError("Setup found a corrupt TXTSETUP.SIF.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Check 'Signature' string */ /* Check 'Signature' string */
if (_wcsicmp(Value, L"$ReactOS$") != 0) if (_wcsicmp(Value, L"$ReactOS$") != 0)
{ {
PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n", PopupError("Setup found an invalid signature in TXTSETUP.SIF.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
CheckUnattendedSetup(); CheckUnattendedSetup();
@ -977,17 +945,9 @@ DeviceSettingsPage(PINPUT_RECORD Ir)
{ {
/* FIXME: report error */ /* FIXME: report error */
PopupError("Setup failed to load the keyboard layout list.\n", PopupError("Setup failed to load the keyboard layout list.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while (TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
} }
@ -1372,7 +1332,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
"\n" "\n"
" \x07 Press F3 to quit Setup." " \x07 Press F3 to quit Setup."
" \x07 Press ENTER to continue.", " \x07 Press ENTER to continue.",
"F3= Quit ENTER = Continue"); "F3= Quit ENTER = Continue",
NULL, POPUP_WAIT_NONE);
while (TRUE) while (TRUE)
{ {
CONSOLE_ConInKey (Ir); CONSOLE_ConInKey (Ir);
@ -1454,8 +1415,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
"of an already existing Partition!\n" "of an already existing Partition!\n"
"\n" "\n"
" * Press any key to continue.", " * Press any key to continue.",
NULL); NULL,
CONSOLE_ConInKey (Ir); Ir, POPUP_WAIT_ANY_KEY);
return SELECT_PARTITION_PAGE; return SELECT_PARTITION_PAGE;
} }
@ -1469,8 +1430,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
PopupError ("You can not delete unpartitioned disk space!\n" PopupError ("You can not delete unpartitioned disk space!\n"
"\n" "\n"
" * Press any key to continue.", " * Press any key to continue.",
NULL); NULL,
CONSOLE_ConInKey (Ir); Ir, POPUP_WAIT_ANY_KEY);
return SELECT_PARTITION_PAGE; return SELECT_PARTITION_PAGE;
} }
@ -2363,17 +2324,9 @@ FormatPartitionPage (PINPUT_RECORD Ir)
DPRINT ("WritePartitionsToDisk() failed\n"); DPRINT ("WritePartitionsToDisk() failed\n");
PopupError ("Setup failed to write partition tables.\n", PopupError ("Setup failed to write partition tables.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while (TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey (Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Set DestinationRootPath */ /* Set DestinationRootPath */
@ -2600,17 +2553,9 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
{ {
PopupError("Setup failed to find the 'SetupData' section\n" PopupError("Setup failed to find the 'SetupData' section\n"
"in TXTSETUP.SIF.\n", "in TXTSETUP.SIF.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while (TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey (Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Read the 'DefaultPath' data */ /* Read the 'DefaultPath' data */
@ -2698,17 +2643,8 @@ AddSectionToCopyQueue(HINF InfFile,
{ {
char Buffer[128]; char Buffer[128];
sprintf(Buffer, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName); sprintf(Buffer, "Setup failed to find the '%S' section\nin TXTSETUP.SIF.\n", SectionName);
PopupError(Buffer, "ENTER = Reboot computer"); PopupError(Buffer, "ENTER = Reboot computer", Ir, POPUP_WAIT_ENTER);
return(FALSE);
while(TRUE)
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(FALSE);
}
}
} }
/* /*
@ -2814,17 +2750,9 @@ PrepareCopyPageInfFile(HINF InfFile,
{ {
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status); DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
PopupError("Setup could not create the install directory.", PopupError("Setup could not create the install directory.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return(FALSE);
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(FALSE);
}
}
} }
@ -2834,23 +2762,16 @@ PrepareCopyPageInfFile(HINF InfFile,
if (SourceCabinet) if (SourceCabinet)
{ {
PopupError("Setup failed to find the 'Directories' section\n" 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 else
{ {
PopupError("Setup failed to find the 'Directories' section\n" 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);
} }
return(FALSE);
while(TRUE)
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(FALSE);
}
}
} }
/* Enumerate the directory values and create the subdirectories */ /* Enumerate the directory values and create the subdirectories */
@ -2885,17 +2806,9 @@ PrepareCopyPageInfFile(HINF InfFile,
{ {
DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status); DPRINT("Creating directory '%S' failed: Status = 0x%08lx", PathBuffer, Status);
PopupError("Setup could not create install directories.", PopupError("Setup could not create install directories.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while (TRUE) return(FALSE);
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(FALSE);
}
}
} }
} }
} }
@ -2925,17 +2838,9 @@ PrepareCopyPage(PINPUT_RECORD Ir)
if (SetupFileQueue == NULL) if (SetupFileQueue == NULL)
{ {
PopupError("Setup failed to open the copy file queue.\n", PopupError("Setup failed to open the copy file queue.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return(QUIT_PAGE);
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return(QUIT_PAGE);
}
}
} }
if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir)) if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir))
@ -2974,17 +2879,9 @@ PrepareCopyPage(PINPUT_RECORD Ir)
if (InfFileData == NULL) if (InfFileData == NULL)
{ {
PopupError("Cabinet has no setup script.\n", PopupError("Cabinet has no setup script.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
} }
else else
@ -2992,17 +2889,9 @@ PrepareCopyPage(PINPUT_RECORD Ir)
DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName()); DPRINT("Cannot open cabinet: %S.\n", CabinetGetCabinetName());
PopupError("Cabinet not found.\n", PopupError("Cabinet not found.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
InfHandle = INF_OpenBufferedFileA(InfFileData, InfHandle = INF_OpenBufferedFileA(InfFileData,
@ -3013,17 +2902,9 @@ PrepareCopyPage(PINPUT_RECORD Ir)
if (InfHandle == INVALID_HANDLE_VALUE) if (InfHandle == INVALID_HANDLE_VALUE)
{ {
PopupError("Cabinet has no valid inf file.\n", PopupError("Cabinet has no valid inf file.\n",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
CabinetCleanup(); CabinetCleanup();
@ -3126,17 +3007,9 @@ RegistryPage(PINPUT_RECORD Ir)
{ {
DPRINT("SetInstallPathValue() failed\n"); DPRINT("SetInstallPathValue() failed\n");
PopupError("Setup failed to set the initialize the registry.", PopupError("Setup failed to set the initialize the registry.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Create the default hives */ /* Create the default hives */
@ -3145,17 +3018,9 @@ RegistryPage(PINPUT_RECORD Ir)
{ {
DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status); DPRINT("NtInitializeRegistry() failed (Status %lx)\n", Status);
PopupError("Setup failed to create the registry hives.", PopupError("Setup failed to create the registry hives.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Update registry */ /* Update registry */
@ -3165,17 +3030,9 @@ RegistryPage(PINPUT_RECORD Ir)
{ {
DPRINT1("SetupFindFirstLine() failed\n"); DPRINT1("SetupFindFirstLine() failed\n");
PopupError("Setup failed to find the registry data files.", PopupError("Setup failed to find the registry data files.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
do do
@ -3206,17 +3063,9 @@ RegistryPage(PINPUT_RECORD Ir)
DPRINT("Importing %S failed\n", File); DPRINT("Importing %S failed\n", File);
PopupError("Setup failed to import a hive file.", PopupError("Setup failed to import a hive file.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
} }
while (SetupFindNextLine (&InfContext, &InfContext)); while (SetupFindNextLine (&InfContext, &InfContext));
@ -3226,17 +3075,9 @@ RegistryPage(PINPUT_RECORD Ir)
if (!ProcessDisplayRegistry(SetupInf, DisplayList)) if (!ProcessDisplayRegistry(SetupInf, DisplayList))
{ {
PopupError("Setup failed to update display registry settings.", PopupError("Setup failed to update display registry settings.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Update keyboard layout settings */ /* Update keyboard layout settings */
@ -3244,17 +3085,9 @@ RegistryPage(PINPUT_RECORD Ir)
if (!ProcessKeyboardLayoutRegistry(LayoutList)) if (!ProcessKeyboardLayoutRegistry(LayoutList))
{ {
PopupError("Setup failed to update keyboard layout settings.", PopupError("Setup failed to update keyboard layout settings.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
/* Update the mounted devices list */ /* Update the mounted devices list */
@ -3438,15 +3271,8 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir)
if (DoesFileExist(L"\\Device\\Floppy0", L"\\") == FALSE) if (DoesFileExist(L"\\Device\\Floppy0", L"\\") == FALSE)
{ {
PopupError("No disk in drive A:.", PopupError("No disk in drive A:.",
"ENTER = Continue"); "ENTER = Continue",
while(TRUE) Ir, POPUP_WAIT_ENTER);
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
break;
}
return BOOT_LOADER_FLOPPY_PAGE; return BOOT_LOADER_FLOPPY_PAGE;
} }
@ -3487,17 +3313,9 @@ BootLoaderHarddiskPage(PINPUT_RECORD Ir)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
PopupError("Setup failed to install the FAT bootcode on the system partition.", PopupError("Setup failed to install the FAT bootcode on the system partition.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
return SUCCESS_PAGE; return SUCCESS_PAGE;
@ -3505,17 +3323,9 @@ BootLoaderHarddiskPage(PINPUT_RECORD Ir)
else else
{ {
PopupError("failed to install FAT bootcode on the system partition.", PopupError("failed to install FAT bootcode on the system partition.",
"ENTER = Reboot computer"); "ENTER = Reboot computer",
Ir, POPUP_WAIT_ENTER);
while(TRUE) return QUIT_PAGE;
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return QUIT_PAGE;
}
}
} }
return BOOT_LOADER_HARDDISK_PAGE; return BOOT_LOADER_HARDDISK_PAGE;
@ -3669,22 +3479,24 @@ SignalInitEvent()
} }
VOID NTAPI static VOID
NtProcessStartup(PPEB Peb) RunUSetup(VOID)
{ {
INPUT_RECORD Ir; INPUT_RECORD Ir;
PAGE_NUMBER Page; PAGE_NUMBER Page;
BOOL ret; BOOL ret;
RtlNormalizeProcessParams(Peb->ProcessParameters);
ProcessHeap = Peb->ProcessHeap;
INF_SetHeap(ProcessHeap);
SignalInitEvent(); SignalInitEvent();
ret = AllocConsole(0); ret = AllocConsole();
if (!ret) 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("Unable to open the console\n\n");
PrintString("The most common cause of this is using an USB keyboard\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, NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
0,0,0,0,0); 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 */ /* Initialize global unicode strings */
@ -3850,4 +3672,27 @@ NtProcessStartup(PPEB Peb)
NtTerminateProcess(NtCurrentProcess(), 0); 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 */ /* EOF */