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