mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 13:45:06 +00:00
[CONSRV]: Code cleaning.
svn path=/branches/condrv_restructure/; revision=64005
This commit is contained in:
parent
b47d51c6a3
commit
abe58c387a
|
@ -25,8 +25,9 @@ typedef struct ConsoleInput_t
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
|
// ConDrvAddInputEvents
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
ConDrvAddInputEvents(PCONSOLE Console,
|
AddInputEvents(PCONSOLE Console,
|
||||||
PINPUT_RECORD InputRecords, // InputEvent
|
PINPUT_RECORD InputRecords, // InputEvent
|
||||||
ULONG NumEventsToWrite,
|
ULONG NumEventsToWrite,
|
||||||
PULONG NumEventsWritten,
|
PULONG NumEventsWritten,
|
||||||
|
@ -288,6 +289,8 @@ ConDrvGetConsoleInput(IN PCONSOLE Console,
|
||||||
ResetEvent(InputBuffer->ActiveEvent);
|
ResetEvent(InputBuffer->ActiveEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: If we add back UNICODE support, it's here that we need to do the translation.
|
||||||
|
|
||||||
/* We read all the inputs available, we return success */
|
/* We read all the inputs available, we return success */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -310,7 +313,9 @@ ConDrvWriteConsoleInput(IN PCONSOLE Console,
|
||||||
/* Now, add the events */
|
/* Now, add the events */
|
||||||
if (NumEventsWritten) *NumEventsWritten = 0;
|
if (NumEventsWritten) *NumEventsWritten = 0;
|
||||||
|
|
||||||
return ConDrvAddInputEvents(Console,
|
// FIXME: If we add back UNICODE support, it's here that we need to do the translation.
|
||||||
|
|
||||||
|
return AddInputEvents(Console,
|
||||||
InputRecord,
|
InputRecord,
|
||||||
NumEventsToWrite,
|
NumEventsToWrite,
|
||||||
NumEventsWritten,
|
NumEventsWritten,
|
||||||
|
|
|
@ -16,6 +16,20 @@
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* From MSDN:
|
||||||
|
* "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
|
||||||
|
* If they are the same, the function fails, and GetLastError returns
|
||||||
|
* ERROR_INVALID_PARAMETER."
|
||||||
|
*/
|
||||||
|
#define ConsoleOutputUnicodeToAnsiChar(Console, dChar, sWChar) \
|
||||||
|
ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
|
||||||
|
WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
|
||||||
|
|
||||||
|
#define ConsoleOutputAnsiToUnicodeChar(Console, dWChar, sChar) \
|
||||||
|
ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
|
||||||
|
MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* PRIVATE FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
CONSOLE_IO_OBJECT_TYPE
|
CONSOLE_IO_OBJECT_TYPE
|
||||||
|
@ -500,7 +514,7 @@ ConDrvReadConsoleOutput(IN PCONSOLE Console,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ConsoleUnicodeCharToAnsiChar(Console, &CurCharInfo->Char.AsciiChar, &Ptr->Char.UnicodeChar);
|
// ConsoleOutputUnicodeToAnsiChar(Console, &CurCharInfo->Char.AsciiChar, &Ptr->Char.UnicodeChar);
|
||||||
WideCharToMultiByte(Console->OutputCodePage, 0, &Ptr->Char.UnicodeChar, 1,
|
WideCharToMultiByte(Console->OutputCodePage, 0, &Ptr->Char.UnicodeChar, 1,
|
||||||
&CurCharInfo->Char.AsciiChar, 1, NULL, NULL);
|
&CurCharInfo->Char.AsciiChar, 1, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
@ -563,7 +577,7 @@ ConDrvWriteConsoleOutput(IN PCONSOLE Console,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleAnsiCharToUnicodeChar(Console, &Ptr->Char.UnicodeChar, &CurCharInfo->Char.AsciiChar);
|
ConsoleOutputAnsiToUnicodeChar(Console, &Ptr->Char.UnicodeChar, &CurCharInfo->Char.AsciiChar);
|
||||||
}
|
}
|
||||||
Ptr->Attributes = CurCharInfo->Attributes;
|
Ptr->Attributes = CurCharInfo->Attributes;
|
||||||
++Ptr;
|
++Ptr;
|
||||||
|
@ -626,7 +640,7 @@ ConDrvWriteConsoleOutputVDM(IN PCONSOLE Console,
|
||||||
Ptr = ConioCoordToPointer(Buffer, CapturedWriteRegion.Left, Y);
|
Ptr = ConioCoordToPointer(Buffer, CapturedWriteRegion.Left, Y);
|
||||||
for (X = CapturedWriteRegion.Left; X <= CapturedWriteRegion.Right; ++X)
|
for (X = CapturedWriteRegion.Left; X <= CapturedWriteRegion.Right; ++X)
|
||||||
{
|
{
|
||||||
ConsoleAnsiCharToUnicodeChar(Console, &Ptr->Char.UnicodeChar, &CurCharInfo->Char);
|
ConsoleOutputAnsiToUnicodeChar(Console, &Ptr->Char.UnicodeChar, &CurCharInfo->Char);
|
||||||
Ptr->Attributes = CurCharInfo->Attributes;
|
Ptr->Attributes = CurCharInfo->Attributes;
|
||||||
++Ptr;
|
++Ptr;
|
||||||
++CurCharInfo;
|
++CurCharInfo;
|
||||||
|
@ -787,7 +801,7 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
|
||||||
switch (CodeType)
|
switch (CodeType)
|
||||||
{
|
{
|
||||||
case CODE_ASCII:
|
case CODE_ASCII:
|
||||||
ConsoleUnicodeCharToAnsiChar(Console, (PCHAR)ReadBuffer, &Ptr->Char.UnicodeChar);
|
ConsoleOutputUnicodeToAnsiChar(Console, (PCHAR)ReadBuffer, &Ptr->Char.UnicodeChar);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODE_UNICODE:
|
case CODE_UNICODE:
|
||||||
|
@ -993,7 +1007,7 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
|
||||||
{
|
{
|
||||||
/* Conversion from the ASCII char to the UNICODE char */
|
/* Conversion from the ASCII char to the UNICODE char */
|
||||||
CODE_ELEMENT tmp;
|
CODE_ELEMENT tmp;
|
||||||
ConsoleAnsiCharToUnicodeChar(Console, &tmp.UnicodeChar, &Code.AsciiChar);
|
ConsoleOutputAnsiToUnicodeChar(Console, &tmp.UnicodeChar, &Code.AsciiChar);
|
||||||
Code = tmp;
|
Code = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1192,7 @@ ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console,
|
||||||
if (!Unicode)
|
if (!Unicode)
|
||||||
{
|
{
|
||||||
WCHAR tmp;
|
WCHAR tmp;
|
||||||
ConsoleAnsiCharToUnicodeChar(Console, &tmp, &FillChar.Char.AsciiChar);
|
ConsoleOutputAnsiToUnicodeChar(Console, &tmp, &FillChar.Char.AsciiChar);
|
||||||
FillChar.Char.UnicodeChar = tmp;
|
FillChar.Char.UnicodeChar = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,25 +26,21 @@
|
||||||
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
|
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From MSDN:
|
* From MSDN:
|
||||||
* "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
|
* "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
|
||||||
* If they are the same, the function fails, and GetLastError returns
|
* If they are the same, the function fails, and GetLastError returns
|
||||||
* ERROR_INVALID_PARAMETER."
|
* ERROR_INVALID_PARAMETER."
|
||||||
*/
|
*/
|
||||||
#define ConsoleInputUnicodeCharToAnsiChar(Console, dChar, sWChar) \
|
#define ConsoleInputUnicodeToAnsiChar(Console, dChar, sWChar) \
|
||||||
ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
|
ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
|
||||||
WideCharToMultiByte((Console)->InputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
|
WideCharToMultiByte((Console)->InputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
|
||||||
|
|
||||||
#define ConsoleInputAnsiCharToUnicodeChar(Console, dWChar, sChar) \
|
#define ConsoleInputAnsiToUnicodeChar(Console, dWChar, sChar) \
|
||||||
ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
|
ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
|
||||||
MultiByteToWideChar((Console)->InputCodePage, 0, (sChar), 1, (dWChar), 1)
|
MultiByteToWideChar((Console)->InputCodePage, 0, (sChar), 1, (dWChar), 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GET_INPUT_INFO
|
typedef struct _GET_INPUT_INFO
|
||||||
{
|
{
|
||||||
PCSR_THREAD CallingThread; // The thread which called the input API.
|
PCSR_THREAD CallingThread; // The thread which called the input API.
|
||||||
|
@ -62,7 +58,7 @@ ConioInputEventToAnsi(PCONSOLE Console, PINPUT_RECORD InputEvent)
|
||||||
{
|
{
|
||||||
WCHAR UnicodeChar = InputEvent->Event.KeyEvent.uChar.UnicodeChar;
|
WCHAR UnicodeChar = InputEvent->Event.KeyEvent.uChar.UnicodeChar;
|
||||||
InputEvent->Event.KeyEvent.uChar.UnicodeChar = 0;
|
InputEvent->Event.KeyEvent.uChar.UnicodeChar = 0;
|
||||||
ConsoleInputUnicodeCharToAnsiChar(Console,
|
ConsoleInputUnicodeToAnsiChar(Console,
|
||||||
&InputEvent->Event.KeyEvent.uChar.AsciiChar,
|
&InputEvent->Event.KeyEvent.uChar.AsciiChar,
|
||||||
&UnicodeChar);
|
&UnicodeChar);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +71,7 @@ ConioInputEventToUnicode(PCONSOLE Console, PINPUT_RECORD InputEvent)
|
||||||
{
|
{
|
||||||
CHAR AsciiChar = InputEvent->Event.KeyEvent.uChar.AsciiChar;
|
CHAR AsciiChar = InputEvent->Event.KeyEvent.uChar.AsciiChar;
|
||||||
InputEvent->Event.KeyEvent.uChar.AsciiChar = 0;
|
InputEvent->Event.KeyEvent.uChar.AsciiChar = 0;
|
||||||
ConsoleInputAnsiCharToUnicodeChar(Console,
|
ConsoleInputAnsiToUnicodeChar(Console,
|
||||||
&InputEvent->Event.KeyEvent.uChar.UnicodeChar,
|
&InputEvent->Event.KeyEvent.uChar.UnicodeChar,
|
||||||
&AsciiChar);
|
&AsciiChar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,21 +327,6 @@ ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
|
||||||
IN PCONSOLE_PROCESS_DATA ProcessData);
|
IN PCONSOLE_PROCESS_DATA ProcessData);
|
||||||
|
|
||||||
/* conoutput.c */
|
/* conoutput.c */
|
||||||
|
|
||||||
/*
|
|
||||||
* From MSDN:
|
|
||||||
* "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
|
|
||||||
* If they are the same, the function fails, and GetLastError returns
|
|
||||||
* ERROR_INVALID_PARAMETER."
|
|
||||||
*/
|
|
||||||
#define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \
|
|
||||||
ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
|
|
||||||
WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
|
|
||||||
|
|
||||||
#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \
|
|
||||||
ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
|
|
||||||
MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
|
|
||||||
|
|
||||||
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
||||||
VOID ConioDrawConsole(PCONSOLE Console);
|
VOID ConioDrawConsole(PCONSOLE Console);
|
||||||
NTSTATUS ConioResizeBuffer(PCONSOLE Console,
|
NTSTATUS ConioResizeBuffer(PCONSOLE Console,
|
||||||
|
|
|
@ -197,21 +197,6 @@ ConioProcessInputEvent(PCONSRV_CONSOLE Console,
|
||||||
PINPUT_RECORD InputEvent);
|
PINPUT_RECORD InputEvent);
|
||||||
|
|
||||||
/* conoutput.c */
|
/* conoutput.c */
|
||||||
|
|
||||||
/*
|
|
||||||
* From MSDN:
|
|
||||||
* "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
|
|
||||||
* If they are the same, the function fails, and GetLastError returns
|
|
||||||
* ERROR_INVALID_PARAMETER."
|
|
||||||
*/
|
|
||||||
#define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \
|
|
||||||
ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
|
|
||||||
WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
|
|
||||||
|
|
||||||
#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \
|
|
||||||
ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
|
|
||||||
MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
|
|
||||||
|
|
||||||
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
|
||||||
VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
|
VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
|
||||||
NTSTATUS ConioResizeBuffer(PCONSRV_CONSOLE Console,
|
NTSTATUS ConioResizeBuffer(PCONSRV_CONSOLE Console,
|
||||||
|
|
Loading…
Reference in a new issue