Author: hpoussin
Date: Thu Aug 31 16:35:39 2006
New Revision: 23840
URL:
http://svn.reactos.org/svn/reactos?rev=23840&view=rev
Log:
Remove some code duplication when calling PopupError
Add ConAttachConsole stub
Modified:
trunk/reactos/base/setup/usetup/console.c
trunk/reactos/base/setup/usetup/console.h
trunk/reactos/base/setup/usetup/usetup.c
Modified: trunk/reactos/base/setup/usetup/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/console.…
==============================================================================
--- trunk/reactos/base/setup/usetup/console.c (original)
+++ trunk/reactos/base/setup/usetup/console.c Thu Aug 31 16:35:39 2006
@@ -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 *****************************************************************/
-BOOL WINAPI
-ConAllocConsole(
- IN DWORD dwProcessId)
+#ifndef WIN32_USETUP
+
+BOOL WINAPI
+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,13 +86,14 @@
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
@@ -136,6 +137,21 @@
*lpNumberOfCharsWritten = IoStatusBlock.Information;
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
@@ -435,6 +451,8 @@
0);
return NT_SUCCESS(Status);
}
+
+#endif /* !WIN32_USETUP */
VOID
CONSOLE_ConInKey(
Modified: trunk/reactos/base/setup/usetup/console.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/console.…
==============================================================================
--- trunk/reactos/base/setup/usetup/console.h (original)
+++ trunk/reactos/base/setup/usetup/console.h Thu Aug 31 16:35:39 2006
@@ -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);
+BOOL WINAPI
+ConAllocConsole(VOID);
BOOL WINAPI
ConFillConsoleOutputAttribute(
@@ -77,6 +86,10 @@
ConGetConsoleScreenBufferInfo(
IN HANDLE hConsoleOutput,
OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
+
+HANDLE WINAPI
+ConGetStdHandle(
+ IN DWORD nStdHandle);
BOOL WINAPI
ConReadConsoleInput(
@@ -124,6 +137,7 @@
IN COORD dwWriteCoord,
OUT LPDWORD lpNumberOfCharsWritten);
+#endif /* !WIN32_USETUP */
VOID
CONSOLE_ClearScreen(VOID);
Modified: trunk/reactos/base/setup/usetup/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/usetup.c…
==============================================================================
--- trunk/reactos/base/setup/usetup/usetup.c (original)
+++ trunk/reactos/base/setup/usetup/usetup.c Thu Aug 31 16:35:39 2006
@@ -141,9 +141,15 @@
}
+#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 @@
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 @@
"\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,31 +581,17 @@
{
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Get the source path and source root path */
@@ -592,24 +599,17 @@
&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 */
- {
- return QUIT_PAGE;
- }
- }
+ "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,34 +624,18 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
@@ -659,34 +643,18 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
CheckUnattendedSetup();
@@ -977,17 +945,9 @@
{
/* 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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
}
@@ -1372,7 +1332,8 @@
"\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 @@
"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 @@
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,17 +2324,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Set DestinationRootPath */
@@ -2600,17 +2553,9 @@
{
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Read the 'DefaultPath' data */
@@ -2698,17 +2643,8 @@
{
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 */
- {
- return(FALSE);
- }
- }
+ PopupError(Buffer, "ENTER = Reboot computer", Ir, POPUP_WAIT_ENTER);
+ return(FALSE);
}
/*
@@ -2814,17 +2750,9 @@
{
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 */
- {
- return(FALSE);
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return(FALSE);
}
@@ -2834,23 +2762,16 @@
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);
- }
- }
+ return(FALSE);
}
/* Enumerate the directory values and create the subdirectories */
@@ -2885,17 +2806,9 @@
{
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 */
- {
- return(FALSE);
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return(FALSE);
}
}
}
@@ -2925,17 +2838,9 @@
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 */
- {
- return(QUIT_PAGE);
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return(QUIT_PAGE);
}
if (!PrepareCopyPageInfFile(SetupInf, NULL, Ir))
@@ -2974,17 +2879,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
}
else
@@ -2992,17 +2889,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
InfHandle = INF_OpenBufferedFileA(InfFileData,
@@ -3013,17 +2902,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
CabinetCleanup();
@@ -3126,17 +3007,9 @@
{
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Create the default hives */
@@ -3145,17 +3018,9 @@
{
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Update registry */
@@ -3165,17 +3030,9 @@
{
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
do
@@ -3206,17 +3063,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
}
while (SetupFindNextLine (&InfContext, &InfContext));
@@ -3226,17 +3075,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Update keyboard layout settings */
@@ -3244,17 +3085,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
/* Update the mounted devices list */
@@ -3438,15 +3271,8 @@
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,17 +3313,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
return SUCCESS_PAGE;
@@ -3505,17 +3323,9 @@
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 */
- {
- return QUIT_PAGE;
- }
- }
+ "ENTER = Reboot computer",
+ Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
}
return BOOT_LOADER_HARDDISK_PAGE;
@@ -3669,22 +3479,24 @@
}
-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");
@@ -3693,6 +3505,16 @@
/* Raise a hard error (crash the system/BSOD) */
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;
}
@@ -3850,4 +3672,27 @@
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 */