From ac2f92611e4e690538dc88a3210cd4277e8849f2 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 15 May 2014 16:32:30 +0000 Subject: [PATCH] [FORMATTING] Fix indentation and coding style. No code changes! svn path=/trunk/; revision=63305 --- reactos/base/setup/usetup/interface/consup.c | 814 +++++++++--------- reactos/base/setup/usetup/native/console.c | 5 +- reactos/base/setup/usetup/native/fslist.c | 33 +- .../base/setup/usetup/native/utils/console.c | 749 ++++++++-------- .../base/setup/usetup/native/utils/console.h | 125 +-- 5 files changed, 872 insertions(+), 854 deletions(-) diff --git a/reactos/base/setup/usetup/interface/consup.c b/reactos/base/setup/usetup/interface/consup.c index 88fd4b960b3..fd9ff284c5b 100644 --- a/reactos/base/setup/usetup/interface/consup.c +++ b/reactos/base/setup/usetup/interface/consup.c @@ -43,230 +43,230 @@ SHORT yScreen = 0; BOOLEAN CONSOLE_Init( - VOID) + VOID) { - CONSOLE_SCREEN_BUFFER_INFO csbi; - if (!HOST_InitConsole()) - return FALSE; + CONSOLE_SCREEN_BUFFER_INFO csbi; + if (!HOST_InitConsole()) + return FALSE; - StdInput = GetStdHandle(STD_INPUT_HANDLE); - StdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - if (!GetConsoleScreenBufferInfo(StdOutput, &csbi)) - return FALSE; - xScreen = csbi.dwSize.X; - yScreen = 50;//csbi.dwSize.Y; - return TRUE; + StdInput = GetStdHandle(STD_INPUT_HANDLE); + StdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + if (!GetConsoleScreenBufferInfo(StdOutput, &csbi)) + return FALSE; + xScreen = csbi.dwSize.X; + yScreen = 50;//csbi.dwSize.Y; + return TRUE; } VOID CONSOLE_ConInKey( - OUT PINPUT_RECORD Buffer) + OUT PINPUT_RECORD Buffer) { - DWORD Read; + DWORD Read; - while (TRUE) - { - ReadConsoleInput(StdInput, Buffer, 1, &Read); + while (TRUE) + { + ReadConsoleInput(StdInput, Buffer, 1, &Read); - if ((Buffer->EventType == KEY_EVENT) - && (Buffer->Event.KeyEvent.bKeyDown == TRUE)) - break; - } + if ((Buffer->EventType == KEY_EVENT) + && (Buffer->Event.KeyEvent.bKeyDown == TRUE)) + break; + } } VOID CONSOLE_ConOutChar( - IN CHAR c) + IN CHAR c) { - DWORD Written; + DWORD Written; - WriteConsole( - StdOutput, - &c, - 1, - &Written, - NULL); + WriteConsole( + StdOutput, + &c, + 1, + &Written, + NULL); } VOID CONSOLE_ConOutPuts( - IN LPCSTR szText) + IN LPCSTR szText) { - DWORD Written; + DWORD Written; - WriteConsole( - StdOutput, - szText, - (ULONG)strlen(szText), - &Written, - NULL); - WriteConsole( - StdOutput, - "\n", - 1, - &Written, - NULL); + WriteConsole( + StdOutput, + szText, + (ULONG)strlen(szText), + &Written, + NULL); + WriteConsole( + StdOutput, + "\n", + 1, + &Written, + NULL); } VOID CONSOLE_ConOutPrintf( - IN LPCSTR szFormat, ...) + IN LPCSTR szFormat, ...) { - CHAR szOut[256]; - DWORD dwWritten; - va_list arg_ptr; + CHAR szOut[256]; + DWORD dwWritten; + va_list arg_ptr; - va_start(arg_ptr, szFormat); - vsprintf(szOut, szFormat, arg_ptr); - va_end(arg_ptr); + va_start(arg_ptr, szFormat); + vsprintf(szOut, szFormat, arg_ptr); + va_end(arg_ptr); - WriteConsole( - StdOutput, - szOut, - (ULONG)strlen(szOut), - &dwWritten, - NULL); + WriteConsole( + StdOutput, + szOut, + (ULONG)strlen(szOut), + &dwWritten, + NULL); } BOOL CONSOLE_Flush(VOID) { - return FlushConsoleInputBuffer(StdInput); + return FlushConsoleInputBuffer(StdInput); } SHORT CONSOLE_GetCursorX(VOID) { - CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_SCREEN_BUFFER_INFO csbi; - GetConsoleScreenBufferInfo(StdOutput, &csbi); + GetConsoleScreenBufferInfo(StdOutput, &csbi); - return csbi.dwCursorPosition.X; + return csbi.dwCursorPosition.X; } SHORT CONSOLE_GetCursorY(VOID) { - CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_SCREEN_BUFFER_INFO csbi; - GetConsoleScreenBufferInfo(StdOutput, &csbi); + GetConsoleScreenBufferInfo(StdOutput, &csbi); - return csbi.dwCursorPosition.Y; + return csbi.dwCursorPosition.Y; } VOID CONSOLE_SetCursorType( - IN BOOL bInsert, - IN BOOL bVisible) + IN BOOL bInsert, + IN BOOL bVisible) { - CONSOLE_CURSOR_INFO cci; + CONSOLE_CURSOR_INFO cci; - cci.dwSize = bInsert ? 10 : 99; - cci.bVisible = bVisible; + cci.dwSize = bInsert ? 10 : 99; + cci.bVisible = bVisible; - SetConsoleCursorInfo(StdOutput, &cci); + SetConsoleCursorInfo(StdOutput, &cci); } VOID CONSOLE_SetCursorXY( - IN SHORT x, - IN SHORT y) + IN SHORT x, + IN SHORT y) { - COORD coPos; + COORD coPos; - coPos.X = x; - coPos.Y = y; - SetConsoleCursorPosition(StdOutput, coPos); + coPos.X = x; + coPos.Y = y; + SetConsoleCursorPosition(StdOutput, coPos); } VOID CONSOLE_ClearScreen(VOID) { - COORD coPos; - DWORD Written; + COORD coPos; + DWORD Written; - coPos.X = 0; - coPos.Y = 0; + coPos.X = 0; + coPos.Y = 0; - FillConsoleOutputAttribute( - StdOutput, - FOREGROUND_WHITE | BACKGROUND_BLUE, - xScreen * yScreen, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, + xScreen * yScreen, + coPos, + &Written); - FillConsoleOutputCharacterA( - StdOutput, - ' ', - xScreen * yScreen, - coPos, - &Written); + FillConsoleOutputCharacterA( + StdOutput, + ' ', + xScreen * yScreen, + coPos, + &Written); } VOID CONSOLE_InvertTextXY( - IN SHORT x, - IN SHORT y, - IN SHORT col, - IN SHORT row) + IN SHORT x, + IN SHORT y, + IN SHORT col, + IN SHORT row) { - COORD coPos; - DWORD Written; + COORD coPos; + DWORD Written; - for (coPos.Y = y; coPos.Y < y + row; coPos.Y++) - { - coPos.X = x; + for (coPos.Y = y; coPos.Y < y + row; coPos.Y++) + { + coPos.X = x; - FillConsoleOutputAttribute( - StdOutput, - FOREGROUND_BLUE | BACKGROUND_WHITE, - col, - coPos, - &Written); - } + FillConsoleOutputAttribute( + StdOutput, + FOREGROUND_BLUE | BACKGROUND_WHITE, + col, + coPos, + &Written); + } } VOID CONSOLE_NormalTextXY( - IN SHORT x, - IN SHORT y, - IN SHORT col, - IN SHORT row) + IN SHORT x, + IN SHORT y, + IN SHORT col, + IN SHORT row) { - COORD coPos; - DWORD Written; + COORD coPos; + DWORD Written; - for (coPos.Y = y; coPos.Y < y + row; coPos.Y++) - { - coPos.X = x; + for (coPos.Y = y; coPos.Y < y + row; coPos.Y++) + { + coPos.X = x; - FillConsoleOutputAttribute( - StdOutput, - FOREGROUND_WHITE | BACKGROUND_BLUE, - col, - coPos, - &Written); - } + FillConsoleOutputAttribute( + StdOutput, + FOREGROUND_WHITE | BACKGROUND_BLUE, + col, + coPos, + &Written); + } } VOID CONSOLE_SetTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text) + IN SHORT x, + IN SHORT y, + IN LPCSTR Text) { - COORD coPos; - DWORD Written; + COORD coPos; + DWORD Written; - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - WriteConsoleOutputCharacterA( - StdOutput, - Text, - (ULONG)strlen(Text), - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + Text, + (ULONG)strlen(Text), + coPos, + &Written); } static @@ -290,164 +290,164 @@ CONSOLE_ClearTextXY(IN SHORT x, VOID CONSOLE_SetInputTextXY( - IN SHORT x, - IN SHORT y, - IN SHORT len, - IN LPCWSTR Text) + IN SHORT x, + IN SHORT y, + IN SHORT len, + IN LPCWSTR Text) { - COORD coPos; - SHORT Length; - DWORD Written; + COORD coPos; + SHORT Length; + DWORD Written; - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - Length = (SHORT)wcslen(Text); - if (Length > len - 1) - Length = len - 1; + Length = (SHORT)wcslen(Text); + if (Length > len - 1) + Length = len - 1; - FillConsoleOutputAttribute( - StdOutput, - BACKGROUND_WHITE, - len, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + BACKGROUND_WHITE, + len, + coPos, + &Written); - WriteConsoleOutputCharacterW( - StdOutput, - Text, - (ULONG)Length, - coPos, - &Written); + WriteConsoleOutputCharacterW( + StdOutput, + Text, + (ULONG)Length, + coPos, + &Written); - coPos.X += Length; - FillConsoleOutputCharacterA( - StdOutput, - '_', - 1, - coPos, - &Written); + coPos.X += Length; + FillConsoleOutputCharacterA( + StdOutput, + '_', + 1, + coPos, + &Written); - if (len > Length + 1) - { - coPos.X++; - FillConsoleOutputCharacterA( - StdOutput, - ' ', - len - Length - 1, - coPos, - &Written); - } + if (len > Length + 1) + { + coPos.X++; + FillConsoleOutputCharacterA( + StdOutput, + ' ', + len - Length - 1, + coPos, + &Written); + } } VOID CONSOLE_SetUnderlinedTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text) + IN SHORT x, + IN SHORT y, + IN LPCSTR Text) { - COORD coPos; - DWORD Length; - DWORD Written; + COORD coPos; + DWORD Length; + DWORD Written; - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - Length = (ULONG)strlen(Text); + Length = (ULONG)strlen(Text); - WriteConsoleOutputCharacterA( - StdOutput, - Text, - Length, - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + Text, + Length, + coPos, + &Written); - coPos.Y++; - FillConsoleOutputCharacterA( - StdOutput, - 0xCD, - Length, - coPos, - &Written); + coPos.Y++; + FillConsoleOutputCharacterA( + StdOutput, + 0xCD, + Length, + coPos, + &Written); } VOID CONSOLE_SetStatusText( - IN LPCSTR fmt, ...) + IN LPCSTR fmt, ...) { - CHAR Buffer[128]; - va_list ap; - COORD coPos; - DWORD Written; + CHAR Buffer[128]; + va_list ap; + COORD coPos; + DWORD Written; - va_start(ap, fmt); - vsprintf(Buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(Buffer, fmt, ap); + va_end(ap); - coPos.X = 0; - coPos.Y = yScreen - 1; + coPos.X = 0; + coPos.Y = yScreen - 1; - FillConsoleOutputAttribute( - StdOutput, - BACKGROUND_WHITE, - xScreen, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + BACKGROUND_WHITE, + xScreen, + coPos, + &Written); - FillConsoleOutputCharacterA( - StdOutput, - ' ', - xScreen, - coPos, - &Written); + FillConsoleOutputCharacterA( + StdOutput, + ' ', + xScreen, + coPos, + &Written); - WriteConsoleOutputCharacterA( - StdOutput, - Buffer, - (ULONG)strlen(Buffer), - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + Buffer, + (ULONG)strlen(Buffer), + coPos, + &Written); } VOID CONSOLE_SetStatusTextX( IN SHORT x, - IN LPCSTR fmt, ...) + IN LPCSTR fmt, ...) { - CHAR Buffer[128]; - va_list ap; - COORD coPos; - DWORD Written; + CHAR Buffer[128]; + va_list ap; + COORD coPos; + DWORD Written; - va_start(ap, fmt); - vsprintf(Buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(Buffer, fmt, ap); + va_end(ap); - coPos.X = 0; - coPos.Y = yScreen - 1; + coPos.X = 0; + coPos.Y = yScreen - 1; - FillConsoleOutputAttribute( - StdOutput, - BACKGROUND_WHITE, - xScreen, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + BACKGROUND_WHITE, + xScreen, + coPos, + &Written); - FillConsoleOutputCharacterA( - StdOutput, - ' ', - xScreen, - coPos, - &Written); + FillConsoleOutputCharacterA( + StdOutput, + ' ', + xScreen, + coPos, + &Written); coPos.X = x; - WriteConsoleOutputCharacterA( - StdOutput, - Buffer, - (ULONG)strlen(Buffer), - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + Buffer, + (ULONG)strlen(Buffer), + coPos, + &Written); } static @@ -472,15 +472,15 @@ CONSOLE_ClearStatusTextX(IN SHORT x, VOID CONSOLE_SetStatusTextAutoFitX( IN SHORT x, - IN LPCSTR fmt, ...) + IN LPCSTR fmt, ...) { - CHAR Buffer[128]; + CHAR Buffer[128]; DWORD Length; - va_list ap; + va_list ap; - va_start(ap, fmt); - vsprintf(Buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(Buffer, fmt, ap); + va_end(ap); Length = (ULONG)strlen(Buffer); @@ -496,211 +496,211 @@ CONSOLE_SetStatusTextAutoFitX( VOID CONSOLE_SetInvertedTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text) + IN SHORT x, + IN SHORT y, + IN LPCSTR Text) { - COORD coPos; - DWORD Length; - DWORD Written; + COORD coPos; + DWORD Length; + DWORD Written; - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - Length = (ULONG)strlen(Text); + Length = (ULONG)strlen(Text); - FillConsoleOutputAttribute( - StdOutput, - FOREGROUND_BLUE | BACKGROUND_WHITE, - Length, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + FOREGROUND_BLUE | BACKGROUND_WHITE, + Length, + coPos, + &Written); - WriteConsoleOutputCharacterA( - StdOutput, - Text, - Length, - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + Text, + Length, + coPos, + &Written); } VOID CONSOLE_SetHighlightedTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text) + IN SHORT x, + IN SHORT y, + IN LPCSTR Text) { - COORD coPos; - DWORD Length; - DWORD Written; + COORD coPos; + DWORD Length; + DWORD Written; - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - Length = (ULONG)strlen(Text); + Length = (ULONG)strlen(Text); - FillConsoleOutputAttribute( - StdOutput, - FOREGROUND_WHITE | FOREGROUND_INTENSITY | BACKGROUND_BLUE, - Length, - coPos, - &Written); + FillConsoleOutputAttribute( + StdOutput, + FOREGROUND_WHITE | FOREGROUND_INTENSITY | BACKGROUND_BLUE, + Length, + coPos, + &Written); - WriteConsoleOutputCharacterA( - StdOutput, - Text, - Length, - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + Text, + Length, + coPos, + &Written); } VOID CONSOLE_PrintTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR fmt, ...) + IN SHORT x, + IN SHORT y, + IN LPCSTR fmt, ...) { - CHAR buffer[512]; - va_list ap; - COORD coPos; - DWORD Written; + CHAR buffer[512]; + va_list ap; + COORD coPos; + DWORD Written; - va_start(ap, fmt); - vsprintf(buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(buffer, fmt, ap); + va_end(ap); - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - WriteConsoleOutputCharacterA( - StdOutput, - buffer, - (ULONG)strlen(buffer), - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + buffer, + (ULONG)strlen(buffer), + coPos, + &Written); } VOID CONSOLE_PrintTextXYN( - IN SHORT x, - IN SHORT y, - IN SHORT len, - IN LPCSTR fmt, ...) + IN SHORT x, + IN SHORT y, + IN SHORT len, + IN LPCSTR fmt, ...) { - CHAR buffer[512]; - va_list ap; - COORD coPos; - SHORT Length; - DWORD Written; + CHAR buffer[512]; + va_list ap; + COORD coPos; + SHORT Length; + DWORD Written; - va_start(ap, fmt); - vsprintf(buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(buffer, fmt, ap); + va_end(ap); - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - Length = (SHORT)strlen(buffer); - if (Length > len - 1) - Length = len - 1; + Length = (SHORT)strlen(buffer); + if (Length > len - 1) + Length = len - 1; - WriteConsoleOutputCharacterA( - StdOutput, - buffer, - Length, - coPos, - &Written); + WriteConsoleOutputCharacterA( + StdOutput, + buffer, + Length, + coPos, + &Written); - coPos.X += Length; + coPos.X += Length; - if (len > Length) - { - FillConsoleOutputCharacterA( - StdOutput, - ' ', - len - Length, - coPos, - &Written); - } + if (len > Length) + { + FillConsoleOutputCharacterA( + StdOutput, + ' ', + len - Length, + coPos, + &Written); + } } VOID CONSOLE_SetStyledText( - IN SHORT x, - IN SHORT y, - IN INT Flags, - IN LPCSTR Text) + IN SHORT x, + IN SHORT y, + IN INT Flags, + IN LPCSTR Text) { - COORD coPos; - DWORD Length; + COORD coPos; + DWORD Length; - coPos.X = x; - coPos.Y = y; + coPos.X = x; + coPos.Y = y; - Length = (ULONG)strlen(Text); + Length = (ULONG)strlen(Text); if (Flags & TEXT_TYPE_STATUS) - { - coPos.X = x; - coPos.Y = yScreen - 1; - } + { + coPos.X = x; + coPos.Y = yScreen - 1; + } else /* TEXT_TYPE_REGULAR (Default) */ { coPos.X = x; - coPos.Y = y; + coPos.Y = y; } if (Flags & TEXT_ALIGN_CENTER) - { - coPos.X = (xScreen - Length) /2; - } + { + coPos.X = (xScreen - Length) /2; + } else if(Flags & TEXT_ALIGN_RIGHT) - { - coPos.X = coPos.X - Length; + { + coPos.X = coPos.X - Length; - if (Flags & TEXT_PADDING_SMALL) - { - coPos.X -= 1; - } - else if (Flags & TEXT_PADDING_MEDIUM) - { - coPos.X -= 2; - } - else if (Flags & TEXT_PADDING_BIG) - { - coPos.X -= 3; - } - } - else /* TEXT_ALIGN_LEFT (Default) */ - { - if (Flags & TEXT_PADDING_SMALL) - { - coPos.X += 1; - } - else if (Flags & TEXT_PADDING_MEDIUM) - { - coPos.X += 2; - } - else if (Flags & TEXT_PADDING_BIG) - { - coPos.X += 3; - } - } + if (Flags & TEXT_PADDING_SMALL) + { + coPos.X -= 1; + } + else if (Flags & TEXT_PADDING_MEDIUM) + { + coPos.X -= 2; + } + else if (Flags & TEXT_PADDING_BIG) + { + coPos.X -= 3; + } + } + else /* TEXT_ALIGN_LEFT (Default) */ + { + if (Flags & TEXT_PADDING_SMALL) + { + coPos.X += 1; + } + else if (Flags & TEXT_PADDING_MEDIUM) + { + coPos.X += 2; + } + else if (Flags & TEXT_PADDING_BIG) + { + coPos.X += 3; + } + } - if (Flags & TEXT_TYPE_STATUS) - { + if (Flags & TEXT_TYPE_STATUS) + { CONSOLE_SetStatusTextX(coPos.X, Text); - } + } else /* TEXT_TYPE_REGULAR (Default) */ { if (Flags & TEXT_STYLE_HIGHLIGHT) - { + { CONSOLE_SetHighlightedTextXY(coPos.X, coPos.Y, Text); - } + } else if (Flags & TEXT_STYLE_UNDERLINE) - { + { CONSOLE_SetUnderlinedTextXY(coPos.X, coPos.Y, Text); - } + } else /* TEXT_STYLE_NORMAL (Default) */ { CONSOLE_SetTextXY(coPos.X, coPos.Y, Text); diff --git a/reactos/base/setup/usetup/native/console.c b/reactos/base/setup/usetup/native/console.c index 6971b98f72b..963caa72f0d 100644 --- a/reactos/base/setup/usetup/native/console.c +++ b/reactos/base/setup/usetup/native/console.c @@ -1,8 +1,7 @@ #include BOOLEAN -NATIVE_InitConsole( - VOID) +NATIVE_InitConsole(VOID) { - return (BOOLEAN)AllocConsole(); + return (BOOLEAN)AllocConsole(); } diff --git a/reactos/base/setup/usetup/native/fslist.c b/reactos/base/setup/usetup/native/fslist.c index c1211c874ec..d00a7c91368 100644 --- a/reactos/base/setup/usetup/native/fslist.c +++ b/reactos/base/setup/usetup/native/fslist.c @@ -2,30 +2,29 @@ BOOLEAN NATIVE_CreateFileSystemList( - IN PFILE_SYSTEM_LIST List) + IN PFILE_SYSTEM_LIST List) { - FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk); + FS_AddProvider(List, L"FAT", VfatFormat, VfatChkdsk); #if 0 - FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk); + FS_AddProvider(List, L"EXT2", Ext2Format, Ext2Chkdsk); #endif - return TRUE; + return TRUE; } + BOOLEAN NATIVE_FormatPartition( - IN PFILE_SYSTEM_ITEM FileSystem, - IN PCUNICODE_STRING DriveRoot, - IN PFMIFSCALLBACK Callback) + IN PFILE_SYSTEM_ITEM FileSystem, + IN PCUNICODE_STRING DriveRoot, + IN PFMIFSCALLBACK Callback) { - NTSTATUS Status; + NTSTATUS Status; - Status = FileSystem->FormatFunc( - (PUNICODE_STRING)DriveRoot, - FMIFS_HARDDISK, /* MediaFlag */ - NULL, /* Label */ - FileSystem->QuickFormat, /* QuickFormat */ - 0, /* ClusterSize */ - Callback); /* Callback */ - - return NT_SUCCESS(Status); + Status = FileSystem->FormatFunc((PUNICODE_STRING)DriveRoot, + FMIFS_HARDDISK, /* MediaFlag */ + NULL, /* Label */ + FileSystem->QuickFormat, /* QuickFormat */ + 0, /* ClusterSize */ + Callback); /* Callback */ + return NT_SUCCESS(Status); } diff --git a/reactos/base/setup/usetup/native/utils/console.c b/reactos/base/setup/usetup/native/utils/console.c index 21aff2c0235..327efe3f018 100644 --- a/reactos/base/setup/usetup/native/utils/console.c +++ b/reactos/base/setup/usetup/native/utils/console.c @@ -36,476 +36,481 @@ /* FUNCTIONS *****************************************************************/ -BOOL WINAPI +BOOL +WINAPI AllocConsole(VOID) { - UNICODE_STRING ScreenName = RTL_CONSTANT_STRING(L"\\??\\BlueScreen"); - UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0"); - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + 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; - /* Open the screen */ - InitializeObjectAttributes( - &ObjectAttributes, - &ScreenName, - 0, - NULL, - NULL); - Status = NtOpenFile( - &StdOutput, - FILE_ALL_ACCESS, - &ObjectAttributes, - &IoStatusBlock, - FILE_OPEN, - FILE_SYNCHRONOUS_IO_ALERT); - if (!NT_SUCCESS(Status)) - return FALSE; + /* Open the screen */ + InitializeObjectAttributes(&ObjectAttributes, + &ScreenName, + 0, + NULL, + NULL); + Status = NtOpenFile(&StdOutput, + FILE_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + FILE_OPEN, + 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, - FILE_OPEN, - 0); - if (!NT_SUCCESS(Status)) - return FALSE; + /* Open the keyboard */ + InitializeObjectAttributes(&ObjectAttributes, + &KeyboardName, + 0, + NULL, + NULL); + Status = NtOpenFile(&StdInput, + FILE_ALL_ACCESS, + &ObjectAttributes, + &IoStatusBlock, + FILE_OPEN, + 0); + if (!NT_SUCCESS(Status)) + return FALSE; - return TRUE; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI AttachConsole( - IN DWORD dwProcessId) + IN DWORD dwProcessId) { - return FALSE; + return FALSE; } -BOOL WINAPI + +BOOL +WINAPI FreeConsole(VOID) { - 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); - return TRUE; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI WriteConsole( - IN HANDLE hConsoleOutput, - IN const VOID* lpBuffer, - IN DWORD nNumberOfCharsToWrite, - OUT LPDWORD lpNumberOfCharsWritten, - IN LPVOID lpReserved) + IN HANDLE hConsoleOutput, + IN const VOID *lpBuffer, + IN DWORD nNumberOfCharsToWrite, + OUT LPDWORD lpNumberOfCharsWritten, + IN LPVOID lpReserved) { - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Status = NtWriteFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - (PVOID)lpBuffer, - nNumberOfCharsToWrite, - NULL, - NULL); - if (!NT_SUCCESS(Status)) - return FALSE; + Status = NtWriteFile(hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + (PVOID)lpBuffer, + nNumberOfCharsToWrite, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + return FALSE; - *lpNumberOfCharsWritten = IoStatusBlock.Information; - return TRUE; + *lpNumberOfCharsWritten = IoStatusBlock.Information; + return TRUE; } -HANDLE WINAPI + +HANDLE +WINAPI GetStdHandle( - IN DWORD nStdHandle) + IN DWORD nStdHandle) { - switch (nStdHandle) - { - case STD_INPUT_HANDLE: - return StdInput; - case STD_OUTPUT_HANDLE: - return StdOutput; - default: - return INVALID_HANDLE_VALUE; - } + switch (nStdHandle) + { + case STD_INPUT_HANDLE: + return StdInput; + case STD_OUTPUT_HANDLE: + return StdOutput; + default: + return INVALID_HANDLE_VALUE; + } } -BOOL WINAPI + +BOOL +WINAPI FlushConsoleInputBuffer( - IN HANDLE hConsoleInput) + IN HANDLE hConsoleInput) { - LARGE_INTEGER Offset, Timeout; - IO_STATUS_BLOCK IoStatusBlock; - KEYBOARD_INPUT_DATA InputData; - NTSTATUS Status; + LARGE_INTEGER Offset, Timeout; + IO_STATUS_BLOCK IoStatusBlock; + KEYBOARD_INPUT_DATA InputData; + NTSTATUS Status; - do - { - Offset.QuadPart = 0; - Status = NtReadFile( - hConsoleInput, - NULL, - NULL, - NULL, - &IoStatusBlock, - &InputData, - sizeof(KEYBOARD_INPUT_DATA), - &Offset, - 0); - if (Status == STATUS_PENDING) - { - Timeout.QuadPart = -100; - Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout); - if (Status == STATUS_TIMEOUT) - { - NtCancelIoFile(hConsoleInput, &IoStatusBlock); - return TRUE; - } - } - } while (NT_SUCCESS(Status)); - return FALSE; + do + { + Offset.QuadPart = 0; + Status = NtReadFile(hConsoleInput, + NULL, + NULL, + NULL, + &IoStatusBlock, + &InputData, + sizeof(KEYBOARD_INPUT_DATA), + &Offset, + 0); + if (Status == STATUS_PENDING) + { + Timeout.QuadPart = -100; + Status = NtWaitForSingleObject(hConsoleInput, FALSE, &Timeout); + if (Status == STATUS_TIMEOUT) + { + NtCancelIoFile(hConsoleInput, &IoStatusBlock); + return TRUE; + } + } + } while (NT_SUCCESS(Status)); + return FALSE; } -BOOL WINAPI + +BOOL +WINAPI ReadConsoleInput( - IN HANDLE hConsoleInput, - OUT PINPUT_RECORD lpBuffer, - IN DWORD nLength, - OUT LPDWORD lpNumberOfEventsRead) + IN HANDLE hConsoleInput, + OUT PINPUT_RECORD lpBuffer, + IN DWORD nLength, + OUT LPDWORD lpNumberOfEventsRead) { - LARGE_INTEGER Offset; - IO_STATUS_BLOCK IoStatusBlock; - KEYBOARD_INPUT_DATA InputData; - NTSTATUS Status; + LARGE_INTEGER Offset; + IO_STATUS_BLOCK IoStatusBlock; + KEYBOARD_INPUT_DATA InputData; + NTSTATUS Status; - Offset.QuadPart = 0; - Status = NtReadFile( - hConsoleInput, - NULL, - NULL, - NULL, - &IoStatusBlock, - &InputData, - sizeof(KEYBOARD_INPUT_DATA), - &Offset, - 0); - if (Status == STATUS_PENDING) - { - Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL); - Status = IoStatusBlock.Status; - } - if (!NT_SUCCESS(Status)) - return FALSE; + Offset.QuadPart = 0; + Status = NtReadFile(hConsoleInput, + NULL, + NULL, + NULL, + &IoStatusBlock, + &InputData, + sizeof(KEYBOARD_INPUT_DATA), + &Offset, + 0); + if (Status == STATUS_PENDING) + { + Status = NtWaitForSingleObject(hConsoleInput, FALSE, NULL); + Status = IoStatusBlock.Status; + } + if (!NT_SUCCESS(Status)) + return FALSE; - lpBuffer->EventType = KEY_EVENT; - Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent); - if (!NT_SUCCESS(Status)) - return FALSE; + lpBuffer->EventType = KEY_EVENT; + Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent); + if (!NT_SUCCESS(Status)) + return FALSE; - *lpNumberOfEventsRead = 1; - return TRUE; + *lpNumberOfEventsRead = 1; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI WriteConsoleOutputCharacterA( - HANDLE hConsoleOutput, - IN LPCSTR lpCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten) + HANDLE hConsoleOutput, + IN LPCSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - PCHAR Buffer; - COORD *pCoord; - PCHAR pText; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + PCHAR Buffer; + COORD *pCoord; + PCHAR pText; + NTSTATUS Status; - Buffer = (CHAR*) RtlAllocateHeap( - ProcessHeap, - 0, - nLength + sizeof(COORD)); - pCoord = (COORD *)Buffer; - pText = (PCHAR)(pCoord + 1); + Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap, + 0, + nLength + sizeof(COORD)); + pCoord = (COORD *)Buffer; + pText = (PCHAR)(pCoord + 1); - *pCoord = dwWriteCoord; - memcpy(pText, lpCharacter, nLength); + *pCoord = dwWriteCoord; + memcpy(pText, lpCharacter, nLength); - Status = NtDeviceIoControlFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, - NULL, - 0, - Buffer, - nLength + sizeof(COORD)); + 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; + RtlFreeHeap(ProcessHeap, 0, Buffer); + if (!NT_SUCCESS(Status)) + return FALSE; - *lpNumberOfCharsWritten = IoStatusBlock.Information; - return TRUE; + *lpNumberOfCharsWritten = IoStatusBlock.Information; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI WriteConsoleOutputCharacterW( - HANDLE hConsoleOutput, - IN LPCWSTR lpCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten) + HANDLE hConsoleOutput, + IN LPCWSTR lpCharacter, + 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; + PCHAR Buffer; + COORD *pCoord; + PCHAR pText; + NTSTATUS Status; + ULONG i; - Buffer = (CHAR*) RtlAllocateHeap( - ProcessHeap, - 0, - nLength + sizeof(COORD)); - pCoord = (COORD *)Buffer; - pText = (PCHAR)(pCoord + 1); + Buffer = (CHAR*)RtlAllocateHeap(ProcessHeap, + 0, + nLength + sizeof(COORD)); + pCoord = (COORD *)Buffer; + pText = (PCHAR)(pCoord + 1); - *pCoord = dwWriteCoord; + *pCoord = dwWriteCoord; - /* FIXME: use real unicode->oem conversion */ - for (i = 0; i < nLength; i++) - pText[i] = (CHAR)lpCharacter[i]; + /* FIXME: use real unicode->oem conversion */ + for (i = 0; i < nLength; i++) + pText[i] = (CHAR)lpCharacter[i]; - Status = NtDeviceIoControlFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER, - NULL, - 0, - Buffer, - nLength + sizeof(COORD)); + 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; + RtlFreeHeap(ProcessHeap, 0, Buffer); + if (!NT_SUCCESS(Status)) + return FALSE; - *lpNumberOfCharsWritten = IoStatusBlock.Information; - return TRUE; + *lpNumberOfCharsWritten = IoStatusBlock.Information; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI FillConsoleOutputAttribute( - IN HANDLE hConsoleOutput, - IN WORD wAttribute, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfAttrsWritten) + IN HANDLE hConsoleOutput, + IN WORD wAttribute, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfAttrsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - OUTPUT_ATTRIBUTE Buffer; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + OUTPUT_ATTRIBUTE Buffer; + NTSTATUS Status; - Buffer.wAttribute = wAttribute; - Buffer.nLength = nLength; - Buffer.dwCoord = dwWriteCoord; + Buffer.wAttribute = wAttribute; + Buffer.nLength = nLength; + Buffer.dwCoord = dwWriteCoord; - Status = NtDeviceIoControlFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE, - &Buffer, - sizeof(OUTPUT_ATTRIBUTE), - &Buffer, - sizeof(OUTPUT_ATTRIBUTE)); + Status = NtDeviceIoControlFile(hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE, + &Buffer, + sizeof(OUTPUT_ATTRIBUTE), + &Buffer, + sizeof(OUTPUT_ATTRIBUTE)); + if (!NT_SUCCESS(Status)) + return FALSE; - if (!NT_SUCCESS(Status)) - return FALSE; - - *lpNumberOfAttrsWritten = Buffer.dwTransfered; - return TRUE; + *lpNumberOfAttrsWritten = Buffer.dwTransfered; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI FillConsoleOutputCharacterA( - IN HANDLE hConsoleOutput, - IN CHAR cCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten) + IN HANDLE hConsoleOutput, + IN CHAR cCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten) { - IO_STATUS_BLOCK IoStatusBlock; - OUTPUT_CHARACTER Buffer; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + OUTPUT_CHARACTER Buffer; + NTSTATUS Status; - Buffer.cCharacter = cCharacter; - Buffer.nLength = nLength; - Buffer.dwCoord = dwWriteCoord; + Buffer.cCharacter = cCharacter; + Buffer.nLength = nLength; + Buffer.dwCoord = 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; + 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; - *lpNumberOfCharsWritten = Buffer.dwTransfered; - return TRUE; + *lpNumberOfCharsWritten = Buffer.dwTransfered; + return TRUE; } -BOOL WINAPI + +BOOL +WINAPI GetConsoleScreenBufferInfo( - IN HANDLE hConsoleOutput, - OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) + IN HANDLE hConsoleOutput, + OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo) { - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS 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); + 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); } -BOOL WINAPI + +BOOL +WINAPI SetConsoleCursorInfo( - IN HANDLE hConsoleOutput, - IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo) + IN HANDLE hConsoleOutput, + IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo) { - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS 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); + 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); } -BOOL WINAPI + +BOOL +WINAPI SetConsoleCursorPosition( - IN HANDLE hConsoleOutput, - IN COORD dwCursorPosition) + IN HANDLE hConsoleOutput, + IN COORD dwCursorPosition) { - CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo); - if (!NT_SUCCESS(Status)) - return FALSE; + Status = GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo); + if (!NT_SUCCESS(Status)) + return FALSE; - ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X; - ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y; + ConsoleScreenBufferInfo.dwCursorPosition.X = dwCursorPosition.X; + ConsoleScreenBufferInfo.dwCursorPosition.Y = dwCursorPosition.Y; - Status = NtDeviceIoControlFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, - &ConsoleScreenBufferInfo, - sizeof(CONSOLE_SCREEN_BUFFER_INFO), - NULL, - 0); - - return NT_SUCCESS(Status); + Status = NtDeviceIoControlFile(hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO, + &ConsoleScreenBufferInfo, + sizeof(CONSOLE_SCREEN_BUFFER_INFO), + NULL, + 0); + return NT_SUCCESS(Status); } -BOOL WINAPI + +BOOL +WINAPI SetConsoleTextAttribute( - IN HANDLE hConsoleOutput, - IN WORD wAttributes) + IN HANDLE hConsoleOutput, + IN WORD wAttributes) { - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - Status = NtDeviceIoControlFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE, - &wAttributes, - sizeof(USHORT), - NULL, - 0); - return NT_SUCCESS(Status); + Status = NtDeviceIoControlFile(hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE, + &wAttributes, + sizeof(USHORT), + NULL, + 0); + return NT_SUCCESS(Status); } -BOOL WINAPI + +BOOL +WINAPI SetConsoleOutputCP( - IN UINT wCodepage) + IN UINT wCodepage) { - HANDLE hConsoleOutput; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; + HANDLE hConsoleOutput; + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; - hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); + hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); - Status = NtDeviceIoControlFile( - hConsoleOutput, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_CONSOLE_LOADFONT, - &wCodepage, - sizeof(ULONG), - NULL, - 0); - return NT_SUCCESS(Status); + Status = NtDeviceIoControlFile(hConsoleOutput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_CONSOLE_LOADFONT, + &wCodepage, + sizeof(ULONG), + NULL, + 0); + return NT_SUCCESS(Status); } diff --git a/reactos/base/setup/usetup/native/utils/console.h b/reactos/base/setup/usetup/native/utils/console.h index feb89829245..c2021709510 100644 --- a/reactos/base/setup/usetup/native/utils/console.h +++ b/reactos/base/setup/usetup/native/utils/console.h @@ -26,90 +26,105 @@ #pragma once -BOOL WINAPI +BOOL +WINAPI AllocConsole(VOID); -BOOL WINAPI +BOOL +WINAPI AttachConsole( - IN DWORD dwProcessId); + IN DWORD dwProcessId); -BOOL WINAPI +BOOL +WINAPI FillConsoleOutputAttribute( - IN HANDLE hConsoleOutput, - IN WORD wAttribute, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfAttrsWritten); + IN HANDLE hConsoleOutput, + IN WORD wAttribute, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfAttrsWritten); -BOOL WINAPI +BOOL +WINAPI FillConsoleOutputCharacterA( - IN HANDLE hConsoleOutput, - IN CHAR cCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten); + IN HANDLE hConsoleOutput, + IN CHAR cCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten); -BOOL WINAPI +BOOL +WINAPI FreeConsole(VOID); -BOOL WINAPI +BOOL +WINAPI GetConsoleScreenBufferInfo( - IN HANDLE hConsoleOutput, - OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); + IN HANDLE hConsoleOutput, + OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); -HANDLE WINAPI +HANDLE +WINAPI GetStdHandle( - IN DWORD nStdHandle); + IN DWORD nStdHandle); -BOOL WINAPI +BOOL +WINAPI ReadConsoleInput( - IN HANDLE hConsoleInput, - OUT PINPUT_RECORD lpBuffer, - IN DWORD nLength, - OUT LPDWORD lpNumberOfEventsRead); + IN HANDLE hConsoleInput, + OUT PINPUT_RECORD lpBuffer, + IN DWORD nLength, + OUT LPDWORD lpNumberOfEventsRead); -BOOL WINAPI +BOOL +WINAPI SetConsoleCursorInfo( - IN HANDLE hConsoleOutput, - IN const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo); + IN HANDLE hConsoleOutput, + IN const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo); -BOOL WINAPI +BOOL +WINAPI SetConsoleCursorPosition( - IN HANDLE hConsoleOutput, - IN COORD dwCursorPosition); + IN HANDLE hConsoleOutput, + IN COORD dwCursorPosition); -BOOL WINAPI +BOOL +WINAPI SetConsoleTextAttribute( - IN HANDLE hConsoleOutput, - IN WORD wAttributes); + IN HANDLE hConsoleOutput, + IN WORD wAttributes); -BOOL WINAPI +BOOL +WINAPI WriteConsole( - IN HANDLE hConsoleOutput, - IN const VOID* lpBuffer, - IN DWORD nNumberOfCharsToWrite, - OUT LPDWORD lpNumberOfCharsWritten, - IN LPVOID lpReserved); + IN HANDLE hConsoleOutput, + IN const VOID *lpBuffer, + IN DWORD nNumberOfCharsToWrite, + OUT LPDWORD lpNumberOfCharsWritten, + IN LPVOID lpReserved); -BOOL WINAPI +BOOL +WINAPI WriteConsoleOutputCharacterA( - HANDLE hConsoleOutput, - IN LPCSTR lpCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten); + HANDLE hConsoleOutput, + IN LPCSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten); -BOOL WINAPI +BOOL +WINAPI WriteConsoleOutputCharacterW( - HANDLE hConsoleOutput, - IN LPCSTR lpCharacter, - IN DWORD nLength, - IN COORD dwWriteCoord, - OUT LPDWORD lpNumberOfCharsWritten); + HANDLE hConsoleOutput, + IN LPCSTR lpCharacter, + IN DWORD nLength, + IN COORD dwWriteCoord, + OUT LPDWORD lpNumberOfCharsWritten); -BOOL WINAPI +BOOL +WINAPI SetConsoleOutputCP( - IN UINT wCodePageID + IN UINT wCodePageID ); /* EOF */