From f52bca045bc00ecf712788a4f8788fce0b630d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Thu, 31 Aug 2006 06:14:25 +0000 Subject: [PATCH] Clean up console functions in usetup. We now have 2 categories: - The same functions as in Win32 Console API, prefixed with Con - The helpers (which call Con* functions) prefixed with CONSOLE_ Do according changes in other files svn path=/trunk/; revision=23834 --- reactos/base/setup/usetup/console.c | 1042 +++++++++++--------------- reactos/base/setup/usetup/console.h | 174 +++-- reactos/base/setup/usetup/format.c | 2 +- reactos/base/setup/usetup/fslist.c | 20 +- reactos/base/setup/usetup/genlist.c | 44 +- reactos/base/setup/usetup/partlist.c | 82 +- reactos/base/setup/usetup/progress.c | 92 ++- reactos/base/setup/usetup/usetup.c | 634 ++++++++-------- 8 files changed, 1036 insertions(+), 1054 deletions(-) diff --git a/reactos/base/setup/usetup/console.c b/reactos/base/setup/usetup/console.c index 433e804dd00..30fb93cd136 100644 --- a/reactos/base/setup/usetup/console.c +++ b/reactos/base/setup/usetup/console.c @@ -31,7 +31,6 @@ #define NDEBUG #include - /* GLOBALS ******************************************************************/ static HANDLE StdInput = INVALID_HANDLE_VALUE; @@ -40,618 +39,414 @@ static HANDLE StdOutput = INVALID_HANDLE_VALUE; static SHORT xScreen = 0; static SHORT yScreen = 0; - -NTSTATUS -ConGetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo); - - /* FUNCTIONS *****************************************************************/ - - -NTSTATUS -ConAllocConsole(VOID) +BOOL WINAPI +ConAllocConsole( + IN DWORD dwProcessId) { - 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; + 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(&ObjectAttributes, - &ScreenName, - 0, - NULL, - NULL); - Status = NtOpenFile (&StdOutput, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_ALERT); - if (!NT_SUCCESS(Status)) - return(Status); + /* Open the screen */ + InitializeObjectAttributes( + &ObjectAttributes, + &ScreenName, + 0, + NULL, + NULL); + Status = NtOpenFile( + &StdOutput, + FILE_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_ALERT); + if (!NT_SUCCESS(Status)) + return FALSE; - /* Open the keyboard */ - InitializeObjectAttributes(&ObjectAttributes, - &KeyboardName, - 0, - NULL, - NULL); - Status = NtOpenFile (&StdInput, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_ALERT); - if (!NT_SUCCESS(Status)) - return(Status); + /* Open the keyboard */ + InitializeObjectAttributes( + &ObjectAttributes, + &KeyboardName, + 0, + NULL, + NULL); + Status = NtOpenFile( + &StdInput, + FILE_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_ALERT); + if (!NT_SUCCESS(Status)) + return FALSE; - ConGetConsoleScreenBufferInfo(&csbi); + if (!GetConsoleScreenBufferInfo(StdOutput, &csbi)) + return FALSE; - xScreen = csbi.dwSize.X; - yScreen = csbi.dwSize.Y; + xScreen = csbi.dwSize.X; + yScreen = csbi.dwSize.Y; - return(Status); + return TRUE; } - -VOID +BOOL WINAPI ConFreeConsole(VOID) { - DPRINT("FreeConsole() called\n"); + DPRINT("FreeConsole() called\n"); - if (StdInput != INVALID_HANDLE_VALUE) - NtClose(StdInput); + if (StdInput != INVALID_HANDLE_VALUE) + NtClose(StdInput); - if (StdOutput != INVALID_HANDLE_VALUE) - NtClose(StdOutput); + if (StdOutput != INVALID_HANDLE_VALUE) + NtClose(StdOutput); - DPRINT("FreeConsole() done\n"); + DPRINT("FreeConsole() done\n"); + return TRUE; } - - - -NTSTATUS -ConWriteConsole(PCHAR Buffer, - ULONG NumberOfCharsToWrite, - PULONG NumberOfCharsWritten) +BOOL WINAPI +ConWriteConsole( + IN HANDLE hConsoleOutput, + IN const VOID* lpBuffer, + IN DWORD nNumberOfCharsToWrite, + OUT LPDWORD lpNumberOfCharsWritten, + IN LPVOID lpReserved) { - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status = STATUS_SUCCESS; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Status = NtWriteFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - Buffer, - NumberOfCharsToWrite, - NULL, - NULL); + Status = NtWriteFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + (PVOID)lpBuffer, + nNumberOfCharsToWrite, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + return FALSE; - if (NT_SUCCESS(Status) && NumberOfCharsWritten != NULL) - { - *NumberOfCharsWritten = IoStatusBlock.Information; - } - - return(Status); + *lpNumberOfCharsWritten = IoStatusBlock.Information; + return TRUE; } - -#if 0 -/*-------------------------------------------------------------- - * ReadConsoleA - */ -BOOL -NTAPI -ReadConsoleA(HANDLE hConsoleInput, - LPVOID lpBuffer, - DWORD nNumberOfCharsToRead, - LPDWORD lpNumberOfCharsRead, - LPVOID lpReserved) +BOOL WINAPI +ConReadConsoleInput( + IN HANDLE hConsoleInput, + OUT PINPUT_RECORD lpBuffer, + IN DWORD nLength, + OUT LPDWORD lpNumberOfEventsRead) { - KEY_EVENT_RECORD KeyEventRecord; - BOOL stat = TRUE; - PCHAR Buffer = (PCHAR)lpBuffer; - DWORD Result; - int i; + IO_STATUS_BLOCK IoStatusBlock; + KEYBOARD_INPUT_DATA InputData; + NTSTATUS Status; - for (i=0; (stat && iEventType = KEY_EVENT; + Status = NtReadFile( + hConsoleInput, + NULL, + NULL, + NULL, + &IoStatusBlock, + &InputData, + sizeof(KEYBOARD_INPUT_DATA), + NULL, + 0); + if (!NT_SUCCESS(Status)) + return FALSE; + Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent); + if (!NT_SUCCESS(Status)) + return FALSE; -NTSTATUS -ConReadConsoleInput(PINPUT_RECORD Buffer) -{ - IO_STATUS_BLOCK Iosb; - NTSTATUS Status; - KEYBOARD_INPUT_DATA InputData; - - Buffer->EventType = KEY_EVENT; - Status = NtReadFile(StdInput, - NULL, - NULL, - NULL, - &Iosb, - &InputData, - sizeof(KEYBOARD_INPUT_DATA), - NULL, - 0); - - if (NT_SUCCESS(Status)) - { - Status = IntTranslateKey(&InputData, &Buffer->Event.KeyEvent); - } - - return(Status); + *lpNumberOfEventsRead = 1; + return TRUE; } - -NTSTATUS -ConReadConsoleOutputCharacters(LPSTR lpCharacter, - ULONG nLength, - COORD dwReadCoord, - PULONG lpNumberOfCharsRead) +BOOL WINAPI +ConWriteConsoleOutputCharacterA( + HANDLE hConsoleOutput, + IN LPCSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - OUTPUT_CHARACTER Buffer; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + PCHAR Buffer; + COORD *pCoord; + PCHAR pText; + NTSTATUS Status; - Buffer.dwCoord = dwReadCoord; + Buffer = RtlAllocateHeap( + ProcessHeap, + 0, + nLength + sizeof(COORD)); + pCoord = (COORD *)Buffer; + pText = (PCHAR)(pCoord + 1); - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_READ_OUTPUT_CHARACTER, - &Buffer, - sizeof(OUTPUT_CHARACTER), - (PVOID)lpCharacter, - nLength); + *pCoord = dwWriteCoord; + memcpy(pText, lpCharacter, nLength); - if (NT_SUCCESS(Status) && lpNumberOfCharsRead != NULL) - { - *lpNumberOfCharsRead = Buffer.dwTransfered; - } + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, + NULL, + 0, + Buffer, + nLength + sizeof(COORD)); - return(Status); + RtlFreeHeap( + ProcessHeap, + 0, + Buffer); + if (!NT_SUCCESS(Status)) + return FALSE; + + *lpNumberOfCharsWritten = IoStatusBlock.Information; + return TRUE; } - -NTSTATUS -ConReadConsoleOutputAttributes(PUSHORT lpAttribute, - ULONG nLength, - COORD dwReadCoord, - PULONG lpNumberOfAttrsRead) +BOOL WINAPI +ConWriteConsoleOutputCharacterW( + HANDLE hConsoleOutput, + IN LPCWSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - OUTPUT_ATTRIBUTE Buffer; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + PCHAR Buffer; + COORD *pCoord; + PCHAR pText; + NTSTATUS Status; + ULONG i; - Buffer.dwCoord = dwReadCoord; + Buffer = RtlAllocateHeap( + ProcessHeap, + 0, + nLength + sizeof(COORD)); + pCoord = (COORD *)Buffer; + pText = (PCHAR)(pCoord + 1); - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE, - &Buffer, - sizeof(OUTPUT_ATTRIBUTE), - (PVOID)lpAttribute, - nLength); + *pCoord = dwWriteCoord; - if (NT_SUCCESS(Status) && lpNumberOfAttrsRead != NULL) - { - *lpNumberOfAttrsRead = Buffer.dwTransfered; - } + /* FIXME: use real unicode->oem conversion */ + for (i = 0; i < nLength; i++) + pText[i] = (CHAR)lpCharacter[i]; + pText[i] = 0; - return(Status); + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, + NULL, + 0, + Buffer, + nLength + sizeof(COORD)); + + RtlFreeHeap( + ProcessHeap, + 0, + Buffer); + if (!NT_SUCCESS(Status)) + return FALSE; + + *lpNumberOfCharsWritten = IoStatusBlock.Information; + return TRUE; } - -NTSTATUS -ConWriteConsoleOutputCharacters(LPCSTR lpCharacter, - ULONG nLength, - COORD dwWriteCoord) +BOOL WINAPI +ConFillConsoleOutputAttribute( + IN HANDLE hConsoleOutput, + IN WORD wAttribute, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfAttrsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - PCHAR Buffer; - COORD *pCoord; - PCHAR pText; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + OUTPUT_ATTRIBUTE Buffer; + NTSTATUS Status; - Buffer = RtlAllocateHeap(ProcessHeap, - 0, - nLength + sizeof(COORD)); - pCoord = (COORD *)Buffer; - pText = (PCHAR)(pCoord + 1); + Buffer.wAttribute = wAttribute; + Buffer.nLength = nLength; + Buffer.dwCoord = dwWriteCoord; - *pCoord = dwWriteCoord; - memcpy(pText, lpCharacter, nLength); + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE, + &Buffer, + sizeof(OUTPUT_ATTRIBUTE), + &Buffer, + sizeof(OUTPUT_ATTRIBUTE)); - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, - NULL, - 0, - Buffer, - nLength + sizeof(COORD)); + if (!NT_SUCCESS(Status)) + return FALSE; - RtlFreeHeap(ProcessHeap, - 0, - Buffer); - - return(Status); + *lpNumberOfAttrsWritten = Buffer.dwTransfered; + return TRUE; } - -NTSTATUS -ConWriteConsoleOutputCharactersW(LPCWSTR lpCharacter, - ULONG nLength, - COORD dwWriteCoord) +BOOL WINAPI +ConFillConsoleOutputCharacterA( + IN HANDLE hConsoleOutput, + IN CHAR cCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - PCHAR Buffer; - COORD *pCoord; - PCHAR pText; - NTSTATUS Status; - ULONG i; + IO_STATUS_BLOCK IoStatusBlock; + OUTPUT_CHARACTER Buffer; + NTSTATUS Status; - Buffer = RtlAllocateHeap(ProcessHeap, - 0, - nLength + sizeof(COORD)); - pCoord = (COORD *)Buffer; - pText = (PCHAR)(pCoord + 1); + Buffer.cCharacter = cCharacter; + Buffer.nLength = nLength; + Buffer.dwCoord = dwWriteCoord; - *pCoord = dwWriteCoord; + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER, + &Buffer, + sizeof(OUTPUT_CHARACTER), + &Buffer, + sizeof(OUTPUT_CHARACTER)); + if (!NT_SUCCESS(Status)) + return FALSE; - /* FIXME: use real unicode->oem conversion */ - for (i = 0; i < nLength; i++) - pText[i] = (CHAR)lpCharacter[i]; - pText[i] = 0; - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, - NULL, - 0, - Buffer, - nLength + sizeof(COORD)); - - RtlFreeHeap(ProcessHeap, - 0, - Buffer); - - return(Status); + *lpNumberOfCharsWritten = Buffer.dwTransfered; + return TRUE; } - -NTSTATUS -ConWriteConsoleOutputAttributes(CONST USHORT *lpAttribute, - ULONG nLength, - COORD dwWriteCoord, - PULONG lpNumberOfAttrsWritten) +BOOL WINAPI +ConGetConsoleScreenBufferInfo( + IN HANDLE hConsoleOutput, + OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) { - IO_STATUS_BLOCK IoStatusBlock; - PUSHORT Buffer; - COORD *pCoord; - PUSHORT pAttrib; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Buffer = RtlAllocateHeap(ProcessHeap, - 0, - nLength * sizeof(USHORT) + sizeof(COORD)); - pCoord = (COORD *)Buffer; - pAttrib = (PUSHORT)(pCoord + 1); - - *pCoord = dwWriteCoord; - memcpy(pAttrib, lpAttribute, nLength * sizeof(USHORT)); - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE, - NULL, - 0, - Buffer, - nLength * sizeof(USHORT) + sizeof(COORD)); - - RtlFreeHeap(ProcessHeap, - 0, - Buffer); - - return(Status); + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO, + NULL, + 0, + lpConsoleScreenBufferInfo, + sizeof(CONSOLE_SCREEN_BUFFER_INFO)); + return NT_SUCCESS(Status); } - -NTSTATUS -ConFillConsoleOutputAttribute(USHORT wAttribute, - ULONG nLength, - COORD dwWriteCoord, - PULONG lpNumberOfAttrsWritten) +BOOL WINAPI +ConSetConsoleCursorInfo( + IN HANDLE hConsoleOutput, + IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo) { - IO_STATUS_BLOCK IoStatusBlock; - OUTPUT_ATTRIBUTE Buffer; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Buffer.wAttribute = wAttribute; - Buffer.nLength = nLength; - Buffer.dwCoord = dwWriteCoord; - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE, - &Buffer, - sizeof(OUTPUT_ATTRIBUTE), - &Buffer, - sizeof(OUTPUT_ATTRIBUTE)); - - if (NT_SUCCESS(Status)) - { - *lpNumberOfAttrsWritten = Buffer.dwTransfered; - } - - return(Status); + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_SET_CURSOR_INFO, + (PCONSOLE_CURSOR_INFO)lpConsoleCursorInfo, + sizeof(CONSOLE_CURSOR_INFO), + NULL, + 0); + return NT_SUCCESS(Status); } - -NTSTATUS -ConFillConsoleOutputCharacter(CHAR Character, - ULONG Length, - COORD WriteCoord, - PULONG NumberOfCharsWritten) +BOOL WINAPI +ConSetConsoleCursorPosition( + IN HANDLE hConsoleOutput, + IN COORD dwCursorPosition) { - IO_STATUS_BLOCK IoStatusBlock; - OUTPUT_CHARACTER Buffer; - NTSTATUS Status; + CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Buffer.cCharacter = Character; - Buffer.nLength = Length; - Buffer.dwCoord = WriteCoord; + Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo); + if (!NT_SUCCESS(Status)) + return FALSE; - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER, - &Buffer, - sizeof(OUTPUT_CHARACTER), - &Buffer, - sizeof(OUTPUT_CHARACTER)); + ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X; + ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y; - if (NT_SUCCESS(Status)) - { - *NumberOfCharsWritten = Buffer.dwTransfered; - } + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, + &ConsoleScreenBufferInfo, + sizeof(CONSOLE_SCREEN_BUFFER_INFO), + NULL, + 0); - return(Status); + return NT_SUCCESS(Status); } - -#if 0 -/*-------------------------------------------------------------- - * GetConsoleMode - */ -WINBASEAPI -BOOL -WINAPI -GetConsoleMode( - HANDLE hConsoleHandle, - LPDWORD lpMode - ) +BOOL WINAPI +ConSetConsoleTextAttribute( + IN HANDLE hConsoleOutput, + IN WORD wAttributes) { - CONSOLE_MODE Buffer; - DWORD dwBytesReturned; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - if (DeviceIoControl (hConsoleHandle, - IOCTL_CONSOLE_GET_MODE, - NULL, - 0, - &Buffer, - sizeof(CONSOLE_MODE), - &dwBytesReturned, - NULL)) - { - *lpMode = Buffer.dwMode; - SetLastError (ERROR_SUCCESS); - return TRUE; - } - - SetLastError(0); /* FIXME: What error code? */ - return FALSE; -} - - -/*-------------------------------------------------------------- - * GetConsoleCursorInfo - */ -WINBASEAPI -BOOL -WINAPI -GetConsoleCursorInfo( - HANDLE hConsoleOutput, - PCONSOLE_CURSOR_INFO lpConsoleCursorInfo - ) -{ - DWORD dwBytesReturned; - - if (DeviceIoControl (hConsoleOutput, - IOCTL_CONSOLE_GET_CURSOR_INFO, - NULL, - 0, - lpConsoleCursorInfo, - sizeof(CONSOLE_CURSOR_INFO), - &dwBytesReturned, - NULL)) - return TRUE; - - return FALSE; -} - - -NTSTATUS -SetConsoleMode(HANDLE hConsoleHandle, - ULONG dwMode) -{ - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - CONSOLE_MODE Buffer; - - Buffer.dwMode = dwMode; - - Status = NtDeviceIoControlFile(hConsoleHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_SET_MODE, - &Buffer, - sizeof(CONSOLE_MODE), - NULL, - 0); - - return(Status); -} -#endif - - -NTSTATUS -ConGetConsoleScreenBufferInfo(PCONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo) -{ - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO, - NULL, - 0, - ConsoleScreenBufferInfo, - sizeof(CONSOLE_SCREEN_BUFFER_INFO)); - - return(Status); -} - - -NTSTATUS -ConSetConsoleCursorInfo(PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) -{ - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_SET_CURSOR_INFO, - (PCONSOLE_CURSOR_INFO)lpConsoleCursorInfo, - sizeof(CONSOLE_CURSOR_INFO), - NULL, - 0); - - return(Status); -} - - -NTSTATUS -ConSetConsoleCursorPosition(COORD dwCursorPosition) -{ - CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - Status = ConGetConsoleScreenBufferInfo(&ConsoleScreenBufferInfo); - if (!NT_SUCCESS(Status)) - return(Status); - - ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X; - ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y; - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, - &ConsoleScreenBufferInfo, - sizeof(CONSOLE_SCREEN_BUFFER_INFO), - NULL, - 0); - - return(Status); -} - - -NTSTATUS -ConSetConsoleTextAttribute(USHORT wAttributes) -{ - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - - Status = NtDeviceIoControlFile(StdOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE, - &wAttributes, - sizeof(USHORT), - NULL, - 0); - - return(Status); + Status = NtDeviceIoControlFile( + hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE, + &wAttributes, + sizeof(USHORT), + NULL, + 0); + return NT_SUCCESS(Status); } VOID -ConInKey(PINPUT_RECORD Buffer) +CONSOLE_ConInKey(PINPUT_RECORD Buffer) { + ULONG Read; while (TRUE) { - ConReadConsoleInput(Buffer); + ReadConsoleInput(StdInput, Buffer, 1, &Read); if ((Buffer->EventType == KEY_EVENT) && (Buffer->Event.KeyEvent.bKeyDown == TRUE)) @@ -661,32 +456,38 @@ ConInKey(PINPUT_RECORD Buffer) VOID -ConOutChar(CHAR c) +CONSOLE_ConOutChar(CHAR c) { ULONG Written; - ConWriteConsole(&c, + WriteConsole(StdOutput, + &c, 1, - &Written); + &Written, + NULL); } VOID -ConOutPuts(LPSTR szText) +CONSOLE_ConOutPuts(LPSTR szText) { ULONG Written; - ConWriteConsole(szText, + WriteConsole(StdOutput, + szText, strlen(szText), - &Written); - ConWriteConsole("\n", + &Written, + NULL); + WriteConsole(StdOutput, + "\n", 1, - &Written); + &Written, + NULL); } VOID -ConOutPrintf(LPSTR szFormat, ...) +CONSOLE_ConOutPrintf(LPSTR szFormat, ...) { CHAR szOut[256]; DWORD dwWritten; @@ -696,9 +497,11 @@ ConOutPrintf(LPSTR szFormat, ...) vsprintf(szOut, szFormat, arg_ptr); va_end(arg_ptr); - ConWriteConsole(szOut, + WriteConsole(StdOutput, + szOut, strlen(szOut), - &dwWritten); + &dwWritten, + NULL); } @@ -706,34 +509,34 @@ ConOutPrintf(LPSTR szFormat, ...) SHORT -GetCursorX(VOID) +CONSOLE_GetCursorX(VOID) { CONSOLE_SCREEN_BUFFER_INFO csbi; - ConGetConsoleScreenBufferInfo(&csbi); + GetConsoleScreenBufferInfo(StdOutput, &csbi); return(csbi.dwCursorPosition.X); } SHORT -GetCursorY(VOID) +CONSOLE_GetCursorY(VOID) { CONSOLE_SCREEN_BUFFER_INFO csbi; - ConGetConsoleScreenBufferInfo(&csbi); + GetConsoleScreenBufferInfo(StdOutput, &csbi); return(csbi.dwCursorPosition.Y); } VOID -GetScreenSize(SHORT *maxx, +CONSOLE_GetScreenSize(SHORT *maxx, SHORT *maxy) { CONSOLE_SCREEN_BUFFER_INFO csbi; - ConGetConsoleScreenBufferInfo(&csbi); + GetConsoleScreenBufferInfo(StdOutput, &csbi); if (maxx) *maxx = csbi.dwSize.X; @@ -744,7 +547,7 @@ GetScreenSize(SHORT *maxx, VOID -SetCursorType(BOOL bInsert, +CONSOLE_SetCursorType(BOOL bInsert, BOOL bVisible) { CONSOLE_CURSOR_INFO cci; @@ -752,45 +555,48 @@ SetCursorType(BOOL bInsert, cci.dwSize = bInsert ? 10 : 99; cci.bVisible = bVisible; - ConSetConsoleCursorInfo(&cci); + SetConsoleCursorInfo(StdOutput, &cci); } VOID -SetCursorXY(SHORT x, +CONSOLE_SetCursorXY(SHORT x, SHORT y) { COORD coPos; coPos.X = x; coPos.Y = y; - ConSetConsoleCursorPosition(coPos); + SetConsoleCursorPosition(StdOutput, coPos); } - VOID -ClearScreen(VOID) +CONSOLE_ClearScreen(VOID) { - COORD coPos; - ULONG Written; + COORD coPos; + ULONG Written; - coPos.X = 0; - coPos.Y = 0; + coPos.X = 0; + coPos.Y = 0; - FillConsoleOutputAttribute(0x17, - xScreen * yScreen, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, + xScreen * yScreen, + coPos, + &Written); - FillConsoleOutputCharacter(' ', - xScreen * yScreen, - coPos, - &Written); + FillConsoleOutputCharacterA( + StdOutput, + ' ', + xScreen * yScreen, + coPos, + &Written); } VOID -SetStatusText(char* fmt, ...) +CONSOLE_SetStatusText(char* fmt, ...) { char Buffer[128]; va_list ap; @@ -804,24 +610,28 @@ SetStatusText(char* fmt, ...) coPos.X = 0; coPos.Y = yScreen - 1; - FillConsoleOutputAttribute(0x70, + FillConsoleOutputAttribute(StdOutput, + BACKGROUND_WHITE, xScreen, coPos, &Written); - FillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', xScreen, coPos, &Written); - WriteConsoleOutputCharacters(Buffer, + WriteConsoleOutputCharacterA(StdOutput, + Buffer, strlen(Buffer), - coPos); + coPos, + &Written); } VOID -InvertTextXY(SHORT x, SHORT y, SHORT col, SHORT row) +CONSOLE_InvertTextXY(SHORT x, SHORT y, SHORT col, SHORT row) { COORD coPos; ULONG Written; @@ -830,7 +640,8 @@ InvertTextXY(SHORT x, SHORT y, SHORT col, SHORT row) { coPos.X = x; - FillConsoleOutputAttribute(0x71, + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_BLUE | BACKGROUND_WHITE, col, coPos, &Written); @@ -839,7 +650,7 @@ InvertTextXY(SHORT x, SHORT y, SHORT col, SHORT row) VOID -NormalTextXY(SHORT x, SHORT y, SHORT col, SHORT row) +CONSOLE_NormalTextXY(SHORT x, SHORT y, SHORT col, SHORT row) { COORD coPos; ULONG Written; @@ -848,7 +659,8 @@ NormalTextXY(SHORT x, SHORT y, SHORT col, SHORT row) { coPos.X = x; - FillConsoleOutputAttribute(0x17, + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_BLUE | BACKGROUND_WHITE, col, coPos, &Written); @@ -857,21 +669,24 @@ NormalTextXY(SHORT x, SHORT y, SHORT col, SHORT row) VOID -SetTextXY(SHORT x, SHORT y, PCHAR Text) +CONSOLE_SetTextXY(SHORT x, SHORT y, PCHAR Text) { COORD coPos; + ULONG Written; coPos.X = x; coPos.Y = y; - WriteConsoleOutputCharacters(Text, + WriteConsoleOutputCharacterA(StdOutput, + Text, strlen(Text), - coPos); + coPos, + &Written); } VOID -SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text) +CONSOLE_SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text) { COORD coPos; ULONG Length; @@ -886,17 +701,21 @@ SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text) Length = len - 1; } - ConFillConsoleOutputAttribute(0x70, + FillConsoleOutputAttribute(StdOutput, + BACKGROUND_WHITE, len, coPos, &Written); - ConWriteConsoleOutputCharactersW(Text, + WriteConsoleOutputCharacterW(StdOutput, + Text, Length, - coPos); + coPos, + &Written); coPos.X += Length; - ConFillConsoleOutputCharacter('_', + FillConsoleOutputCharacterA(StdOutput, + '_', 1, coPos, &Written); @@ -904,7 +723,8 @@ SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text) if ((ULONG)len > Length + 1) { coPos.X++; - ConFillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', len - Length - 1, coPos, &Written); @@ -913,7 +733,7 @@ SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text) VOID -SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text) +CONSOLE_SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text) { COORD coPos; ULONG Length; @@ -924,12 +744,15 @@ SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text) Length = strlen(Text); - ConWriteConsoleOutputCharacters(Text, + WriteConsoleOutputCharacterA(StdOutput, + Text, Length, - coPos); + coPos, + &Written); coPos.Y++; - ConFillConsoleOutputCharacter(0xCD, + FillConsoleOutputCharacterA(StdOutput, + 0xCD, Length, coPos, &Written); @@ -937,7 +760,7 @@ SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text) VOID -SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text) +CONSOLE_SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text) { COORD coPos; ULONG Length; @@ -948,19 +771,22 @@ SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text) Length = strlen(Text); - ConFillConsoleOutputAttribute(0x71, + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_BLUE | BACKGROUND_WHITE, Length, coPos, &Written); - ConWriteConsoleOutputCharacters(Text, + WriteConsoleOutputCharacterA(StdOutput, + Text, Length, - coPos); + coPos, + &Written); } VOID -SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text) +CONSOLE_SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text) { COORD coPos; ULONG Length; @@ -971,23 +797,27 @@ SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text) Length = strlen(Text); - ConFillConsoleOutputAttribute(0x1F, + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_WHITE | FOREGROUND_INTENSITY | BACKGROUND_BLUE, Length, coPos, &Written); - ConWriteConsoleOutputCharacters(Text, + WriteConsoleOutputCharacterA(StdOutput, + Text, Length, - coPos); + coPos, + &Written); } VOID -PrintTextXY(SHORT x, SHORT y, char* fmt, ...) +CONSOLE_PrintTextXY(SHORT x, SHORT y, char* fmt, ...) { char buffer[512]; va_list ap; COORD coPos; + ULONG Written; va_start(ap, fmt); vsprintf(buffer, fmt, ap); @@ -996,14 +826,16 @@ PrintTextXY(SHORT x, SHORT y, char* fmt, ...) coPos.X = x; coPos.Y = y; - ConWriteConsoleOutputCharacters(buffer, + WriteConsoleOutputCharacterA(StdOutput, + buffer, strlen(buffer), - coPos); + coPos, + &Written); } VOID -PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...) +CONSOLE_PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...) { char buffer[512]; va_list ap; @@ -1024,20 +856,22 @@ PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...) Length = len - 1; } - ConWriteConsoleOutputCharacters(buffer, + WriteConsoleOutputCharacterA(StdOutput, + buffer, Length, - coPos); + coPos, + &Written); coPos.X += Length; if ((ULONG)len > Length) { - ConFillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', len - Length, coPos, &Written); } } - /* EOF */ diff --git a/reactos/base/setup/usetup/console.h b/reactos/base/setup/usetup/console.h index d98e08fd4cb..477b5a8a140 100644 --- a/reactos/base/setup/usetup/console.h +++ b/reactos/base/setup/usetup/console.h @@ -27,127 +27,165 @@ #ifndef __CONSOLE_H__ #define __CONSOLE_H__ -#define AllocConsole ConAllocConsole -#define FreeConsole ConFreeConsole -#define ReadConsoleOutputCharacters ConReadConsoleOutputCharacters -#define ReadConsoleOutputAttributes ConReadConsoleOutputAttributes -#define WriteConsoleOutputCharacters ConWriteConsoleOutputCharacters -#define WriteConsoleOutputAttributes ConWriteConsoleOutputAttributes -#define FillConsoleOutputAttribute ConFillConsoleOutputAttribute +#undef WriteConsole +#undef ReadConsoleInput #undef FillConsoleOutputCharacter -#define FillConsoleOutputCharacter ConFillConsoleOutputCharacter -NTSTATUS -ConAllocConsole(VOID); +#define AllocConsole ConAllocConsole +#define FillConsoleOutputAttribute ConFillConsoleOutputAttribute +#define FillConsoleOutputCharacterA ConFillConsoleOutputCharacterA +#define FreeConsole ConFreeConsole +#define GetConsoleScreenBufferInfo ConGetConsoleScreenBufferInfo +#define ReadConsoleInput ConReadConsoleInput +#define SetConsoleCursorInfo ConSetConsoleCursorInfo +#define SetConsoleCursorPosition ConSetConsoleCursorPosition +#define SetConsoleTextAttribute ConSetConsoleTextAttribute +#define WriteConsole ConWriteConsole +#define WriteConsoleOutputCharacterA ConWriteConsoleOutputCharacterA +#define WriteConsoleOutputCharacterW ConWriteConsoleOutputCharacterW -VOID +#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) + +BOOL WINAPI +ConAllocConsole( + IN DWORD dwProcessId); + +BOOL WINAPI +ConFillConsoleOutputAttribute( + IN HANDLE hConsoleOutput, + IN WORD wAttribute, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfAttrsWritten); + +BOOL WINAPI +ConFillConsoleOutputCharacterA( + IN HANDLE hConsoleOutput, + IN CHAR cCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten); + +BOOL WINAPI ConFreeConsole(VOID); +BOOL WINAPI +ConGetConsoleScreenBufferInfo( + IN HANDLE hConsoleOutput, + OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); -NTSTATUS -ConReadConsoleOutputCharacters(LPSTR lpCharacter, - ULONG nLength, - COORD dwReadCoord, - PULONG lpNumberOfCharsRead); +BOOL WINAPI +ConReadConsoleInput( + IN HANDLE hConsoleInput, + OUT PINPUT_RECORD lpBuffer, + IN DWORD nLength, + OUT LPDWORD lpNumberOfEventsRead); -NTSTATUS -ConReadConsoleOutputAttributes(PUSHORT lpAttribute, - ULONG nLength, - COORD dwReadCoord, - PULONG lpNumberOfAttrsRead); +BOOL WINAPI +ConSetConsoleCursorInfo( + IN HANDLE hConsoleOutput, + IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo); -NTSTATUS -ConWriteConsoleOutputCharacters(LPCSTR lpCharacter, - ULONG nLength, - COORD dwWriteCoord); +BOOL WINAPI +ConSetConsoleCursorPosition( + IN HANDLE hConsoleOutput, + IN COORD dwCursorPosition); -NTSTATUS -ConWriteConsoleOutputAttributes(CONST USHORT *lpAttribute, - ULONG nLength, - COORD dwWriteCoord, - PULONG lpNumberOfAttrsWritten); +BOOL WINAPI +ConSetConsoleTextAttribute( + IN HANDLE hConsoleOutput, + IN WORD wAttributes); + +BOOL WINAPI +ConWriteConsole( + IN HANDLE hConsoleOutput, + IN const VOID* lpBuffer, + IN DWORD nNumberOfCharsToWrite, + OUT LPDWORD lpNumberOfCharsWritten, + IN LPVOID lpReserved); + +BOOL WINAPI +ConWriteConsoleOutputCharacterA( + HANDLE hConsoleOutput, + IN LPCSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten); + +BOOL WINAPI +ConWriteConsoleOutputCharacterA( + HANDLE hConsoleOutput, + IN LPCSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten); -NTSTATUS -ConFillConsoleOutputAttribute(USHORT wAttribute, - ULONG nLength, - COORD dwWriteCoord, - PULONG lpNumberOfAttrsWritten); -NTSTATUS -ConFillConsoleOutputCharacter(CHAR Character, - ULONG Length, - COORD WriteCoord, - PULONG NumberOfCharsWritten); -#if 0 -NTSTATUS -SetConsoleMode(HANDLE hConsoleHandle, - ULONG dwMode); -#endif VOID -ConInKey(PINPUT_RECORD Buffer); +CONSOLE_ConInKey(PINPUT_RECORD Buffer); VOID -ConOutChar(CHAR c); +CONSOLE_ConOutChar(CHAR c); VOID -ConOutPuts(LPSTR szText); +CONSOLE_ConOutPuts(LPSTR szText); VOID -ConOutPrintf(LPSTR szFormat, ...); +CONSOLE_ConOutPrintf(LPSTR szFormat, ...); SHORT -GetCursorX(VOID); +CONSOLE_GetCursorX(VOID); SHORT -GetCursorY(VOID); +CONSOLE_GetCursorY(VOID); VOID -GetScreenSize(SHORT *maxx, +CONSOLE_GetScreenSize(SHORT *maxx, SHORT *maxy); - VOID -SetCursorType(BOOL bInsert, +CONSOLE_SetCursorType(BOOL bInsert, BOOL bVisible); VOID -SetCursorXY(SHORT x, +CONSOLE_SetCursorXY(SHORT x, SHORT y); +VOID +CONSOLE_ClearScreen(VOID); VOID -ClearScreen(VOID); +CONSOLE_SetStatusText(char* fmt, ...); VOID -SetStatusText(char* fmt, ...); +CONSOLE_InvertTextXY(SHORT x, SHORT y, SHORT col, SHORT row); VOID -InvertTextXY(SHORT x, SHORT y, SHORT col, SHORT row); +CONSOLE_NormalTextXY(SHORT x, SHORT y, SHORT col, SHORT row); VOID -NormalTextXY(SHORT x, SHORT y, SHORT col, SHORT row); +CONSOLE_SetTextXY(SHORT x, SHORT y, PCHAR Text); VOID -SetTextXY(SHORT x, SHORT y, PCHAR Text); +CONSOLE_SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text); VOID -SetInputTextXY(SHORT x, SHORT y, SHORT len, PWCHAR Text); +CONSOLE_SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text); VOID -SetUnderlinedTextXY(SHORT x, SHORT y, PCHAR Text); +CONSOLE_SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text); VOID -SetInvertedTextXY(SHORT x, SHORT y, PCHAR Text); +CONSOLE_SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text); VOID -SetHighlightedTextXY(SHORT x, SHORT y, PCHAR Text); +CONSOLE_PrintTextXY(SHORT x, SHORT y, char* fmt, ...); VOID -PrintTextXY(SHORT x, SHORT y, char* fmt, ...); - -VOID -PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...); +CONSOLE_PrintTextXYN(SHORT x, SHORT y, SHORT len, char* fmt, ...); #endif /* __CONSOLE_H__*/ diff --git a/reactos/base/setup/usetup/format.c b/reactos/base/setup/usetup/format.c index af45b082eb5..f908722c89c 100644 --- a/reactos/base/setup/usetup/format.c +++ b/reactos/base/setup/usetup/format.c @@ -95,7 +95,7 @@ FormatPartition (PUNICODE_STRING DriveRoot) SHORT xScreen; SHORT yScreen; - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); ProgressBar = CreateProgressBar (6, yScreen - 14, diff --git a/reactos/base/setup/usetup/fslist.c b/reactos/base/setup/usetup/fslist.c index 0f4bf212359..5c85cd64ca5 100644 --- a/reactos/base/setup/usetup/fslist.c +++ b/reactos/base/setup/usetup/fslist.c @@ -81,24 +81,26 @@ DrawFileSystemList (PFILE_SYSTEM_LIST List) coPos.X = List->Left; coPos.Y = List->Top + Index; - FillConsoleOutputAttribute (0x17, + FillConsoleOutputAttribute (StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, 50, coPos, &Written); - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', 50, coPos, &Written); if (List->CurrentFileSystem == FsFat) { - SetInvertedTextXY (List->Left, + CONSOLE_SetInvertedTextXY (List->Left, List->Top + Index, " Format partition as FAT file system "); } else { - SetTextXY (List->Left, + CONSOLE_SetTextXY (List->Left, List->Top + Index, " Format partition as FAT file system "); } @@ -108,24 +110,26 @@ DrawFileSystemList (PFILE_SYSTEM_LIST List) { coPos.X = List->Left; coPos.Y = List->Top + Index; - FillConsoleOutputAttribute (0x17, + FillConsoleOutputAttribute (StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, 50, coPos, &Written); - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', 50, coPos, &Written); if (List->CurrentFileSystem == FsKeep) { - SetInvertedTextXY (List->Left, + CONSOLE_SetInvertedTextXY (List->Left, List->Top + Index, " Keep current file system (no changes) "); } else { - SetTextXY (List->Left, + CONSOLE_SetTextXY (List->Left, List->Top + Index, " Keep current file system (no changes) "); } diff --git a/reactos/base/setup/usetup/genlist.c b/reactos/base/setup/usetup/genlist.c index a3b23cd9d32..f00c84dd252 100644 --- a/reactos/base/setup/usetup/genlist.c +++ b/reactos/base/setup/usetup/genlist.c @@ -122,7 +122,8 @@ DrawListFrame(PGENERIC_LIST GenericList) /* Draw upper left corner */ coPos.X = GenericList->Left; coPos.Y = GenericList->Top; - FillConsoleOutputCharacter (0xDA, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xDA, // '+', 1, coPos, &Written); @@ -130,7 +131,8 @@ DrawListFrame(PGENERIC_LIST GenericList) /* Draw upper edge */ coPos.X = GenericList->Left + 1; coPos.Y = GenericList->Top; - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', GenericList->Right - GenericList->Left - 1, coPos, &Written); @@ -138,7 +140,8 @@ DrawListFrame(PGENERIC_LIST GenericList) /* Draw upper right corner */ coPos.X = GenericList->Right; coPos.Y = GenericList->Top; - FillConsoleOutputCharacter (0xBF, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xBF, // '+', 1, coPos, &Written); @@ -148,13 +151,15 @@ DrawListFrame(PGENERIC_LIST GenericList) { coPos.X = GenericList->Left; coPos.Y = i; - FillConsoleOutputCharacter (0xB3, // '|', + FillConsoleOutputCharacterA (StdOutput, + 0xB3, // '|', 1, coPos, &Written); coPos.X = GenericList->Right; - FillConsoleOutputCharacter (0xB3, //'|', + FillConsoleOutputCharacterA (StdOutput, + 0xB3, //'|', 1, coPos, &Written); @@ -163,7 +168,8 @@ DrawListFrame(PGENERIC_LIST GenericList) /* Draw lower left corner */ coPos.X = GenericList->Left; coPos.Y = GenericList->Bottom; - FillConsoleOutputCharacter (0xC0, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xC0, // '+', 1, coPos, &Written); @@ -171,7 +177,8 @@ DrawListFrame(PGENERIC_LIST GenericList) /* Draw lower edge */ coPos.X = GenericList->Left + 1; coPos.Y = GenericList->Bottom; - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', GenericList->Right - GenericList->Left - 1, coPos, &Written); @@ -179,7 +186,8 @@ DrawListFrame(PGENERIC_LIST GenericList) /* Draw lower right corner */ coPos.X = GenericList->Right; coPos.Y = GenericList->Bottom; - FillConsoleOutputCharacter (0xD9, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xD9, // '+', 1, coPos, &Written); @@ -207,20 +215,26 @@ DrawListEntries(PGENERIC_LIST GenericList) if (coPos.Y == GenericList->Bottom) break; - FillConsoleOutputAttribute ((GenericList->CurrentEntry == ListEntry) ? 0x71 : 0x17, + FillConsoleOutputAttribute (StdOutput, + (GenericList->CurrentEntry == ListEntry) ? + FOREGROUND_BLUE | BACKGROUND_WHITE : + FOREGROUND_WHITE | BACKGROUND_BLUE, Width, coPos, &Written); - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', Width, coPos, &Written); coPos.X++; - WriteConsoleOutputCharacters (ListEntry->Text, + WriteConsoleOutputCharacterA (StdOutput, + ListEntry->Text, min (strlen(ListEntry->Text), (SIZE_T)Width - 2), - coPos); + coPos, + &Written); coPos.X--; coPos.Y++; @@ -229,12 +243,14 @@ DrawListEntries(PGENERIC_LIST GenericList) while (coPos.Y < GenericList->Bottom) { - FillConsoleOutputAttribute (0x17, + FillConsoleOutputAttribute (StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, Width, coPos, &Written); - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', Width, coPos, &Written); diff --git a/reactos/base/setup/usetup/partlist.c b/reactos/base/setup/usetup/partlist.c index fa89ef50748..ca43bccc6a1 100644 --- a/reactos/base/setup/usetup/partlist.c +++ b/reactos/base/setup/usetup/partlist.c @@ -1056,12 +1056,14 @@ PrintEmptyLine (PPARTLIST List) if (List->Line >= 0 && List->Line <= Height) { - FillConsoleOutputAttribute (0x17, + FillConsoleOutputAttribute (StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, Width, coPos, &Written); - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', Width, coPos, &Written); @@ -1189,11 +1191,14 @@ PrintPartitionData (PPARTLIST List, } Attribute = (List->CurrentDisk == DiskEntry && - List->CurrentPartition == PartEntry) ? 0x71 : 0x17; + List->CurrentPartition == PartEntry) ? + FOREGROUND_BLUE | BACKGROUND_WHITE : + FOREGROUND_WHITE | BACKGROUND_BLUE; if (List->Line >= 0 && List->Line <= Height) { - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', Width, coPos, &Written); @@ -1202,7 +1207,8 @@ PrintPartitionData (PPARTLIST List, Width -= 8; if (List->Line >= 0 && List->Line <= Height) { - FillConsoleOutputAttribute (Attribute, + FillConsoleOutputAttribute (StdOutput, + Attribute, Width, coPos, &Written); @@ -1211,9 +1217,11 @@ PrintPartitionData (PPARTLIST List, Width -= 2; if (List->Line >= 0 && List->Line <= Height) { - WriteConsoleOutputCharacters (LineBuffer, + WriteConsoleOutputCharacterA (StdOutput, + LineBuffer, min (strlen (LineBuffer), Width), - coPos); + coPos, + &Written); } List->Line++; } @@ -1279,12 +1287,14 @@ PrintDiskData (PPARTLIST List, } if (List->Line >= 0 && List->Line <= Height) { - FillConsoleOutputAttribute (0x17, + FillConsoleOutputAttribute (StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, Width, coPos, &Written); - FillConsoleOutputCharacter (' ', + FillConsoleOutputCharacterA (StdOutput, + ' ', Width, coPos, &Written); @@ -1293,9 +1303,11 @@ PrintDiskData (PPARTLIST List, coPos.X++; if (List->Line >= 0 && List->Line <= Height) { - WriteConsoleOutputCharacters (LineBuffer, + WriteConsoleOutputCharacterA (StdOutput, + LineBuffer, min (strlen (LineBuffer), Width - 2), - coPos); + coPos, + &Written); } List->Line++; @@ -1397,7 +1409,8 @@ DrawPartitionList (PPARTLIST List) /* draw upper left corner */ coPos.X = List->Left; coPos.Y = List->Top; - FillConsoleOutputCharacter (0xDA, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xDA, // '+', 1, coPos, &Written); @@ -1407,23 +1420,28 @@ DrawPartitionList (PPARTLIST List) coPos.Y = List->Top; if (List->Offset == 0) { - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', List->Right - List->Left - 1, coPos, &Written); } else { - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', List->Right - List->Left - 5, coPos, &Written); coPos.X = List->Right - 5; - WriteConsoleOutputCharacters ("(\x18)", // "(up)" + WriteConsoleOutputCharacterA (StdOutput, + "(\x18)", // "(up)" 3, - coPos); + coPos, + &Written); coPos.X = List->Right - 2; - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', 2, coPos, &Written); @@ -1432,7 +1450,8 @@ DrawPartitionList (PPARTLIST List) /* draw upper right corner */ coPos.X = List->Right; coPos.Y = List->Top; - FillConsoleOutputCharacter (0xBF, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xBF, // '+', 1, coPos, &Written); @@ -1442,13 +1461,15 @@ DrawPartitionList (PPARTLIST List) { coPos.X = List->Left; coPos.Y = i; - FillConsoleOutputCharacter (0xB3, // '|', + FillConsoleOutputCharacterA (StdOutput, + 0xB3, // '|', 1, coPos, &Written); coPos.X = List->Right; - FillConsoleOutputCharacter (0xB3, //'|', + FillConsoleOutputCharacterA (StdOutput, + 0xB3, //'|', 1, coPos, &Written); @@ -1457,7 +1478,8 @@ DrawPartitionList (PPARTLIST List) /* draw lower left corner */ coPos.X = List->Left; coPos.Y = List->Bottom; - FillConsoleOutputCharacter (0xC0, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xC0, // '+', 1, coPos, &Written); @@ -1467,23 +1489,28 @@ DrawPartitionList (PPARTLIST List) coPos.Y = List->Bottom; if (LastLine - List->Offset <= List->Bottom - List->Top - 2) { - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', List->Right - List->Left - 1, coPos, &Written); } else { - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', List->Right - List->Left - 5, coPos, &Written); coPos.X = List->Right - 5; - WriteConsoleOutputCharacters ("(\x19)", // "(down)" + WriteConsoleOutputCharacterA (StdOutput, + "(\x19)", // "(down)" 3, - coPos); + coPos, + &Written); coPos.X = List->Right - 2; - FillConsoleOutputCharacter (0xC4, // '-', + FillConsoleOutputCharacterA (StdOutput, + 0xC4, // '-', 2, coPos, &Written); @@ -1492,7 +1519,8 @@ DrawPartitionList (PPARTLIST List) /* draw lower right corner */ coPos.X = List->Right; coPos.Y = List->Bottom; - FillConsoleOutputCharacter (0xD9, // '+', + FillConsoleOutputCharacterA (StdOutput, + 0xD9, // '+', 1, coPos, &Written); diff --git a/reactos/base/setup/usetup/progress.c b/reactos/base/setup/usetup/progress.c index 5b3aacd6cb8..34308bb72d1 100644 --- a/reactos/base/setup/usetup/progress.c +++ b/reactos/base/setup/usetup/progress.c @@ -19,7 +19,8 @@ DrawBorder(PPROGRESSBAR Bar) /* draw upper left corner */ coPos.X = Bar->Left; coPos.Y = Bar->Top + 1; - FillConsoleOutputCharacter(0xDA, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xDA, // '+', 1, coPos, &Written); @@ -27,7 +28,8 @@ DrawBorder(PPROGRESSBAR Bar) /* draw upper edge */ coPos.X = Bar->Left + 1; coPos.Y = Bar->Top + 1; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Bar->Right - Bar->Left - 1, coPos, &Written); @@ -35,7 +37,8 @@ DrawBorder(PPROGRESSBAR Bar) /* draw upper right corner */ coPos.X = Bar->Right; coPos.Y = Bar->Top + 1; - FillConsoleOutputCharacter(0xBF, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xBF, // '+', 1, coPos, &Written); @@ -45,13 +48,15 @@ DrawBorder(PPROGRESSBAR Bar) { coPos.X = Bar->Left; coPos.Y = i; - FillConsoleOutputCharacter(0xB3, // '|', + FillConsoleOutputCharacterA(StdOutput, + 0xB3, // '|', 1, coPos, &Written); coPos.X = Bar->Right; - FillConsoleOutputCharacter(0xB3, //'|', + FillConsoleOutputCharacterA(StdOutput, + 0xB3, //'|', 1, coPos, &Written); @@ -60,7 +65,8 @@ DrawBorder(PPROGRESSBAR Bar) /* draw lower left corner */ coPos.X = Bar->Left; coPos.Y = Bar->Bottom; - FillConsoleOutputCharacter(0xC0, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xC0, // '+', 1, coPos, &Written); @@ -68,7 +74,8 @@ DrawBorder(PPROGRESSBAR Bar) /* draw lower edge */ coPos.X = Bar->Left + 1; coPos.Y = Bar->Bottom; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Bar->Right - Bar->Left - 1, coPos, &Written); @@ -76,7 +83,8 @@ DrawBorder(PPROGRESSBAR Bar) /* draw lower right corner */ coPos.X = Bar->Right; coPos.Y = Bar->Bottom; - FillConsoleOutputCharacter(0xD9, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xD9, // '+', 1, coPos, &Written); @@ -92,7 +100,8 @@ DrawThickBorder(PPROGRESSBAR Bar) /* draw upper left corner */ coPos.X = Bar->Left; coPos.Y = Bar->Top + 1; - FillConsoleOutputCharacter(0xC9, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xC9, // '+', 1, coPos, &Written); @@ -100,7 +109,8 @@ DrawThickBorder(PPROGRESSBAR Bar) /* draw upper edge */ coPos.X = Bar->Left + 1; coPos.Y = Bar->Top + 1; - FillConsoleOutputCharacter(0xCD, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xCD, // '-', Bar->Right - Bar->Left - 1, coPos, &Written); @@ -108,7 +118,8 @@ DrawThickBorder(PPROGRESSBAR Bar) /* draw upper right corner */ coPos.X = Bar->Right; coPos.Y = Bar->Top + 1; - FillConsoleOutputCharacter(0xBB, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xBB, // '+', 1, coPos, &Written); @@ -118,13 +129,15 @@ DrawThickBorder(PPROGRESSBAR Bar) { coPos.X = Bar->Left; coPos.Y = i; - FillConsoleOutputCharacter(0xBA, // '|', + FillConsoleOutputCharacterA(StdOutput, + 0xBA, // '|', 1, coPos, &Written); coPos.X = Bar->Right; - FillConsoleOutputCharacter(0xBA, //'|', + FillConsoleOutputCharacterA(StdOutput, + 0xBA, //'|', 1, coPos, &Written); @@ -133,7 +146,8 @@ DrawThickBorder(PPROGRESSBAR Bar) /* draw lower left corner */ coPos.X = Bar->Left; coPos.Y = Bar->Bottom; - FillConsoleOutputCharacter(0xC8, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xC8, // '+', 1, coPos, &Written); @@ -141,7 +155,8 @@ DrawThickBorder(PPROGRESSBAR Bar) /* draw lower edge */ coPos.X = Bar->Left + 1; coPos.Y = Bar->Bottom; - FillConsoleOutputCharacter(0xCD, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xCD, // '-', Bar->Right - Bar->Left - 1, coPos, &Written); @@ -149,7 +164,8 @@ DrawThickBorder(PPROGRESSBAR Bar) /* draw lower right corner */ coPos.X = Bar->Right; coPos.Y = Bar->Bottom; - FillConsoleOutputCharacter(0xBC, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xBC, // '+', 1, coPos, &Written); @@ -168,15 +184,17 @@ DrawProgressBar(PPROGRESSBAR Bar) coPos.X = Bar->Left + (Bar->Width - 2) / 2; coPos.Y = Bar->Top; - WriteConsoleOutputCharacters(TextBuffer, + WriteConsoleOutputCharacterA(StdOutput, + TextBuffer, 4, - coPos); + coPos, + &Written); /* Draw the progress bar border */ DrawBorder(Bar); /* Write Text Associated with Bar */ - SetTextXY(10, 24, Bar->Text); + CONSOLE_SetTextXY(10, 24, Bar->Text); /* Draw the progress bar "border" border */ BarBorder.Top -= 5; @@ -189,12 +207,14 @@ DrawProgressBar(PPROGRESSBAR Bar) coPos.X = Bar->Left + 1; for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++) { - FillConsoleOutputAttribute(0x1E, /* Yellow on blue */ + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_YELLOW | BACKGROUND_BLUE, Bar->Width - 2, coPos, &Written); - FillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', Bar->Width - 2, coPos, &Written); @@ -285,9 +305,11 @@ ProgressNextStep(PPROGRESSBAR Bar) coPos.X = Bar->Left + (Bar->Width - 2) / 2; coPos.Y = Bar->Top; - WriteConsoleOutputCharacters(TextBuffer, + WriteConsoleOutputCharacterA(StdOutput, + TextBuffer, 4, - coPos); + coPos, + &Written); } /* Calculate bar position */ @@ -301,7 +323,8 @@ ProgressNextStep(PPROGRESSBAR Bar) for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++) { coPos.X = Bar->Left + 1; - FillConsoleOutputCharacter(0xDB, + FillConsoleOutputCharacterA(StdOutput, + 0xDB, Bar->Pos / 2, coPos, &Written); @@ -309,7 +332,8 @@ ProgressNextStep(PPROGRESSBAR Bar) if (NewPos & 1) { - FillConsoleOutputCharacter(0xDD, + FillConsoleOutputCharacterA(StdOutput, + 0xDD, 1, coPos, &Written); @@ -318,7 +342,8 @@ ProgressNextStep(PPROGRESSBAR Bar) if (coPos.X <= Bar->Right - 1) { - FillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', Bar->Right - coPos.X, coPos, &Written); @@ -355,9 +380,11 @@ ProgressSetStep (PPROGRESSBAR Bar, coPos.X = Bar->Left + (Bar->Width - 2) / 2; coPos.Y = Bar->Top; - WriteConsoleOutputCharacters(TextBuffer, + WriteConsoleOutputCharacterA(StdOutput, + TextBuffer, 4, - coPos); + coPos, + &Written); } /* Calculate bar position */ @@ -371,7 +398,8 @@ ProgressSetStep (PPROGRESSBAR Bar, for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++) { coPos.X = Bar->Left + 1; - FillConsoleOutputCharacter(0xDB, + FillConsoleOutputCharacterA(StdOutput, + 0xDB, Bar->Pos / 2, coPos, &Written); @@ -379,7 +407,8 @@ ProgressSetStep (PPROGRESSBAR Bar, if (NewPos & 1) { - FillConsoleOutputCharacter(0xDD, + FillConsoleOutputCharacterA(StdOutput, + 0xDD, 1, coPos, &Written); @@ -388,7 +417,8 @@ ProgressSetStep (PPROGRESSBAR Bar, if (coPos.X <= Bar->Right - 1) { - FillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', Bar->Right - coPos.X, coPos, &Written); diff --git a/reactos/base/setup/usetup/usetup.c b/reactos/base/setup/usetup/usetup.c index 358b556b049..f7ee27525a1 100644 --- a/reactos/base/setup/usetup/usetup.c +++ b/reactos/base/setup/usetup/usetup.c @@ -196,7 +196,7 @@ PopupError(PCHAR Text, MaxLength = Length; } - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); Width = MaxLength + 4; Height = Lines + 2; @@ -211,7 +211,8 @@ PopupError(PCHAR Text, coPos.X = xLeft; for (coPos.Y = yTop; coPos.Y < yTop + Height; coPos.Y++) { - FillConsoleOutputAttribute(0x74, + FillConsoleOutputAttribute(StdOutput, + FOREGROUND_RED | BACKGROUND_WHITE, Width, coPos, &Written); @@ -220,7 +221,8 @@ PopupError(PCHAR Text, /* draw upper left corner */ coPos.X = xLeft; coPos.Y = yTop; - FillConsoleOutputCharacter(0xDA, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xDA, // '+', 1, coPos, &Written); @@ -228,7 +230,8 @@ PopupError(PCHAR Text, /* draw upper edge */ coPos.X = xLeft + 1; coPos.Y = yTop; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Width - 2, coPos, &Written); @@ -236,7 +239,8 @@ PopupError(PCHAR Text, /* draw upper right corner */ coPos.X = xLeft + Width - 1; coPos.Y = yTop; - FillConsoleOutputCharacter(0xBF, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xBF, // '+', 1, coPos, &Written); @@ -245,19 +249,22 @@ PopupError(PCHAR Text, for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++) { coPos.X = xLeft; - FillConsoleOutputCharacter(0xB3, // '|', + FillConsoleOutputCharacterA(StdOutput, + 0xB3, // '|', 1, coPos, &Written); coPos.X = xLeft + 1; - FillConsoleOutputCharacter(' ', + FillConsoleOutputCharacterA(StdOutput, + ' ', Width - 2, coPos, &Written); coPos.X = xLeft + Width - 1; - FillConsoleOutputCharacter(0xB3, // '|', + FillConsoleOutputCharacterA(StdOutput, + 0xB3, // '|', 1, coPos, &Written); @@ -266,7 +273,8 @@ PopupError(PCHAR Text, /* draw lower left corner */ coPos.X = xLeft; coPos.Y = yTop + Height - 1; - FillConsoleOutputCharacter(0xC0, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xC0, // '+', 1, coPos, &Written); @@ -274,7 +282,8 @@ PopupError(PCHAR Text, /* draw lower edge */ coPos.X = xLeft + 1; coPos.Y = yTop + Height - 1; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Width - 2, coPos, &Written); @@ -282,7 +291,8 @@ PopupError(PCHAR Text, /* draw lower right corner */ coPos.X = xLeft + Width - 1; coPos.Y = yTop + Height - 1; - FillConsoleOutputCharacter(0xD9, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xD9, // '+', 1, coPos, &Written); @@ -307,9 +317,11 @@ PopupError(PCHAR Text, if (Length != 0) { coPos.X = xLeft + 2; - WriteConsoleOutputCharacters(pnext, + WriteConsoleOutputCharacterA(StdOutput, + pnext, Length, - coPos); + coPos, + &Written); } if (LastLine == TRUE) @@ -324,28 +336,33 @@ PopupError(PCHAR Text, { coPos.Y = yTop + Height - 3; coPos.X = xLeft; - FillConsoleOutputCharacter(0xC3, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xC3, // '+', 1, coPos, &Written); coPos.X = xLeft + 1; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Width - 2, coPos, &Written); coPos.X = xLeft + Width - 1; - FillConsoleOutputCharacter(0xB4, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xB4, // '+', 1, coPos, &Written); coPos.Y++; coPos.X = xLeft + 2; - WriteConsoleOutputCharacters(Status, + WriteConsoleOutputCharacterA(StdOutput, + Status, min(strlen(Status), (SIZE_T)Width - 4), - coPos); + coPos, + &Written); } } @@ -371,7 +388,7 @@ ConfirmQuit(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -551,7 +568,7 @@ SetupStartPage(PINPUT_RECORD Ir) ULONG ErrorLine; ULONG ReturnSize; - SetStatusText(" Please wait..."); + CONSOLE_SetStatusText(" Please wait..."); /* Check whether a harddisk is available */ @@ -561,12 +578,12 @@ SetupStartPage(PINPUT_RECORD Ir) &ReturnSize); if (!NT_SUCCESS (Status)) { - 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", "ENTER = Reboot computer"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -581,7 +598,7 @@ SetupStartPage(PINPUT_RECORD Ir) "ENTER = Reboot computer"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -595,12 +612,12 @@ SetupStartPage(PINPUT_RECORD Ir) &SourceRootPath); if (!NT_SUCCESS(Status)) { - PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status); + CONSOLE_PrintTextXY(6, 15, "GetSourcePath() failed (Status 0x%08lx)", Status); PopupError("Setup could not find its source drive.\n", "ENTER = Reboot computer"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -632,7 +649,7 @@ SetupStartPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -649,7 +666,7 @@ SetupStartPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -668,7 +685,7 @@ SetupStartPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -686,7 +703,7 @@ SetupStartPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -710,20 +727,20 @@ SetupStartPage(PINPUT_RECORD Ir) static PAGE_NUMBER IntroPage(PINPUT_RECORD Ir) { - SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup"); + CONSOLE_SetHighlightedTextXY(6, 8, "Welcome to ReactOS Setup"); - SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your"); - SetTextXY(6, 12, "computer and prepares the second part of the setup."); + CONSOLE_SetTextXY(6, 11, "This part of the setup copies the ReactOS Operating System to your"); + CONSOLE_SetTextXY(6, 12, "computer and prepares the second part of the setup."); - SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS."); - SetTextXY(8, 17, "\x07 Press R to repair ReactOS."); - SetTextXY(8, 19, "\x07 Press L to view the ReactOS Licensing Terms and Conditions"); - SetTextXY(8, 21, "\x07 Press F3 to quit without installing ReactOS."); + CONSOLE_SetTextXY(8, 15, "\x07 Press ENTER to install ReactOS."); + CONSOLE_SetTextXY(8, 17, "\x07 Press R to repair ReactOS."); + CONSOLE_SetTextXY(8, 19, "\x07 Press L to view the ReactOS Licensing Terms and Conditions"); + CONSOLE_SetTextXY(8, 21, "\x07 Press F3 to quit without installing ReactOS."); - SetTextXY(6, 23, "For more information on ReactOS, please visit:"); - SetHighlightedTextXY(6, 24, "http://www.reactos.org"); + CONSOLE_SetTextXY(6, 23, "For more information on ReactOS, please visit:"); + CONSOLE_SetHighlightedTextXY(6, 24, "http://www.reactos.org"); - SetStatusText(" ENTER = Continue R = Repair F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue R = Repair F3 = Quit"); if (IsUnattendedSetup) { @@ -738,7 +755,7 @@ IntroPage(PINPUT_RECORD Ir) while (TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -775,34 +792,34 @@ IntroPage(PINPUT_RECORD Ir) static PAGE_NUMBER LicensePage(PINPUT_RECORD Ir) { - SetHighlightedTextXY(6, 6, "Licensing:"); + CONSOLE_SetHighlightedTextXY(6, 6, "Licensing:"); - SetTextXY(8, 8, "The ReactOS System is licensed under the terms of the"); - SetTextXY(8, 9, "GNU GPL with parts containing code from other compatible"); - SetTextXY(8, 10, "licenses such as the X11 or BSD and GNU LGPL licenses."); - SetTextXY(8, 11, "All software that is part of the ReactOS system is"); - SetTextXY(8, 12, "therefore released under the GNU GPL as well as maintaining"); - SetTextXY(8, 13, "the original license."); + CONSOLE_SetTextXY(8, 8, "The ReactOS System is licensed under the terms of the"); + CONSOLE_SetTextXY(8, 9, "GNU GPL with parts containing code from other compatible"); + CONSOLE_SetTextXY(8, 10, "licenses such as the X11 or BSD and GNU LGPL licenses."); + CONSOLE_SetTextXY(8, 11, "All software that is part of the ReactOS system is"); + CONSOLE_SetTextXY(8, 12, "therefore released under the GNU GPL as well as maintaining"); + CONSOLE_SetTextXY(8, 13, "the original license."); - SetTextXY(8, 15, "This software comes with NO WARRANTY or restrictions on usage"); - SetTextXY(8, 16, "save applicable local and international law. The licensing of"); - SetTextXY(8, 17, "ReactOS only covers distribution to third parties."); + CONSOLE_SetTextXY(8, 15, "This software comes with NO WARRANTY or restrictions on usage"); + CONSOLE_SetTextXY(8, 16, "save applicable local and international law. The licensing of"); + CONSOLE_SetTextXY(8, 17, "ReactOS only covers distribution to third parties."); - SetTextXY(8, 18, "If for some reason you did not receive a copy of the"); - SetTextXY(8, 19, "GNU General Public License with ReactOS please visit"); - SetHighlightedTextXY(8, 20, "http://www.gnu.org/licenses/licenses.html"); + CONSOLE_SetTextXY(8, 18, "If for some reason you did not receive a copy of the"); + CONSOLE_SetTextXY(8, 19, "GNU General Public License with ReactOS please visit"); + CONSOLE_SetHighlightedTextXY(8, 20, "http://www.gnu.org/licenses/licenses.html"); - SetHighlightedTextXY(6, 22, "Warranty:"); + CONSOLE_SetHighlightedTextXY(6, 22, "Warranty:"); - SetTextXY(8, 24, "This is free software; see the source for copying conditions."); - SetTextXY(8, 25, "There is NO warranty; not even for MERCHANTABILITY or"); - SetTextXY(8, 26, "FITNESS FOR A PARTICULAR PURPOSE"); + CONSOLE_SetTextXY(8, 24, "This is free software; see the source for copying conditions."); + CONSOLE_SetTextXY(8, 25, "There is NO warranty; not even for MERCHANTABILITY or"); + CONSOLE_SetTextXY(8, 26, "FITNESS FOR A PARTICULAR PURPOSE"); - SetStatusText(" ENTER = Return"); + CONSOLE_SetStatusText(" ENTER = Return"); while (TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -817,22 +834,22 @@ LicensePage(PINPUT_RECORD Ir) static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir) { - SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); - SetTextXY(6, 9, "support all the functions of a fully usable setup application."); + CONSOLE_SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); + CONSOLE_SetTextXY(6, 9, "support all the functions of a fully usable setup application."); - SetTextXY(6, 12, "The repair functions are not implemented yet."); + CONSOLE_SetTextXY(6, 12, "The repair functions are not implemented yet."); - SetTextXY(8, 15, "\x07 Press R for the Recovery Console."); + CONSOLE_SetTextXY(8, 15, "\x07 Press R for the Recovery Console."); - SetTextXY(8, 17, "\x07 Press ESC to return to the main page."); + CONSOLE_SetTextXY(8, 17, "\x07 Press ESC to return to the main page."); - SetTextXY(8, 19, "\x07 Press ENTER to reboot your computer."); + CONSOLE_SetTextXY(8, 19, "\x07 Press ENTER to reboot your computer."); - SetStatusText(" ESC = Main page ENTER = Reboot"); + CONSOLE_SetStatusText(" ESC = Main page ENTER = Reboot"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -856,27 +873,27 @@ RepairIntroPage(PINPUT_RECORD Ir) static PAGE_NUMBER InstallIntroPage(PINPUT_RECORD Ir) { - SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); + CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); - SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); - SetTextXY(6, 9, "support all the functions of a fully usable setup application."); + CONSOLE_SetTextXY(6, 8, "ReactOS Setup is in an early development phase. It does not yet"); + CONSOLE_SetTextXY(6, 9, "support all the functions of a fully usable setup application."); - SetTextXY(6, 12, "The following limitations apply:"); - SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk."); - SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk"); - SetTextXY(8, 15, " as long as extended partitions exist on this disk."); - SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk"); - SetTextXY(8, 17, " as long as other extended partitions exist on this disk."); - SetTextXY(8, 18, "- Setup supports FAT file systems only."); - SetTextXY(8, 19, "- File system checks are not implemented yet."); + CONSOLE_SetTextXY(6, 12, "The following limitations apply:"); + CONSOLE_SetTextXY(8, 13, "- Setup can not handle more than one primary partition per disk."); + CONSOLE_SetTextXY(8, 14, "- Setup can not delete a primary partition from a disk"); + CONSOLE_SetTextXY(8, 15, " as long as extended partitions exist on this disk."); + CONSOLE_SetTextXY(8, 16, "- Setup can not delete the first extended partition from a disk"); + CONSOLE_SetTextXY(8, 17, " as long as other extended partitions exist on this disk."); + CONSOLE_SetTextXY(8, 18, "- Setup supports FAT file systems only."); + CONSOLE_SetTextXY(8, 19, "- File system checks are not implemented yet."); - SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS."); + CONSOLE_SetTextXY(8, 23, "\x07 Press ENTER to install ReactOS."); - SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS."); + CONSOLE_SetTextXY(8, 25, "\x07 Press F3 to quit without installing ReactOS."); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); if (IsUnattendedSetup) { @@ -885,7 +902,7 @@ InstallIntroPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -988,7 +1005,7 @@ DeviceSettingsPage(PINPUT_RECORD Ir) while (TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -998,60 +1015,60 @@ DeviceSettingsPage(PINPUT_RECORD Ir) } } - SetTextXY(6, 8, "The list below shows the current device settings."); + CONSOLE_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:"); + CONSOLE_SetTextXY(8, 11, " Computer:"); + CONSOLE_SetTextXY(8, 12, " Display:"); + CONSOLE_SetTextXY(8, 13, " Keyboard:"); + CONSOLE_SetTextXY(8, 14, "Keyboard layout:"); - SetTextXY(8, 16, " Accept:"); + CONSOLE_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); + CONSOLE_SetTextXY(25, 11, GetGenericListEntry(ComputerList)->Text); + CONSOLE_SetTextXY(25, 12, GetGenericListEntry(DisplayList)->Text); + CONSOLE_SetTextXY(25, 13, GetGenericListEntry(KeyboardList)->Text); + CONSOLE_SetTextXY(25, 14, GetGenericListEntry(LayoutList)->Text); - SetTextXY(25, 16, "Accept these device settings"); - InvertTextXY (24, Line, 48, 1); + CONSOLE_SetTextXY(25, 16, "Accept these device settings"); + CONSOLE_InvertTextXY (24, Line, 48, 1); - 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."); + CONSOLE_SetTextXY(6, 19, "You can change the hardware settings by pressing the UP or DOWN keys"); + CONSOLE_SetTextXY(6, 20, "to select an entry. Then press the ENTER key to select alternative"); + CONSOLE_SetTextXY(6, 21, "settings."); - SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\""); - SetTextXY(6, 24, "and press ENTER."); + CONSOLE_SetTextXY(6, 23, "When all settings are correct, select \"Accept these device settings\""); + CONSOLE_SetTextXY(6, 24, "and press ENTER."); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - NormalTextXY (24, Line, 48, 1); + CONSOLE_NormalTextXY (24, Line, 48, 1); if (Line == 14) Line = 16; else if (Line == 16) Line = 11; else Line++; - InvertTextXY (24, Line, 48, 1); + CONSOLE_InvertTextXY (24, Line, 48, 1); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - NormalTextXY (24, Line, 48, 1); + CONSOLE_NormalTextXY (24, Line, 48, 1); if (Line == 11) Line = 16; else if (Line == 16) Line = 14; else Line--; - InvertTextXY (24, Line, 48, 1); + CONSOLE_InvertTextXY (24, Line, 48, 1); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1085,15 +1102,15 @@ ComputerSettingsPage(PINPUT_RECORD Ir) SHORT xScreen; SHORT yScreen; - SetTextXY(6, 8, "You want to change the type of computer to be installed."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired computer type."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); + CONSOLE_SetTextXY(8, 14, " the computer type."); - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); DrawGenericList(ComputerList, 2, @@ -1101,13 +1118,13 @@ ComputerSettingsPage(PINPUT_RECORD Ir) xScreen - 3, yScreen - 3); - SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); SaveGenericListState(ComputerList); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ @@ -1148,15 +1165,15 @@ DisplaySettingsPage(PINPUT_RECORD Ir) SHORT xScreen; SHORT yScreen; - SetTextXY(6, 8, "You want to change the type of display to be installed."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired display type."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); + CONSOLE_SetTextXY(8, 14, " the display type."); - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); DrawGenericList(DisplayList, 2, @@ -1164,13 +1181,13 @@ DisplaySettingsPage(PINPUT_RECORD Ir) xScreen - 3, yScreen - 3); - SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); SaveGenericListState(DisplayList); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ @@ -1213,15 +1230,15 @@ KeyboardSettingsPage(PINPUT_RECORD Ir) SHORT xScreen; SHORT yScreen; - SetTextXY(6, 8, "You want to change the type of keyboard to be installed."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard type."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); + CONSOLE_SetTextXY(8, 14, " the keyboard type."); - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); DrawGenericList(KeyboardList, 2, @@ -1229,13 +1246,13 @@ KeyboardSettingsPage(PINPUT_RECORD Ir) xScreen - 3, yScreen - 3); - SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); SaveGenericListState(KeyboardList); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ @@ -1276,15 +1293,15 @@ LayoutSettingsPage(PINPUT_RECORD Ir) SHORT xScreen; SHORT yScreen; - SetTextXY(6, 8, "You want to change the keyboard layout to be installed."); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 10, "\x07 Press the UP or DOWN key to select the desired keyboard"); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 13, "\x07 Press the ESC key to return to the previous page without changing"); + CONSOLE_SetTextXY(8, 14, " the keyboard layout."); - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); DrawGenericList(LayoutList, 2, @@ -1292,13 +1309,13 @@ LayoutSettingsPage(PINPUT_RECORD Ir) xScreen - 3, yScreen - 3); - SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue ESC = Cancel F3 = Quit"); SaveGenericListState(LayoutList); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ @@ -1339,17 +1356,17 @@ 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."); + CONSOLE_SetTextXY(6, 8, "The list below shows existing partitions and unused disk"); + CONSOLE_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."); + CONSOLE_SetTextXY(8, 11, "\x07 Press UP or DOWN to select a list entry."); + CONSOLE_SetTextXY(8, 13, "\x07 Press ENTER to install ReactOS onto the selected partition."); + CONSOLE_SetTextXY(8, 15, "\x07 Press C to create a new partition."); + CONSOLE_SetTextXY(8, 17, "\x07 Press D to delete an existing partition."); - SetStatusText(" Please wait..."); + CONSOLE_SetStatusText(" Please wait..."); - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); if (PartitionList == NULL) { @@ -1382,7 +1399,7 @@ SelectPartitionPage(PINPUT_RECORD Ir) "F3= Quit ENTER = Continue"); while (TRUE) { - ConInKey (Ir); + CONSOLE_ConInKey (Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1411,14 +1428,14 @@ SelectPartitionPage(PINPUT_RECORD Ir) if (PartitionList->CurrentPartition == NULL || PartitionList->CurrentPartition->Unpartitioned == TRUE) { - SetStatusText (" ENTER = Install C = Create Partition F3 = Quit"); + CONSOLE_SetStatusText (" ENTER = Install C = Create Partition F3 = Quit"); } else { - SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit"); + CONSOLE_SetStatusText (" ENTER = Install D = Delete Partition F3 = Quit"); } - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1462,7 +1479,7 @@ SelectPartitionPage(PINPUT_RECORD Ir) "\n" " * Press any key to continue.", NULL); - ConInKey (Ir); + CONSOLE_ConInKey (Ir); return SELECT_PARTITION_PAGE; } @@ -1477,7 +1494,7 @@ SelectPartitionPage(PINPUT_RECORD Ir) "\n" " * Press any key to continue.", NULL); - ConInKey (Ir); + CONSOLE_ConInKey (Ir); return SELECT_PARTITION_PAGE; } @@ -1498,6 +1515,7 @@ DrawInputField(ULONG FieldLength, { CHAR buf[100]; COORD coPos; + ULONG Written; coPos.X = Left; coPos.Y = Top; @@ -1505,9 +1523,11 @@ DrawInputField(ULONG FieldLength, buf[FieldLength - strlen(FieldContent)] = 0; strcat(buf, FieldContent); - WriteConsoleOutputCharacters (buf, + WriteConsoleOutputCharacterA (StdOutput, + buf, strlen (buf), - coPos); + coPos, + &Written); } @@ -1542,7 +1562,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* draw upper left corner */ coPos.X = Left; coPos.Y = Top; - FillConsoleOutputCharacter(0xDA, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xDA, // '+', 1, coPos, &Written); @@ -1550,7 +1571,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* draw upper edge */ coPos.X = Left + 1; coPos.Y = Top; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Right - Left - 1, coPos, &Written); @@ -1558,7 +1580,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* draw upper right corner */ coPos.X = Right; coPos.Y = Top; - FillConsoleOutputCharacter(0xBF, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xBF, // '+', 1, coPos, &Written); @@ -1568,13 +1591,15 @@ ShowPartitionSizeInputBox(SHORT Left, { coPos.X = Left; coPos.Y = i; - FillConsoleOutputCharacter(0xB3, // '|', + FillConsoleOutputCharacterA(StdOutput, + 0xB3, // '|', 1, coPos, &Written); coPos.X = Right; - FillConsoleOutputCharacter(0xB3, //'|', + FillConsoleOutputCharacterA(StdOutput, + 0xB3, //'|', 1, coPos, &Written); @@ -1583,7 +1608,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* draw lower left corner */ coPos.X = Left; coPos.Y = Bottom; - FillConsoleOutputCharacter(0xC0, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xC0, // '+', 1, coPos, &Written); @@ -1591,7 +1617,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* draw lower edge */ coPos.X = Left + 1; coPos.Y = Bottom; - FillConsoleOutputCharacter(0xC4, // '-', + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', Right - Left - 1, coPos, &Written); @@ -1599,7 +1626,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* draw lower right corner */ coPos.X = Right; coPos.Y = Bottom; - FillConsoleOutputCharacter(0xD9, // '+', + FillConsoleOutputCharacterA(StdOutput, + 0xD9, // '+', 1, coPos, &Written); @@ -1610,16 +1638,20 @@ ShowPartitionSizeInputBox(SHORT Left, strcpy (Buffer, "Size of new partition:"); iLeft = coPos.X + strlen (Buffer) + 1; iTop = coPos.Y; - WriteConsoleOutputCharacters (Buffer, + WriteConsoleOutputCharacterA (StdOutput, + Buffer, strlen (Buffer), - coPos); + coPos, + &Written); sprintf (Buffer, "MB (max. %lu MB)", MaxSize); coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1; coPos.Y = iTop; - WriteConsoleOutputCharacters (Buffer, + WriteConsoleOutputCharacterA (StdOutput, + Buffer, strlen (Buffer), - coPos); + coPos, + &Written); sprintf(Buffer, "%lu", MaxSize); Index = strlen(Buffer); @@ -1630,7 +1662,7 @@ ShowPartitionSizeInputBox(SHORT Left, while (TRUE) { - ConInKey (&Ir); + CONSOLE_ConInKey (&Ir); if ((Ir.Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir.Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1709,11 +1741,11 @@ CreatePartitionPage (PINPUT_RECORD Ir) DiskEntry = PartitionList->CurrentDisk; PartEntry = PartitionList->CurrentPartition; - SetStatusText (" Please wait..."); + CONSOLE_SetStatusText (" Please wait..."); - GetScreenSize (&xScreen, &yScreen); + CONSOLE_GetScreenSize (&xScreen, &yScreen); - SetTextXY (6, 8, "You have chosen to create a new partition on"); + CONSOLE_SetTextXY (6, 8, "You have chosen to create a new partition on"); #if 0 if (DiskEntry->DiskSize >= 0x280000000ULL) /* 10 GB */ @@ -1732,7 +1764,7 @@ CreatePartitionPage (PINPUT_RECORD Ir) if (DiskEntry->DriverName.Length > 0) { - PrintTextXY (6, 10, + CONSOLE_PrintTextXY (6, 10, "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.", DiskSize, Unit, @@ -1744,7 +1776,7 @@ CreatePartitionPage (PINPUT_RECORD Ir) } else { - PrintTextXY (6, 10, + CONSOLE_PrintTextXY (6, 10, "%I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).", DiskSize, Unit, @@ -1755,14 +1787,14 @@ CreatePartitionPage (PINPUT_RECORD Ir) } - SetTextXY (6, 12, "Please enter the size of the new partition in megabytes."); + CONSOLE_SetTextXY (6, 12, "Please enter the size of the new partition in megabytes."); #if 0 - PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB", + CONSOLE_PrintTextXY (8, 10, "Maximum size of the new partition is %I64u MB", PartitionList->CurrentPartition->UnpartitionedLength / (1024*1024)); #endif - SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText (" ENTER = Create Partition ESC = Cancel F3 = Quit"); PartEntry = PartitionList->CurrentPartition; while (TRUE) @@ -1848,7 +1880,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) DiskEntry = PartitionList->CurrentDisk; PartEntry = PartitionList->CurrentPartition; - SetTextXY (6, 8, "You have chosen to delete the partition"); + CONSOLE_SetTextXY (6, 8, "You have chosen to delete the partition"); /* Determine partition type */ PartType = NULL; @@ -1897,7 +1929,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) if (PartType == NULL) { - PrintTextXY (6, 10, + CONSOLE_PrintTextXY (6, 10, " %c%c Type %lu %I64u %s", (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter, (PartEntry->DriveLetter == 0) ? '-' : ':', @@ -1907,7 +1939,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) } else { - PrintTextXY (6, 10, + CONSOLE_PrintTextXY (6, 10, " %c%c %s %I64u %s", (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter, (PartEntry->DriveLetter == 0) ? '-' : ':', @@ -1933,7 +1965,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) if (DiskEntry->DriverName.Length > 0) { - PrintTextXY (6, 12, + CONSOLE_PrintTextXY (6, 12, "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu) on %wZ.", DiskSize, Unit, @@ -1945,7 +1977,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) } else { - PrintTextXY (6, 12, + CONSOLE_PrintTextXY (6, 12, "on %I64u %s Harddisk %lu (Port=%hu, Bus=%hu, Id=%hu).", DiskSize, Unit, @@ -1955,16 +1987,16 @@ DeletePartitionPage (PINPUT_RECORD Ir) DiskEntry->Id); } - SetTextXY (8, 18, "\x07 Press D to delete the partition."); - SetTextXY (11, 19, "WARNING: All data on this partition will be lost!"); + CONSOLE_SetTextXY (8, 18, "\x07 Press D to delete the partition."); + CONSOLE_SetTextXY (11, 19, "WARNING: All data on this partition will be lost!"); - SetTextXY (8, 21, "\x07 Press ESC to cancel."); + CONSOLE_SetTextXY (8, 21, "\x07 Press ESC to cancel."); - SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText (" D = Delete Partition ESC = Cancel F3 = Quit"); while (TRUE) { - ConInKey (Ir); + CONSOLE_ConInKey (Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -2065,17 +2097,17 @@ SelectFileSystemPage (PINPUT_RECORD Ir) if (PartEntry->AutoCreate == TRUE) { - SetTextXY(6, 8, "Setup created a new partition on"); + CONSOLE_SetTextXY(6, 8, "Setup created a new partition on"); #if 0 - PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of", + CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of", PartEntry->PartInfo[0].PartitionNumber, PartSize, PartUnit, PartType); #endif - PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).", + CONSOLE_PrintTextXY(8, 10, "Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).", DiskEntry->DiskNumber, DiskSize, DiskUnit, @@ -2084,23 +2116,23 @@ SelectFileSystemPage (PINPUT_RECORD Ir) DiskEntry->Id, &DiskEntry->DriverName); - SetTextXY(6, 12, "This Partition will be formatted next."); + CONSOLE_SetTextXY(6, 12, "This Partition will be formatted next."); PartEntry->AutoCreate = FALSE; } else if (PartEntry->New == TRUE) { - SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition."); - SetTextXY(6, 10, "This Partition will be formatted next."); + CONSOLE_SetTextXY(6, 8, "You chose to install ReactOS on a new or unformatted Partition."); + CONSOLE_SetTextXY(6, 10, "This Partition will be formatted next."); } else { - SetTextXY(6, 8, "Setup install ReactOS onto Partition"); + CONSOLE_SetTextXY(6, 8, "Setup install ReactOS onto Partition"); if (PartType == NULL) { - PrintTextXY (8, 10, + CONSOLE_PrintTextXY (8, 10, "%c%c Type %lu %I64u %s", (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter, (PartEntry->DriveLetter == 0) ? '-' : ':', @@ -2110,7 +2142,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) } else { - PrintTextXY (8, 10, + CONSOLE_PrintTextXY (8, 10, "%c%c %s %I64u %s", (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter, (PartEntry->DriveLetter == 0) ? '-' : ':', @@ -2119,7 +2151,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) PartUnit); } - PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).", + CONSOLE_PrintTextXY(6, 12, "on Harddisk %lu (%I64u %s), Port=%hu, Bus=%hu, Id=%hu (%wZ).", DiskEntry->DiskNumber, DiskSize, DiskUnit, @@ -2130,11 +2162,11 @@ SelectFileSystemPage (PINPUT_RECORD Ir) } - SetTextXY(6, 17, "Select a file system from the list below."); + CONSOLE_SetTextXY(6, 17, "Select a file system from the list below."); - SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system."); - SetTextXY(8, 21, "\x07 Press ENTER to format the partition."); - SetTextXY(8, 23, "\x07 Press ESC to select another partition."); + CONSOLE_SetTextXY(8, 19, "\x07 Press UP or DOWN to select a file system."); + CONSOLE_SetTextXY(8, 21, "\x07 Press ENTER to format the partition."); + CONSOLE_SetTextXY(8, 23, "\x07 Press ESC to select another partition."); if (FileSystemList == NULL) { @@ -2149,7 +2181,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) } DrawFileSystemList (FileSystemList); - SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit"); + CONSOLE_SetStatusText (" ENTER = Continue ESC = Cancel F3 = Quit"); if (IsUnattendedSetup) { @@ -2158,7 +2190,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) while (TRUE) { - ConInKey (Ir); + CONSOLE_ConInKey (Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -2216,11 +2248,11 @@ FormatPartitionPage (PINPUT_RECORD Ir) #endif - SetTextXY(6, 8, "Format partition"); + CONSOLE_SetTextXY(6, 8, "Format partition"); - SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue."); + CONSOLE_SetTextXY(6, 10, "Setup will now format the partition. Press ENTER to continue."); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); if (PartitionList == NULL || @@ -2236,7 +2268,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -2249,7 +2281,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) } else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */ { - SetStatusText (" Please wait ..."); + CONSOLE_SetStatusText (" Please wait ..."); if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED) { @@ -2309,7 +2341,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) CheckActiveBootPartition (PartitionList); #ifndef NDEBUG - PrintTextXY (6, 12, + CONSOLE_PrintTextXY (6, 12, "Disk: %I64u Cylinder: %I64u Track: %I64u", DiskEntry->DiskSize, DiskEntry->CylinderSize, @@ -2327,7 +2359,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) for (i = 0; i < 4; i++) { - PrintTextXY (6, Line, + CONSOLE_PrintTextXY (6, Line, "%2u: %2u %c %12I64u %12I64u %2u %c", i, PartEntry->PartInfo[i].PartitionNumber, @@ -2359,7 +2391,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) while (TRUE) { - ConInKey (Ir); + CONSOLE_ConInKey (Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2454,8 +2486,8 @@ FormatPartitionPage (PINPUT_RECORD Ir) } #ifndef NDEBUG - SetStatusText (" Done. Press any key ..."); - ConInKey(Ir); + CONSOLE_SetStatusText (" Done. Press any key ..."); + CONSOLE_ConInKey(Ir); #endif return INSTALL_DIRECTORY_PAGE; @@ -2471,14 +2503,14 @@ CheckFileSystemPage(PINPUT_RECORD Ir) { WCHAR PathBuffer[MAX_PATH]; - SetTextXY(6, 8, "Check file system"); + CONSOLE_SetTextXY(6, 8, "Check file system"); - SetTextXY(6, 10, "At present, ReactOS can not check file systems."); + CONSOLE_SetTextXY(6, 10, "At present, ReactOS can not check file systems."); - SetStatusText(" Please wait ..."); + CONSOLE_SetStatusText(" Please wait ..."); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); /* Set DestinationRootPath */ @@ -2509,7 +2541,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -2596,7 +2628,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir) while (TRUE) { - ConInKey (Ir); + CONSOLE_ConInKey (Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2617,16 +2649,16 @@ InstallDirectoryPage(PINPUT_RECORD Ir) InfFreeContext(Context); Length = wcslen(InstallDir); - SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a"); - SetTextXY(6, 9, "directory where you want ReactOS to be installed:"); + CONSOLE_SetTextXY(6, 8, "Setup installs ReactOS files onto the selected partition. Choose a"); + CONSOLE_SetTextXY(6, 9, "directory where you want ReactOS to be installed:"); - SetInputTextXY(8, 11, 51, InstallDir); + CONSOLE_SetInputTextXY(8, 11, 51, InstallDir); - SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete"); - SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to"); - SetTextXY(6, 16, "be installed."); + CONSOLE_SetTextXY(6, 14, "To change the suggested directory, press BACKSPACE to delete"); + CONSOLE_SetTextXY(6, 15, "characters and then type the directory where you want ReactOS to"); + CONSOLE_SetTextXY(6, 16, "be installed."); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); if (IsUnattendedSetup) { @@ -2635,7 +2667,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -2654,7 +2686,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir) { Length--; InstallDir[Length] = 0; - SetInputTextXY(8, 11, 51, InstallDir); + CONSOLE_SetInputTextXY(8, 11, 51, InstallDir); } } else if (isprint(Ir->Event.KeyEvent.uChar.AsciiChar)) @@ -2664,7 +2696,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir) InstallDir[Length] = (WCHAR)Ir->Event.KeyEvent.uChar.AsciiChar; Length++; InstallDir[Length] = 0; - SetInputTextXY(8, 11, 51, InstallDir); + CONSOLE_SetInputTextXY(8, 11, 51, InstallDir); } } } @@ -2695,7 +2727,7 @@ AddSectionToCopyQueue(HINF InfFile, while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2815,7 +2847,7 @@ PrepareCopyPageInfFile(HINF InfFile, while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2841,7 +2873,7 @@ PrepareCopyPageInfFile(HINF InfFile, while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2886,7 +2918,7 @@ PrepareCopyPageInfFile(HINF InfFile, while (TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2916,9 +2948,9 @@ PrepareCopyPage(PINPUT_RECORD Ir) ULONG ErrorLine; PVOID InfFileData; - SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. "); + CONSOLE_SetTextXY(6, 8, "Setup prepares your computer for copying the ReactOS files. "); - SetStatusText(" Building the file copy list..."); + CONSOLE_SetStatusText(" Building the file copy list..."); /* Create the file queue */ SetupFileQueue = SetupOpenFileQueue(); @@ -2929,7 +2961,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2978,7 +3010,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -2996,7 +3028,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3016,7 +3048,7 @@ PrepareCopyPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3060,7 +3092,7 @@ FileCopyCallback(PVOID Context, case SPFILENOTIFY_STARTCOPY: /* Display copy message */ - SetStatusText(" \xB3 Copying file: %S", (PWSTR)Param1); + CONSOLE_SetStatusText(" \xB3 Copying file: %S", (PWSTR)Param1); break; case SPFILENOTIFY_ENDCOPY: @@ -3080,13 +3112,13 @@ FileCopyPage(PINPUT_RECORD Ir) SHORT xScreen; SHORT yScreen; - SetStatusText(" \xB3 Please wait... "); + CONSOLE_SetStatusText(" \xB3 Please wait... "); - SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS"); - SetTextXY(30, 13, "installation folder."); - SetTextXY(20, 14, "This may take several minutes to complete."); + CONSOLE_SetTextXY(11, 12, "Please wait while ReactOS Setup copies files to your ReactOS"); + CONSOLE_SetTextXY(30, 13, "installation folder."); + CONSOLE_SetTextXY(20, 14, "This may take several minutes to complete."); - GetScreenSize(&xScreen, &yScreen); + CONSOLE_GetScreenSize(&xScreen, &yScreen); CopyContext.TotalOperations = 0; CopyContext.CompletedOperations = 0; CopyContext.ProgressBar = CreateProgressBar(13, @@ -3119,9 +3151,9 @@ RegistryPage(PINPUT_RECORD Ir) BOOLEAN Delete; NTSTATUS Status; - SetTextXY(6, 8, "Setup is updating the system configuration"); + CONSOLE_SetTextXY(6, 8, "Setup is updating the system configuration"); - SetStatusText(" Creating registry hives..."); + CONSOLE_SetStatusText(" Creating registry hives..."); if (!SetInstallPathValue(&DestinationPath)) { @@ -3131,7 +3163,7 @@ RegistryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3150,7 +3182,7 @@ RegistryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3160,7 +3192,7 @@ RegistryPage(PINPUT_RECORD Ir) } /* Update registry */ - SetStatusText(" Updating registry hives..."); + CONSOLE_SetStatusText(" Updating registry hives..."); if (!InfFindFirstLine(SetupInf, L"HiveInfs.Install", NULL, &InfContext)) { @@ -3170,7 +3202,7 @@ RegistryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3200,7 +3232,7 @@ RegistryPage(PINPUT_RECORD Ir) continue; } - SetStatusText(" Importing %S...", File); + CONSOLE_SetStatusText(" Importing %S...", File); if (!ImportRegistryFile(File, Section, Delete)) { @@ -3211,7 +3243,7 @@ RegistryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3225,7 +3257,7 @@ RegistryPage(PINPUT_RECORD Ir) InfFreeContext(InfContext); /* Update display registry settings */ - SetStatusText(" Updating display registry settings..."); + CONSOLE_SetStatusText(" Updating display registry settings..."); if (!ProcessDisplayRegistry(SetupInf, DisplayList)) { PopupError("Setup failed to update display registry settings.", @@ -3233,7 +3265,7 @@ RegistryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3243,7 +3275,7 @@ RegistryPage(PINPUT_RECORD Ir) } /* Update keyboard layout settings */ - SetStatusText(" Updating keyboard layout settings..."); + CONSOLE_SetStatusText(" Updating keyboard layout settings..."); if (!ProcessKeyboardLayoutRegistry(LayoutList)) { PopupError("Setup failed to update keyboard layout settings.", @@ -3251,7 +3283,7 @@ RegistryPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3263,7 +3295,7 @@ RegistryPage(PINPUT_RECORD Ir) /* Update the mounted devices list */ SetMountedDeviceValues(PartitionList); - SetStatusText(" Done..."); + CONSOLE_SetStatusText(" Done..."); return BOOT_LOADER_PAGE; } @@ -3276,7 +3308,7 @@ BootLoaderPage(PINPUT_RECORD Ir) BOOLEAN InstallOnFloppy; USHORT Line = 12; - SetStatusText(" Please wait..."); + CONSOLE_SetStatusText(" Please wait..."); PartitionType = PartitionList->ActiveBootPartition->PartInfo[0].PartitionType; @@ -3341,23 +3373,23 @@ BootLoaderPage(PINPUT_RECORD Ir) } } - SetTextXY(6, 8, "Setup is installing the boot loader"); + CONSOLE_SetTextXY(6, 8, "Setup is installing the boot loader"); - SetTextXY(8, 12, "Install bootloader on the harddisk (MBR)."); - SetTextXY(8, 13, "Install bootloader on a floppy disk."); - SetTextXY(8, 14, "Skip install bootloader."); - InvertTextXY (8, Line, 48, 1); + CONSOLE_SetTextXY(8, 12, "Install bootloader on the harddisk (MBR)."); + CONSOLE_SetTextXY(8, 13, "Install bootloader on a floppy disk."); + CONSOLE_SetTextXY(8, 14, "Skip install bootloader."); + CONSOLE_InvertTextXY (8, Line, 48, 1); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - NormalTextXY (8, Line, 48, 1); + CONSOLE_NormalTextXY (8, Line, 48, 1); Line++; if (Line<12) Line=14; @@ -3365,19 +3397,19 @@ BootLoaderPage(PINPUT_RECORD Ir) - InvertTextXY (8, Line, 48, 1); + CONSOLE_InvertTextXY (8, Line, 48, 1); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - NormalTextXY (8, Line, 48, 1); + CONSOLE_NormalTextXY (8, Line, 48, 1); Line--; if (Line<12) Line=14; if (Line>14) Line=12; - InvertTextXY (8, Line, 48, 1); + CONSOLE_InvertTextXY (8, Line, 48, 1); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -3415,19 +3447,19 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir) { NTSTATUS Status; - SetTextXY(6, 8, "Setup cannot install the bootloader on your computers"); - SetTextXY(6, 9, "harddisk"); + CONSOLE_SetTextXY(6, 8, "Setup cannot install the bootloader on your computers"); + CONSOLE_SetTextXY(6, 9, "harddisk"); - SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and"); - SetTextXY(6, 14, "press ENTER."); + CONSOLE_SetTextXY(6, 13, "Please insert a formatted floppy disk in drive A: and"); + CONSOLE_SetTextXY(6, 14, "press ENTER."); - SetStatusText(" ENTER = Continue F3 = Quit"); + CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit"); // SetStatusText(" Please wait..."); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -3444,7 +3476,7 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir) "ENTER = Continue"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ break; @@ -3494,7 +3526,7 @@ BootLoaderHarddiskPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3512,7 +3544,7 @@ BootLoaderHarddiskPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3528,14 +3560,14 @@ BootLoaderHarddiskPage(PINPUT_RECORD Ir) static PAGE_NUMBER QuitPage(PINPUT_RECORD Ir) { - SetTextXY(10, 6, "ReactOS is not completely installed"); + CONSOLE_SetTextXY(10, 6, "ReactOS is not completely installed"); - SetTextXY(10, 8, "Remove floppy disk from Drive A: and"); - SetTextXY(10, 9, "all CD-ROMs from CD-Drives."); + CONSOLE_SetTextXY(10, 8, "Remove floppy disk from Drive A: and"); + CONSOLE_SetTextXY(10, 9, "all CD-ROMs from CD-Drives."); - SetTextXY(10, 11, "Press ENTER to reboot your computer."); + CONSOLE_SetTextXY(10, 11, "Press ENTER to reboot your computer."); - SetStatusText(" Please wait ..."); + CONSOLE_SetStatusText(" Please wait ..."); /* Destroy partition list */ if (PartitionList != NULL) @@ -3579,11 +3611,11 @@ QuitPage(PINPUT_RECORD Ir) LayoutList = NULL; } - SetStatusText(" ENTER = Reboot computer"); + CONSOLE_SetStatusText(" ENTER = Reboot computer"); while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3596,14 +3628,14 @@ QuitPage(PINPUT_RECORD Ir) static PAGE_NUMBER SuccessPage(PINPUT_RECORD Ir) { - SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully."); + CONSOLE_SetTextXY(10, 6, "The basic components of ReactOS have been installed successfully."); - SetTextXY(10, 8, "Remove floppy disk from Drive A: and"); - SetTextXY(10, 9, "all CD-ROMs from CD-Drive."); + CONSOLE_SetTextXY(10, 8, "Remove floppy disk from Drive A: and"); + CONSOLE_SetTextXY(10, 9, "all CD-ROMs from CD-Drive."); - SetTextXY(10, 11, "Press ENTER to reboot your computer."); + CONSOLE_SetTextXY(10, 11, "Press ENTER to reboot your computer."); - SetStatusText(" ENTER = Reboot computer"); + CONSOLE_SetStatusText(" ENTER = Reboot computer"); if (IsUnattendedSetup) { @@ -3612,7 +3644,7 @@ SuccessPage(PINPUT_RECORD Ir) while(TRUE) { - ConInKey(Ir); + CONSOLE_ConInKey(Ir); if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { @@ -3625,12 +3657,12 @@ SuccessPage(PINPUT_RECORD Ir) static PAGE_NUMBER FlushPage(PINPUT_RECORD Ir) { - SetTextXY(10, 6, "The system is now making sure all data is stored on your disk"); + CONSOLE_SetTextXY(10, 6, "The system is now making sure all data is stored on your disk"); - SetTextXY(10, 8, "This may take a minute"); - SetTextXY(10, 9, "When finished, your computer will reboot automatically"); + CONSOLE_SetTextXY(10, 8, "This may take a minute"); + CONSOLE_SetTextXY(10, 9, "When finished, your computer will reboot automatically"); - SetStatusText(" Flushing cache"); + CONSOLE_SetStatusText(" Flushing cache"); return REBOOT_PAGE; } @@ -3675,9 +3707,9 @@ SignalInitEvent() VOID NTAPI NtProcessStartup(PPEB Peb) { - NTSTATUS Status; INPUT_RECORD Ir; PAGE_NUMBER Page; + BOOL ret; RtlNormalizeProcessParams(Peb->ProcessParameters); @@ -3686,10 +3718,10 @@ NtProcessStartup(PPEB Peb) SignalInitEvent(); - Status = AllocConsole(); - if (!NT_SUCCESS(Status)) + ret = AllocConsole(0); + if (!ret) { - PrintString("Unable to open the console (Status = 0x%08lx)\n\n", Status); + PrintString("Unable to open the console\n\n"); PrintString("The most common cause of this is using an USB keyboard\n"); PrintString("USB keyboards are not fully supported yet\n"); @@ -3709,14 +3741,14 @@ NtProcessStartup(PPEB Peb) RtlInitUnicodeString(&SystemRootPath, NULL); /* Hide the cursor */ - SetCursorType(TRUE, FALSE); + CONSOLE_SetCursorType(TRUE, FALSE); Page = START_PAGE; while (Page != REBOOT_PAGE) { - ClearScreen(); + CONSOLE_ClearScreen(); - SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); + CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR " Setup "); switch (Page) {