mirror of
https://github.com/reactos/reactos.git
synced 2024-07-31 08:39:05 +00:00
[CONSRV]
Fix some MSVC warnings (type conversions). Ready for merging (TM) :) svn path=/branches/ros-csrss/; revision=58758
This commit is contained in:
parent
f51caa6299
commit
ddfa887b86
|
@ -456,7 +456,7 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
|
||||||
sizeof(LuidEnabled),
|
sizeof(LuidEnabled),
|
||||||
NULL);
|
NULL);
|
||||||
ASSERT(NT_SUCCESS(Status));
|
ASSERT(NT_SUCCESS(Status));
|
||||||
BaseStaticServerData->LUIDDeviceMapsEnabled = LuidEnabled;
|
BaseStaticServerData->LUIDDeviceMapsEnabled = (BOOLEAN)LuidEnabled;
|
||||||
if (!BaseStaticServerData->LUIDDeviceMapsEnabled)
|
if (!BaseStaticServerData->LUIDDeviceMapsEnabled)
|
||||||
{
|
{
|
||||||
/* Make Global point back to BNO */
|
/* Make Global point back to BNO */
|
||||||
|
|
|
@ -568,7 +568,7 @@ ReadChars(IN PGET_INPUT_INFO InputInfo,
|
||||||
if (Console->LineBuffer == NULL)
|
if (Console->LineBuffer == NULL)
|
||||||
{
|
{
|
||||||
/* Starting a new line */
|
/* Starting a new line */
|
||||||
Console->LineMaxSize = max(256, nNumberOfCharsToRead);
|
Console->LineMaxSize = (WORD)max(256, nNumberOfCharsToRead);
|
||||||
Console->LineBuffer = RtlAllocateHeap(ConSrvHeap, 0, Console->LineMaxSize * sizeof(WCHAR));
|
Console->LineBuffer = RtlAllocateHeap(ConSrvHeap, 0, Console->LineMaxSize * sizeof(WCHAR));
|
||||||
if (Console->LineBuffer == NULL)
|
if (Console->LineBuffer == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,13 +60,13 @@ static VOID FASTCALL
|
||||||
ClearLineBuffer(PCONSOLE_SCREEN_BUFFER Buff)
|
ClearLineBuffer(PCONSOLE_SCREEN_BUFFER Buff)
|
||||||
{
|
{
|
||||||
PBYTE Ptr = ConioCoordToPointer(Buff, 0, Buff->CursorPosition.Y);
|
PBYTE Ptr = ConioCoordToPointer(Buff, 0, Buff->CursorPosition.Y);
|
||||||
UINT Pos;
|
SHORT Pos;
|
||||||
|
|
||||||
for (Pos = 0; Pos < Buff->ScreenBufferSize.X; Pos++)
|
for (Pos = 0; Pos < Buff->ScreenBufferSize.X; Pos++)
|
||||||
{
|
{
|
||||||
/* Fill the cell */
|
/* Fill the cell */
|
||||||
*Ptr++ = ' ';
|
*Ptr++ = ' ';
|
||||||
*Ptr++ = Buff->ScreenDefaultAttrib;
|
*Ptr++ = (BYTE)Buff->ScreenDefaultAttrib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
UINT i;
|
UINT i;
|
||||||
PBYTE Ptr;
|
PBYTE Ptr;
|
||||||
SMALL_RECT UpdateRect;
|
SMALL_RECT UpdateRect;
|
||||||
LONG CursorStartX, CursorStartY;
|
SHORT CursorStartX, CursorStartY;
|
||||||
UINT ScrolledLines;
|
UINT ScrolledLines;
|
||||||
|
|
||||||
CursorStartX = Buff->CursorPosition.X;
|
CursorStartX = Buff->CursorPosition.X;
|
||||||
|
@ -178,8 +178,8 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
if (Buffer[i] == '\r')
|
if (Buffer[i] == '\r')
|
||||||
{
|
{
|
||||||
Buff->CursorPosition.X = 0;
|
Buff->CursorPosition.X = 0;
|
||||||
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
|
||||||
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* --- LF --- */
|
/* --- LF --- */
|
||||||
|
@ -200,7 +200,7 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
/* slide virtual position up */
|
/* slide virtual position up */
|
||||||
Buff->CursorPosition.X = Buff->ScreenBufferSize.X - 1;
|
Buff->CursorPosition.X = Buff->ScreenBufferSize.X - 1;
|
||||||
Buff->CursorPosition.Y--;
|
Buff->CursorPosition.Y--;
|
||||||
UpdateRect.Top = min(UpdateRect.Top, (LONG)Buff->CursorPosition.Y);
|
UpdateRect.Top = min(UpdateRect.Top, Buff->CursorPosition.Y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -208,9 +208,9 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
}
|
}
|
||||||
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
|
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
|
||||||
Ptr[0] = ' ';
|
Ptr[0] = ' ';
|
||||||
Ptr[1] = Buff->ScreenDefaultAttrib;
|
Ptr[1] = (BYTE)Buff->ScreenDefaultAttrib;
|
||||||
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
|
||||||
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -219,17 +219,17 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
{
|
{
|
||||||
UINT EndX;
|
UINT EndX;
|
||||||
|
|
||||||
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
|
||||||
EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1);
|
EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1);
|
||||||
EndX = min(EndX, Buff->ScreenBufferSize.X);
|
EndX = min(EndX, (UINT)Buff->ScreenBufferSize.X);
|
||||||
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
|
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
|
||||||
while (Buff->CursorPosition.X < EndX)
|
while (Buff->CursorPosition.X < EndX)
|
||||||
{
|
{
|
||||||
*Ptr++ = ' ';
|
*Ptr++ = ' ';
|
||||||
*Ptr++ = Buff->ScreenDefaultAttrib;
|
*Ptr++ = (BYTE)Buff->ScreenDefaultAttrib;
|
||||||
Buff->CursorPosition.X++;
|
Buff->CursorPosition.X++;
|
||||||
}
|
}
|
||||||
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X - 1);
|
UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X - 1);
|
||||||
if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X)
|
if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X)
|
||||||
{
|
{
|
||||||
if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT)
|
if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT)
|
||||||
|
@ -253,13 +253,13 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
|
||||||
UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X);
|
UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
|
||||||
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
|
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
|
||||||
Ptr[0] = Buffer[i];
|
Ptr[0] = Buffer[i];
|
||||||
if (Attrib)
|
if (Attrib)
|
||||||
{
|
{
|
||||||
Ptr[1] = Buff->ScreenDefaultAttrib;
|
Ptr[1] = (BYTE)Buff->ScreenDefaultAttrib;
|
||||||
}
|
}
|
||||||
Buff->CursorPosition.X++;
|
Buff->CursorPosition.X++;
|
||||||
if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X)
|
if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X)
|
||||||
|
@ -278,8 +278,8 @@ ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
|
||||||
|
|
||||||
if (!ConioIsRectEmpty(&UpdateRect) && Buff == Console->ActiveBuffer)
|
if (!ConioIsRectEmpty(&UpdateRect) && Buff == Console->ActiveBuffer)
|
||||||
{
|
{
|
||||||
ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY, ScrolledLines,
|
ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY,
|
||||||
Buffer, Length);
|
ScrolledLines, Buffer, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -466,7 +466,7 @@ ConioResizeBuffer(PCONSOLE Console,
|
||||||
for (i = 0; i < diff; i++)
|
for (i = 0; i < diff; i++)
|
||||||
{
|
{
|
||||||
Buffer[Offset++] = ' ';
|
Buffer[Offset++] = ' ';
|
||||||
Buffer[Offset++] = ScreenBuffer->ScreenDefaultAttrib;
|
Buffer[Offset++] = (BYTE)ScreenBuffer->ScreenDefaultAttrib;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ ConioResizeBuffer(PCONSOLE Console,
|
||||||
for (i = 0; i < diff; i++)
|
for (i = 0; i < diff; i++)
|
||||||
{
|
{
|
||||||
Buffer[Offset++] = ' ';
|
Buffer[Offset++] = ' ';
|
||||||
Buffer[Offset++] = ScreenBuffer->ScreenDefaultAttrib;
|
Buffer[Offset++] = (BYTE)ScreenBuffer->ScreenDefaultAttrib;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -730,7 +730,7 @@ CSR_API(SrvReadConsoleOutput)
|
||||||
PCHAR_INFO CharInfo;
|
PCHAR_INFO CharInfo;
|
||||||
PCHAR_INFO CurCharInfo;
|
PCHAR_INFO CurCharInfo;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
DWORD SizeX, SizeY;
|
SHORT SizeX, SizeY;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
COORD BufferSize;
|
COORD BufferSize;
|
||||||
COORD BufferCoord;
|
COORD BufferCoord;
|
||||||
|
@ -905,7 +905,7 @@ CSR_API(SrvWriteConsoleOutput)
|
||||||
AsciiChar = CurCharInfo->Char.AsciiChar;
|
AsciiChar = CurCharInfo->Char.AsciiChar;
|
||||||
}
|
}
|
||||||
*Ptr++ = AsciiChar;
|
*Ptr++ = AsciiChar;
|
||||||
*Ptr++ = CurCharInfo->Attributes;
|
*Ptr++ = (BYTE)CurCharInfo->Attributes;
|
||||||
CurCharInfo++;
|
CurCharInfo++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -929,7 +929,7 @@ CSR_API(SrvReadConsoleOutputString)
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
USHORT CodeType;
|
USHORT CodeType;
|
||||||
DWORD Xpos, Ypos;
|
SHORT Xpos, Ypos;
|
||||||
PVOID ReadBuffer;
|
PVOID ReadBuffer;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
ULONG CodeSize;
|
ULONG CodeSize;
|
||||||
|
@ -1324,8 +1324,8 @@ CSR_API(SrvSetConsoleCursorPosition)
|
||||||
PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorPositionRequest;
|
PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorPositionRequest;
|
||||||
PCONSOLE Console;
|
PCONSOLE Console;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff;
|
PCONSOLE_SCREEN_BUFFER Buff;
|
||||||
LONG OldCursorX, OldCursorY;
|
SHORT OldCursorX, OldCursorY;
|
||||||
LONG NewCursorX, NewCursorY;
|
SHORT NewCursorX, NewCursorY;
|
||||||
|
|
||||||
DPRINT("SrvSetConsoleCursorPosition\n");
|
DPRINT("SrvSetConsoleCursorPosition\n");
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ ConSrvInitConsole(OUT PCONSOLE* NewConsole,
|
||||||
*/
|
*/
|
||||||
if (ConsoleStartInfo->dwStartupFlags & STARTF_USEFILLATTRIBUTE)
|
if (ConsoleStartInfo->dwStartupFlags & STARTF_USEFILLATTRIBUTE)
|
||||||
{
|
{
|
||||||
ConsoleInfo.ScreenAttrib = ConsoleStartInfo->FillAttribute;
|
ConsoleInfo.ScreenAttrib = (USHORT)ConsoleStartInfo->FillAttribute;
|
||||||
}
|
}
|
||||||
if (ConsoleStartInfo->dwStartupFlags & STARTF_USECOUNTCHARS)
|
if (ConsoleStartInfo->dwStartupFlags & STARTF_USECOUNTCHARS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -595,11 +595,7 @@ GuiConsolePaint(PCONSOLE Console,
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiByteToWideChar(Console->OutputCodePage,
|
MultiByteToWideChar(Console->OutputCodePage,
|
||||||
0,
|
0, (PCHAR)From, 1, To, 1);
|
||||||
(PCHAR)From,
|
|
||||||
1,
|
|
||||||
To,
|
|
||||||
1);
|
|
||||||
To++;
|
To++;
|
||||||
From += 2;
|
From += 2;
|
||||||
}
|
}
|
||||||
|
@ -611,13 +607,14 @@ GuiConsolePaint(PCONSOLE Console,
|
||||||
RightChar - Start + 1);
|
RightChar - Start + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Buff->CursorInfo.bVisible && Buff->CursorBlinkOn &&
|
if (Buff->CursorInfo.bVisible &&
|
||||||
!Buff->ForceCursorOff)
|
Buff->CursorBlinkOn &&
|
||||||
|
!Buff->ForceCursorOff)
|
||||||
{
|
{
|
||||||
CursorX = Buff->CursorPosition.X;
|
CursorX = Buff->CursorPosition.X;
|
||||||
CursorY = Buff->CursorPosition.Y;
|
CursorY = Buff->CursorPosition.Y;
|
||||||
if (LeftChar <= CursorX && CursorX <= RightChar &&
|
if (LeftChar <= CursorX && CursorX <= RightChar &&
|
||||||
TopLine <= CursorY && CursorY <= BottomLine)
|
TopLine <= CursorY && CursorY <= BottomLine)
|
||||||
{
|
{
|
||||||
CursorHeight = ConioEffectiveCursorSize(Console, GuiData->CharHeight);
|
CursorHeight = ConioEffectiveCursorSize(Console, GuiData->CharHeight);
|
||||||
From = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y) + 1;
|
From = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y) + 1;
|
||||||
|
@ -836,7 +833,7 @@ GuiConsoleHandleKey(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM l
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
GuiInvalidateCell(PCONSOLE Console, UINT x, UINT y)
|
GuiInvalidateCell(PCONSOLE Console, SHORT x, SHORT y)
|
||||||
{
|
{
|
||||||
SMALL_RECT CellRect = { x, y, x, y };
|
SMALL_RECT CellRect = { x, y, x, y };
|
||||||
GuiDrawRegion(Console, &CellRect);
|
GuiDrawRegion(Console, &CellRect);
|
||||||
|
@ -971,8 +968,8 @@ PointToCoord(PGUI_CONSOLE_DATA GuiData, LPARAM lParam)
|
||||||
PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer;
|
PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer;
|
||||||
COORD Coord;
|
COORD Coord;
|
||||||
|
|
||||||
Coord.X = Buffer->ShowX + ((short)LOWORD(lParam) / (int)GuiData->CharWidth);
|
Coord.X = Buffer->ShowX + ((SHORT)LOWORD(lParam) / (int)GuiData->CharWidth);
|
||||||
Coord.Y = Buffer->ShowY + ((short)HIWORD(lParam) / (int)GuiData->CharHeight);
|
Coord.Y = Buffer->ShowY + ((SHORT)HIWORD(lParam) / (int)GuiData->CharHeight);
|
||||||
|
|
||||||
/* Clip coordinate to ensure it's inside buffer */
|
/* Clip coordinate to ensure it's inside buffer */
|
||||||
if (Coord.X < 0)
|
if (Coord.X < 0)
|
||||||
|
@ -2029,12 +2026,12 @@ GuiCleanupConsole(PCONSOLE Console)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID WINAPI
|
static VOID WINAPI
|
||||||
GuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY,
|
GuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, SHORT CursorStartX, SHORT CursorStartY,
|
||||||
UINT ScrolledLines, CHAR *Buffer, UINT Length)
|
UINT ScrolledLines, CHAR *Buffer, UINT Length)
|
||||||
{
|
{
|
||||||
PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
|
PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
|
||||||
PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer;
|
PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer;
|
||||||
LONG CursorEndX, CursorEndY;
|
SHORT CursorEndX, CursorEndY;
|
||||||
RECT ScrollRect;
|
RECT ScrollRect;
|
||||||
|
|
||||||
if (NULL == GuiData || NULL == GuiData->hWindow)
|
if (NULL == GuiData || NULL == GuiData->hWindow)
|
||||||
|
@ -2104,7 +2101,7 @@ GuiSetCursorInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WINAPI
|
static BOOL WINAPI
|
||||||
GuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY)
|
GuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, SHORT OldCursorX, SHORT OldCursorY)
|
||||||
{
|
{
|
||||||
if (Console->ActiveBuffer == Buff)
|
if (Console->ActiveBuffer == Buff)
|
||||||
{
|
{
|
||||||
|
|
|
@ -480,7 +480,7 @@ TuiCleanupConsole(PCONSOLE Console)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID WINAPI
|
static VOID WINAPI
|
||||||
TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY,
|
TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, SHORT CursorStartX, SHORT CursorStartY,
|
||||||
UINT ScrolledLines, CHAR *Buffer, UINT Length)
|
UINT ScrolledLines, CHAR *Buffer, UINT Length)
|
||||||
{
|
{
|
||||||
DWORD BytesWritten;
|
DWORD BytesWritten;
|
||||||
|
@ -554,7 +554,7 @@ TuiSetCursorInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WINAPI
|
static BOOL WINAPI
|
||||||
TuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY)
|
TuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, SHORT OldCursorX, SHORT OldCursorY)
|
||||||
{
|
{
|
||||||
CONSOLE_SCREEN_BUFFER_INFO Info;
|
CONSOLE_SCREEN_BUFFER_INFO Info;
|
||||||
DWORD BytesReturned;
|
DWORD BytesReturned;
|
||||||
|
|
|
@ -93,8 +93,8 @@ typedef struct _FRONTEND_VTBL
|
||||||
VOID (WINAPI *CleanupConsole)(struct _CONSOLE* Console);
|
VOID (WINAPI *CleanupConsole)(struct _CONSOLE* Console);
|
||||||
VOID (WINAPI *WriteStream)(struct _CONSOLE* Console,
|
VOID (WINAPI *WriteStream)(struct _CONSOLE* Console,
|
||||||
SMALL_RECT* Block,
|
SMALL_RECT* Block,
|
||||||
LONG CursorStartX,
|
SHORT CursorStartX,
|
||||||
LONG CursorStartY,
|
SHORT CursorStartY,
|
||||||
UINT ScrolledLines,
|
UINT ScrolledLines,
|
||||||
CHAR *Buffer,
|
CHAR *Buffer,
|
||||||
UINT Length);
|
UINT Length);
|
||||||
|
@ -104,8 +104,8 @@ typedef struct _FRONTEND_VTBL
|
||||||
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
|
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
|
||||||
BOOL (WINAPI *SetScreenInfo)(struct _CONSOLE* Console,
|
BOOL (WINAPI *SetScreenInfo)(struct _CONSOLE* Console,
|
||||||
PCONSOLE_SCREEN_BUFFER ScreenBuffer,
|
PCONSOLE_SCREEN_BUFFER ScreenBuffer,
|
||||||
UINT OldCursorX,
|
SHORT OldCursorX,
|
||||||
UINT OldCursorY);
|
SHORT OldCursorY);
|
||||||
BOOL (WINAPI *UpdateScreenInfo)(struct _CONSOLE* Console,
|
BOOL (WINAPI *UpdateScreenInfo)(struct _CONSOLE* Console,
|
||||||
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
|
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
|
||||||
BOOL (WINAPI *IsBufferResizeSupported)(struct _CONSOLE* Console);
|
BOOL (WINAPI *IsBufferResizeSupported)(struct _CONSOLE* Console);
|
||||||
|
|
|
@ -67,15 +67,14 @@ static VOID
|
||||||
HistoryAddEntry(PCONSOLE Console)
|
HistoryAddEntry(PCONSOLE Console)
|
||||||
{
|
{
|
||||||
UNICODE_STRING NewEntry;
|
UNICODE_STRING NewEntry;
|
||||||
PHISTORY_BUFFER Hist;
|
PHISTORY_BUFFER Hist = HistoryCurrentBuffer(Console);
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
|
if (!Hist) return;
|
||||||
|
|
||||||
NewEntry.Length = NewEntry.MaximumLength = Console->LineSize * sizeof(WCHAR);
|
NewEntry.Length = NewEntry.MaximumLength = Console->LineSize * sizeof(WCHAR);
|
||||||
NewEntry.Buffer = Console->LineBuffer;
|
NewEntry.Buffer = Console->LineBuffer;
|
||||||
|
|
||||||
if (!(Hist = HistoryCurrentBuffer(Console)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Don't add blank or duplicate entries */
|
/* Don't add blank or duplicate entries */
|
||||||
if (NewEntry.Length == 0 || Hist->MaxEntries == 0 ||
|
if (NewEntry.Length == 0 || Hist->MaxEntries == 0 ||
|
||||||
(Hist->NumEntries > 0 &&
|
(Hist->NumEntries > 0 &&
|
||||||
|
@ -118,8 +117,9 @@ HistoryAddEntry(PCONSOLE Console)
|
||||||
static VOID
|
static VOID
|
||||||
HistoryGetCurrentEntry(PCONSOLE Console, PUNICODE_STRING Entry)
|
HistoryGetCurrentEntry(PCONSOLE Console, PUNICODE_STRING Entry)
|
||||||
{
|
{
|
||||||
PHISTORY_BUFFER Hist;
|
PHISTORY_BUFFER Hist = HistoryCurrentBuffer(Console);
|
||||||
if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0)
|
|
||||||
|
if (!Hist || Hist->NumEntries == 0)
|
||||||
Entry->Length = 0;
|
Entry->Length = 0;
|
||||||
else
|
else
|
||||||
*Entry = Hist->Entries[Hist->Position];
|
*Entry = Hist->Entries[Hist->Position];
|
||||||
|
@ -173,8 +173,8 @@ LineInputSetPos(PCONSOLE Console, UINT Pos)
|
||||||
if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT)
|
if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT)
|
||||||
{
|
{
|
||||||
PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer;
|
PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer;
|
||||||
UINT OldCursorX = Buffer->CursorPosition.X;
|
SHORT OldCursorX = Buffer->CursorPosition.X;
|
||||||
UINT OldCursorY = Buffer->CursorPosition.Y;
|
SHORT OldCursorY = Buffer->CursorPosition.Y;
|
||||||
INT XY = OldCursorY * Buffer->ScreenBufferSize.X + OldCursorX;
|
INT XY = OldCursorY * Buffer->ScreenBufferSize.X + OldCursorX;
|
||||||
|
|
||||||
XY += (Pos - Console->LinePos);
|
XY += (Pos - Console->LinePos);
|
||||||
|
@ -196,7 +196,7 @@ LineInputEdit(PCONSOLE Console, UINT NumToDelete, UINT NumToInsert, WCHAR *Inser
|
||||||
{
|
{
|
||||||
UINT Pos = Console->LinePos;
|
UINT Pos = Console->LinePos;
|
||||||
UINT NewSize = Console->LineSize - NumToDelete + NumToInsert;
|
UINT NewSize = Console->LineSize - NumToDelete + NumToInsert;
|
||||||
INT i;
|
UINT i;
|
||||||
|
|
||||||
/* Make sure there's always enough room for ending \r\n */
|
/* Make sure there's always enough room for ending \r\n */
|
||||||
if (NewSize + 2 > Console->LineMaxSize)
|
if (NewSize + 2 > Console->LineMaxSize)
|
||||||
|
@ -231,20 +231,19 @@ LineInputEdit(PCONSOLE Console, UINT NumToDelete, UINT NumToInsert, WCHAR *Inser
|
||||||
static VOID
|
static VOID
|
||||||
LineInputRecallHistory(PCONSOLE Console, INT Offset)
|
LineInputRecallHistory(PCONSOLE Console, INT Offset)
|
||||||
{
|
{
|
||||||
PHISTORY_BUFFER Hist;
|
PHISTORY_BUFFER Hist = HistoryCurrentBuffer(Console);
|
||||||
|
UINT Position = 0;
|
||||||
|
|
||||||
if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0)
|
if (!Hist || Hist->NumEntries == 0) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Offset += Hist->Position;
|
Position = Hist->Position + Offset;
|
||||||
Offset = max(Offset, 0);
|
Position = min(max(Position, 0), Hist->NumEntries - 1);
|
||||||
Offset = min(Offset, Hist->NumEntries - 1);
|
Hist->Position = Position;
|
||||||
Hist->Position = Offset;
|
|
||||||
|
|
||||||
LineInputSetPos(Console, 0);
|
LineInputSetPos(Console, 0);
|
||||||
LineInputEdit(Console, Console->LineSize,
|
LineInputEdit(Console, Console->LineSize,
|
||||||
Hist->Entries[Offset].Length / sizeof(WCHAR),
|
Hist->Entries[Hist->Position].Length / sizeof(WCHAR),
|
||||||
Hist->Entries[Offset].Buffer);
|
Hist->Entries[Hist->Position].Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
|
@ -357,8 +356,8 @@ LineInputKeyDown(PCONSOLE Console, KEY_EVENT_RECORD *KeyEvent)
|
||||||
return;
|
return;
|
||||||
case VK_F8:
|
case VK_F8:
|
||||||
/* Search for history entries starting with input. */
|
/* Search for history entries starting with input. */
|
||||||
if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0)
|
Hist = HistoryCurrentBuffer(Console);
|
||||||
return;
|
if (!Hist || Hist->NumEntries == 0) return;
|
||||||
|
|
||||||
/* Like Up/F5, on first time start from current (usually last) entry,
|
/* Like Up/F5, on first time start from current (usually last) entry,
|
||||||
* but on subsequent times start at previous entry. */
|
* but on subsequent times start at previous entry. */
|
||||||
|
@ -455,7 +454,7 @@ CSR_API(SrvGetConsoleCommandHistory)
|
||||||
PHISTORY_BUFFER Hist;
|
PHISTORY_BUFFER Hist;
|
||||||
PBYTE Buffer = (PBYTE)GetCommandHistoryRequest->History;
|
PBYTE Buffer = (PBYTE)GetCommandHistoryRequest->History;
|
||||||
ULONG BufferSize = GetCommandHistoryRequest->Length;
|
ULONG BufferSize = GetCommandHistoryRequest->Length;
|
||||||
INT i;
|
UINT i;
|
||||||
|
|
||||||
if ( !CsrValidateMessageBuffer(ApiMessage,
|
if ( !CsrValidateMessageBuffer(ApiMessage,
|
||||||
(PVOID*)&GetCommandHistoryRequest->History,
|
(PVOID*)&GetCommandHistoryRequest->History,
|
||||||
|
@ -502,7 +501,7 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PHISTORY_BUFFER Hist;
|
PHISTORY_BUFFER Hist;
|
||||||
ULONG Length = 0;
|
ULONG Length = 0;
|
||||||
INT i;
|
UINT i;
|
||||||
|
|
||||||
if (!CsrValidateMessageBuffer(ApiMessage,
|
if (!CsrValidateMessageBuffer(ApiMessage,
|
||||||
(PVOID*)&GetCommandHistoryLengthRequest->ExeName.Buffer,
|
(PVOID*)&GetCommandHistoryLengthRequest->ExeName.Buffer,
|
||||||
|
|
|
@ -268,7 +268,7 @@ ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"HistoryNoDup"))
|
else if (!wcscmp(szValueName, L"HistoryNoDup"))
|
||||||
{
|
{
|
||||||
ConsoleInfo->HistoryNoDup = Value;
|
ConsoleInfo->HistoryNoDup = (BOOLEAN)Value;
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"FullScreen"))
|
else if (!wcscmp(szValueName, L"FullScreen"))
|
||||||
|
@ -278,12 +278,12 @@ ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"QuickEdit"))
|
else if (!wcscmp(szValueName, L"QuickEdit"))
|
||||||
{
|
{
|
||||||
ConsoleInfo->QuickEdit = Value;
|
ConsoleInfo->QuickEdit = (BOOLEAN)Value;
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"InsertMode"))
|
else if (!wcscmp(szValueName, L"InsertMode"))
|
||||||
{
|
{
|
||||||
ConsoleInfo->InsertMode = Value;
|
ConsoleInfo->InsertMode = (BOOLEAN)Value;
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"ScreenBufferSize"))
|
else if (!wcscmp(szValueName, L"ScreenBufferSize"))
|
||||||
|
@ -305,12 +305,12 @@ ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"ScreenColors"))
|
else if (!wcscmp(szValueName, L"ScreenColors"))
|
||||||
{
|
{
|
||||||
ConsoleInfo->ScreenAttrib = Value;
|
ConsoleInfo->ScreenAttrib = (USHORT)Value;
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
}
|
}
|
||||||
else if (!wcscmp(szValueName, L"PopupColors"))
|
else if (!wcscmp(szValueName, L"PopupColors"))
|
||||||
{
|
{
|
||||||
ConsoleInfo->PopupAttrib = Value;
|
ConsoleInfo->PopupAttrib = (USHORT)Value;
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue