mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
Clean up console code a bit:
- Get/SetConsoleTitle: Get rid of unnecessary handle creation; instead, just have csrss get the console from the ProcessData. - Instead of using ShowX/ShowY to store the origin of the buffer, use the VirtualX member that was put there for this purpose. Rename it to VirtualY, though, since it's a row number. ShowX/ShowY should hold the position of the visible window, once that's implemented. - From the CSRSS_CONSOLE structure: remove hActiveBuffer (redundant), CodePageId (unused), and hWindowIcon (only used as a temporary) - Make cursor coordinates be "logical", not "physical". This simplifies various things. - ConioConsoleFromProcessData: If process has no console, return STATUS_INVALID_HANDLE; don't pretend to succeed (causing many functions to access memory around address 0, which is probably not a good thing). Remove various Console != NULL checks which are now unnecessary. svn path=/trunk/; revision=34568
This commit is contained in:
parent
ecdd55845d
commit
b4db43fa7b
5 changed files with 145 additions and 351 deletions
|
@ -3285,13 +3285,6 @@ GetConsoleTitleW(
|
|||
{
|
||||
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
||||
NTSTATUS Status;
|
||||
HANDLE hConsole;
|
||||
|
||||
hConsole = CreateFileW(L"CONIN$", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hConsole == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_TITLE) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR));
|
||||
|
@ -3302,13 +3295,11 @@ GetConsoleTitleW(
|
|||
}
|
||||
|
||||
CsrRequest = MAKE_CSR_API(GET_TITLE, CSR_CONSOLE);
|
||||
Request->Data.GetTitleRequest.ConsoleHandle = hConsole;
|
||||
|
||||
Status = CsrClientCallServer(Request,
|
||||
NULL,
|
||||
CsrRequest,
|
||||
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_TITLE) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR));
|
||||
CloseHandle(hConsole);
|
||||
if(!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Request->Status)))
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
||||
|
@ -3388,13 +3379,6 @@ SetConsoleTitleW(
|
|||
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
||||
NTSTATUS Status;
|
||||
unsigned int c;
|
||||
HANDLE hConsole;
|
||||
|
||||
hConsole = CreateFileW(L"CONIN$", GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hConsole == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||
max (sizeof(CSR_API_MESSAGE),
|
||||
|
@ -3407,7 +3391,6 @@ SetConsoleTitleW(
|
|||
}
|
||||
|
||||
CsrRequest = MAKE_CSR_API(SET_TITLE, CSR_CONSOLE);
|
||||
Request->Data.SetTitleRequest.Console = hConsole;
|
||||
|
||||
for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ )
|
||||
Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c];
|
||||
|
@ -3416,7 +3399,6 @@ SetConsoleTitleW(
|
|||
NULL,
|
||||
CsrRequest,
|
||||
max (sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + c * sizeof(WCHAR)));
|
||||
CloseHandle(hConsole);
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request->Status ) )
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
||||
|
@ -3446,13 +3428,6 @@ SetConsoleTitleA(
|
|||
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
||||
NTSTATUS Status;
|
||||
unsigned int c;
|
||||
HANDLE hConsole;
|
||||
|
||||
hConsole = CreateFileW(L"CONIN$", GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hConsole == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||
max (sizeof(CSR_API_MESSAGE),
|
||||
|
@ -3465,7 +3440,6 @@ SetConsoleTitleA(
|
|||
}
|
||||
|
||||
CsrRequest = MAKE_CSR_API(SET_TITLE, CSR_CONSOLE);
|
||||
Request->Data.SetTitleRequest.Console = hConsole;
|
||||
|
||||
for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ )
|
||||
Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c];
|
||||
|
@ -3474,7 +3448,6 @@ SetConsoleTitleA(
|
|||
NULL,
|
||||
CsrRequest,
|
||||
max (sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + c * sizeof(WCHAR)));
|
||||
CloseHandle(hConsole);
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request->Status ) )
|
||||
{
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* do a massive memcpy() to scroll the contents of the buffer up to *
|
||||
* scroll the screen on output, instead I just shift down the position *
|
||||
* to be displayed, and let it wrap around to the top again. *
|
||||
* The VirtualX member keeps track of the top X coord that win32 *
|
||||
* The VirtualY member keeps track of the top Y coord that win32 *
|
||||
* clients THINK is currently being displayed, because they think that *
|
||||
* when the display reaches the bottom of the buffer and another line *
|
||||
* being printed causes another line to scroll down, that the buffer IS *
|
||||
|
@ -42,7 +42,7 @@ typedef struct tagCSRSS_SCREEN_BUFFER
|
|||
ULONG CurrentX; /* Current X cursor position */
|
||||
ULONG CurrentY; /* Current Y cursor position */
|
||||
BYTE DefaultAttrib; /* default char attribute */
|
||||
USHORT VirtualX; /* top row of buffer being displayed, reported to callers */
|
||||
USHORT VirtualY; /* top row of buffer being displayed, reported to callers */
|
||||
CONSOLE_CURSOR_INFO CursorInfo;
|
||||
USHORT Mode;
|
||||
} CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER;
|
||||
|
@ -59,7 +59,7 @@ typedef struct tagCSRSS_CONSOLE_VTBL
|
|||
BOOL (STDCALL *UpdateScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
|
||||
BOOL (STDCALL *ChangeTitle)(PCSRSS_CONSOLE Console);
|
||||
VOID (STDCALL *CleanupConsole)(PCSRSS_CONSOLE Console);
|
||||
BOOL (STDCALL *ChangeIcon)(PCSRSS_CONSOLE Console);
|
||||
BOOL (STDCALL *ChangeIcon)(PCSRSS_CONSOLE Console, HICON hWindowIcon);
|
||||
} CSRSS_CONSOLE_VTBL, *PCSRSS_CONSOLE_VTBL;
|
||||
|
||||
typedef struct tagCSRSS_CONSOLE
|
||||
|
@ -71,19 +71,12 @@ typedef struct tagCSRSS_CONSOLE
|
|||
WORD WaitingChars;
|
||||
WORD WaitingLines; /* number of chars and lines in input queue */
|
||||
PCSRSS_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
|
||||
HANDLE hActiveBuffer;
|
||||
WORD Mode; /* Console mode flags */
|
||||
WORD EchoCount; /* count of chars to echo, in line buffered mode */
|
||||
UNICODE_STRING Title; /* Title of console */
|
||||
struct /* active code pages */
|
||||
{
|
||||
UINT Input;
|
||||
UINT Output;
|
||||
} CodePageId;
|
||||
BOOL EarlyReturn; /* wake client and return data, even if we are in line buffered mode, and we don't have a complete line */
|
||||
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
||||
HWND hWindow;
|
||||
HICON hWindowIcon;
|
||||
COORD Size;
|
||||
PVOID PrivateData;
|
||||
UINT CodePage;
|
||||
|
@ -95,11 +88,7 @@ typedef struct tagCSRSS_CONSOLE
|
|||
VOID STDCALL ConioDeleteConsole(Object_t *Object);
|
||||
VOID STDCALL ConioDeleteScreenBuffer(Object_t *Buffer);
|
||||
void STDCALL ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode);
|
||||
void FASTCALL ConioPhysicalToLogical(PCSRSS_SCREEN_BUFFER Buff,
|
||||
ULONG PhysicalX,
|
||||
ULONG PhysicalY,
|
||||
LONG *LogicalX,
|
||||
LONG *LogicalY);
|
||||
DWORD FASTCALL ConioGetBufferOffset(PCSRSS_SCREEN_BUFFER Buf, ULONG X, ULONG Y);
|
||||
VOID FASTCALL ConioDrawConsole(PCSRSS_CONSOLE Console);
|
||||
VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData);
|
||||
VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event, PCSRSS_PROCESS_DATA ProcessData,
|
||||
|
@ -171,7 +160,7 @@ CSR_API(CsrGetProcessList);
|
|||
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), CONIO_SCREEN_BUFFER_MAGIC)
|
||||
#define ConioUnlockScreenBuffer(Buff) \
|
||||
Win32CsrUnlockObject((Object_t *) Buff)
|
||||
#define ConioChangeIcon(Console) (Console)->Vtbl->ChangeIcon(Console)
|
||||
#define ConioChangeIcon(Console, hWindowIcon) (Console)->Vtbl->ChangeIcon(Console, hWindowIcon)
|
||||
|
||||
#endif /* CONIO_H_INCLUDED */
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ ConioConsoleFromProcessData(PCSRSS_PROCESS_DATA ProcessData, PCSRSS_CONSOLE *Con
|
|||
if (!ProcessConsole)
|
||||
{
|
||||
*Console = NULL;
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&(ProcessConsole->Header.Lock));
|
||||
|
@ -82,6 +82,12 @@ ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
|
|||
ConioConsoleCtrlEventTimeout(Event, ProcessData, INFINITE);
|
||||
}
|
||||
|
||||
DWORD FASTCALL
|
||||
ConioGetBufferOffset(PCSRSS_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
|
||||
{
|
||||
return 2 * (((Y + Buff->VirtualY) % Buff->MaxY) * Buff->MaxX + X);
|
||||
}
|
||||
|
||||
#define GET_CELL_BUFFER(b,o)\
|
||||
(b)->Buffer[(o)++]
|
||||
|
||||
|
@ -92,7 +98,7 @@ ConioConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
|
|||
static VOID FASTCALL
|
||||
ClearLineBuffer(PCSRSS_SCREEN_BUFFER Buff)
|
||||
{
|
||||
DWORD Offset = 2 * (Buff->CurrentY * Buff->MaxX);
|
||||
DWORD Offset = ConioGetBufferOffset(Buff, 0, Buff->CurrentY);
|
||||
UINT Pos;
|
||||
|
||||
for (Pos = 0; Pos < Buff->MaxX; Pos++)
|
||||
|
@ -112,6 +118,7 @@ CsrInitConsoleScreenBuffer(PCSRSS_CONSOLE Console,
|
|||
Buffer->Header.ReferenceCount = 0;
|
||||
Buffer->ShowX = 0;
|
||||
Buffer->ShowY = 0;
|
||||
Buffer->VirtualY = 0;
|
||||
Buffer->Buffer = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, Buffer->MaxX * Buffer->MaxY * 2);
|
||||
if (NULL == Buffer->Buffer)
|
||||
{
|
||||
|
@ -153,7 +160,6 @@ CsrInitConsole(PCSRSS_CONSOLE Console)
|
|||
Console->Mode = ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT;
|
||||
Console->EarlyReturn = FALSE;
|
||||
Console->ActiveBuffer = NULL;
|
||||
Console->hActiveBuffer = INVALID_HANDLE_VALUE;
|
||||
InitializeListHead(&Console->InputEvents);
|
||||
Console->CodePage = GetOEMCP();
|
||||
Console->OutputCodePage = GetOEMCP();
|
||||
|
@ -187,7 +193,6 @@ CsrInitConsole(PCSRSS_CONSOLE Console)
|
|||
NewBuffer->CursorInfo.dwSize = 5;
|
||||
/* make console active, and insert into console list */
|
||||
Console->ActiveBuffer = (PCSRSS_SCREEN_BUFFER) NewBuffer;
|
||||
Console->hActiveBuffer = INVALID_HANDLE_VALUE;
|
||||
|
||||
if (! GuiMode)
|
||||
{
|
||||
|
@ -335,7 +340,6 @@ CSR_API(CsrAllocConsole)
|
|||
ProcessData->Console = 0;
|
||||
return Request->Status = Status;
|
||||
}
|
||||
Console->hActiveBuffer = Request->Data.AllocConsoleRequest.OutputHandle;
|
||||
}
|
||||
|
||||
/* Duplicate the Event */
|
||||
|
@ -398,29 +402,23 @@ CSR_API(CsrFreeConsole)
|
|||
static VOID FASTCALL
|
||||
ConioNextLine(PCSRSS_SCREEN_BUFFER Buff, RECT *UpdateRect, UINT *ScrolledLines)
|
||||
{
|
||||
/* If we hit bottom, slide the viewable screen */
|
||||
if (++Buff->CurrentY == Buff->MaxY)
|
||||
{
|
||||
Buff->CurrentY = 0;
|
||||
}
|
||||
/* If we hit bottom, slide the viewable screen */
|
||||
if (Buff->CurrentY == Buff->ShowY)
|
||||
{
|
||||
if (++Buff->ShowY == Buff->MaxY)
|
||||
Buff->CurrentY--;
|
||||
if (++Buff->VirtualY == Buff->MaxY)
|
||||
{
|
||||
Buff->ShowY = 0;
|
||||
Buff->VirtualY = 0;
|
||||
}
|
||||
(*ScrolledLines)++;
|
||||
ClearLineBuffer(Buff);
|
||||
if (UpdateRect->top != 0)
|
||||
{
|
||||
UpdateRect->top--;
|
||||
}
|
||||
}
|
||||
UpdateRect->left = 0;
|
||||
UpdateRect->right = Buff->MaxX - 1;
|
||||
if (UpdateRect->top == (LONG)Buff->CurrentY)
|
||||
{
|
||||
if (++UpdateRect->top == Buff->MaxY)
|
||||
{
|
||||
UpdateRect->top = 0;
|
||||
}
|
||||
}
|
||||
UpdateRect->bottom = Buff->CurrentY;
|
||||
}
|
||||
|
||||
|
@ -434,7 +432,8 @@ ConioWriteConsole(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff,
|
|||
LONG CursorStartX, CursorStartY;
|
||||
UINT ScrolledLines;
|
||||
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY, &CursorStartX, &CursorStartY);
|
||||
CursorStartX = Buff->CurrentX;
|
||||
CursorStartY = Buff->CurrentY;
|
||||
UpdateRect.left = Buff->MaxX;
|
||||
UpdateRect.top = Buff->CurrentY;
|
||||
UpdateRect.right = -1;
|
||||
|
@ -456,31 +455,20 @@ ConioWriteConsole(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff,
|
|||
else if (Buffer[i] == '\b')
|
||||
{
|
||||
/* Only handle BS if we're not on the first pos of the first line */
|
||||
if (0 != Buff->CurrentX || Buff->ShowY != Buff->CurrentY)
|
||||
if (0 != Buff->CurrentX || 0 != Buff->CurrentY)
|
||||
{
|
||||
if (0 == Buff->CurrentX)
|
||||
{
|
||||
/* slide virtual position up */
|
||||
Buff->CurrentX = Buff->MaxX - 1;
|
||||
if (0 == Buff->CurrentY)
|
||||
{
|
||||
Buff->CurrentY = Buff->MaxY;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buff->CurrentY--;
|
||||
}
|
||||
if ((0 == UpdateRect.top && UpdateRect.bottom < (LONG)Buff->CurrentY)
|
||||
|| (0 != UpdateRect.top && (LONG)Buff->CurrentY < UpdateRect.top))
|
||||
{
|
||||
UpdateRect.top = Buff->CurrentY;
|
||||
}
|
||||
Buff->CurrentY--;
|
||||
UpdateRect.top = min(UpdateRect.top, (LONG)Buff->CurrentY);
|
||||
}
|
||||
else
|
||||
{
|
||||
Buff->CurrentX--;
|
||||
Buff->CurrentX--;
|
||||
}
|
||||
Offset = 2 * ((Buff->CurrentY * Buff->MaxX) + Buff->CurrentX);
|
||||
Offset = ConioGetBufferOffset(Buff, Buff->CurrentX, Buff->CurrentY);
|
||||
SET_CELL_BUFFER(Buff, Offset, ' ', Buff->DefaultAttrib);
|
||||
UpdateRect.left = min(UpdateRect.left, (LONG) Buff->CurrentX);
|
||||
UpdateRect.right = max(UpdateRect.right, (LONG) Buff->CurrentX);
|
||||
|
@ -506,7 +494,7 @@ ConioWriteConsole(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff,
|
|||
{
|
||||
EndX = Buff->MaxX;
|
||||
}
|
||||
Offset = 2 * (((Buff->CurrentY * Buff->MaxX)) + Buff->CurrentX);
|
||||
Offset = ConioGetBufferOffset(Buff, Buff->CurrentX, Buff->CurrentY);
|
||||
while (Buff->CurrentX < EndX)
|
||||
{
|
||||
Buff->Buffer[Offset] = ' ';
|
||||
|
@ -532,7 +520,7 @@ ConioWriteConsole(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff,
|
|||
}
|
||||
UpdateRect.left = min(UpdateRect.left, (LONG)Buff->CurrentX);
|
||||
UpdateRect.right = max(UpdateRect.right, (LONG) Buff->CurrentX);
|
||||
Offset = 2 * (((Buff->CurrentY * Buff->MaxX)) + Buff->CurrentX);
|
||||
Offset = ConioGetBufferOffset(Buff, Buff->CurrentX, Buff->CurrentY);
|
||||
Buff->Buffer[Offset++] = Buffer[i];
|
||||
if (Attrib)
|
||||
{
|
||||
|
@ -553,11 +541,7 @@ ConioWriteConsole(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff,
|
|||
}
|
||||
}
|
||||
|
||||
ConioPhysicalToLogical(Buff, UpdateRect.left, UpdateRect.top, &(UpdateRect.left),
|
||||
&(UpdateRect.top));
|
||||
ConioPhysicalToLogical(Buff, UpdateRect.right, UpdateRect.bottom, &(UpdateRect.right),
|
||||
&(UpdateRect.bottom));
|
||||
if (! ConioIsRectEmpty(&UpdateRect) && NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (! ConioIsRectEmpty(&UpdateRect) && Buff == Console->ActiveBuffer)
|
||||
{
|
||||
ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY, ScrolledLines,
|
||||
Buffer, Length);
|
||||
|
@ -709,24 +693,6 @@ CSR_API(CsrReadConsole)
|
|||
return Request->Status;
|
||||
}
|
||||
|
||||
VOID FASTCALL
|
||||
ConioPhysicalToLogical(PCSRSS_SCREEN_BUFFER Buff,
|
||||
ULONG PhysicalX,
|
||||
ULONG PhysicalY,
|
||||
LONG *LogicalX,
|
||||
LONG *LogicalY)
|
||||
{
|
||||
*LogicalX = PhysicalX;
|
||||
if (PhysicalY < Buff->ShowY)
|
||||
{
|
||||
*LogicalY = Buff->MaxY - Buff->ShowY + PhysicalY;
|
||||
}
|
||||
else
|
||||
{
|
||||
*LogicalY = PhysicalY - Buff->ShowY;
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN __inline ConioGetIntersection(
|
||||
RECT *Intersection,
|
||||
RECT *Rect1,
|
||||
|
@ -814,8 +780,8 @@ ConioMoveRegion(PCSRSS_SCREEN_BUFFER ScreenBuffer,
|
|||
}
|
||||
for (i = 0; i < Height; i++)
|
||||
{
|
||||
PWORD SRow = (PWORD)&ScreenBuffer->Buffer[((SY + ScreenBuffer->ShowY) % ScreenBuffer->MaxY) * ScreenBuffer->MaxX * 2];
|
||||
PWORD DRow = (PWORD)&ScreenBuffer->Buffer[((DY + ScreenBuffer->ShowY) % ScreenBuffer->MaxY) * ScreenBuffer->MaxX * 2];
|
||||
PWORD SRow = (PWORD)&ScreenBuffer->Buffer[ConioGetBufferOffset(ScreenBuffer, 0, SY)];
|
||||
PWORD DRow = (PWORD)&ScreenBuffer->Buffer[ConioGetBufferOffset(ScreenBuffer, 0, DY)];
|
||||
|
||||
SX = SrcRegion->left;
|
||||
DX = DstRegion->left;
|
||||
|
@ -934,10 +900,7 @@ CSR_API(CsrWriteConsole)
|
|||
RtlFreeHeap(GetProcessHeap(), 0, Buffer);
|
||||
}
|
||||
}
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
Request->Data.WriteConsoleRequest.NrCharactersWritten = Written;
|
||||
|
||||
|
@ -988,7 +951,6 @@ ConioDeleteConsole(Object_t *Object)
|
|||
}
|
||||
|
||||
Console->ActiveBuffer = NULL;
|
||||
Console->hActiveBuffer = INVALID_HANDLE_VALUE;
|
||||
|
||||
CloseHandle(Console->ActiveEvent);
|
||||
DeleteCriticalSection(&Console->Header.Lock);
|
||||
|
@ -1050,27 +1012,22 @@ ConioProcessChar(PCSRSS_CONSOLE Console,
|
|||
if (VK_UP == KeyEventRecord->InputEvent.Event.KeyEvent.wVirtualKeyCode)
|
||||
{
|
||||
/* only scroll up if there is room to scroll up into */
|
||||
if (Console->ActiveBuffer->ShowY != ((Console->ActiveBuffer->CurrentY + 1) %
|
||||
Console->ActiveBuffer->MaxY))
|
||||
if (Console->ActiveBuffer->CurrentY != Console->ActiveBuffer->MaxY - 1)
|
||||
{
|
||||
Console->ActiveBuffer->ShowY = (Console->ActiveBuffer->ShowY +
|
||||
Console->ActiveBuffer->MaxY - 1) %
|
||||
Console->ActiveBuffer->MaxY;
|
||||
Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY +
|
||||
Console->ActiveBuffer->MaxY - 1) %
|
||||
Console->ActiveBuffer->MaxY;
|
||||
Console->ActiveBuffer->CurrentY++;
|
||||
}
|
||||
}
|
||||
else if (Console->ActiveBuffer->ShowY != Console->ActiveBuffer->CurrentY)
|
||||
/* only scroll down if there is room to scroll down into */
|
||||
else
|
||||
{
|
||||
if (Console->ActiveBuffer->ShowY % Console->ActiveBuffer->MaxY !=
|
||||
Console->ActiveBuffer->CurrentY)
|
||||
/* only scroll down if there is room to scroll down into */
|
||||
if (Console->ActiveBuffer->CurrentY != 0)
|
||||
{
|
||||
if (((Console->ActiveBuffer->CurrentY + 1) % Console->ActiveBuffer->MaxY) !=
|
||||
(Console->ActiveBuffer->ShowY + Console->ActiveBuffer->MaxY) %
|
||||
Console->ActiveBuffer->MaxY)
|
||||
{
|
||||
Console->ActiveBuffer->ShowY = (Console->ActiveBuffer->ShowY + 1) %
|
||||
Console->ActiveBuffer->MaxY;
|
||||
}
|
||||
Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + 1) %
|
||||
Console->ActiveBuffer->MaxY;
|
||||
Console->ActiveBuffer->CurrentY--;
|
||||
}
|
||||
}
|
||||
ConioDrawConsole(Console);
|
||||
|
@ -1363,8 +1320,8 @@ CSR_API(CsrGetScreenBufferInfo)
|
|||
pInfo = &Request->Data.ScreenBufferInfoRequest.Info;
|
||||
pInfo->dwSize.X = Buff->MaxX;
|
||||
pInfo->dwSize.Y = Buff->MaxY;
|
||||
pInfo->dwCursorPosition.X = Buff->CurrentX - Buff->ShowX;
|
||||
pInfo->dwCursorPosition.Y = (Buff->CurrentY + Buff->MaxY - Buff->ShowY) % Buff->MaxY;
|
||||
pInfo->dwCursorPosition.X = Buff->CurrentX;
|
||||
pInfo->dwCursorPosition.Y = Buff->CurrentY;
|
||||
pInfo->wAttributes = Buff->DefaultAttrib;
|
||||
pInfo->srWindow.Left = 0;
|
||||
pInfo->srWindow.Right = Buff->MaxX - 1;
|
||||
|
@ -1401,10 +1358,7 @@ CSR_API(CsrSetCursor)
|
|||
Status = ConioLockScreenBuffer(ProcessData, Request->Data.SetCursorRequest.ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
|
@ -1414,33 +1368,25 @@ CSR_API(CsrSetCursor)
|
|||
NewCursorY < 0 || NewCursorY >= Buff->MaxY)
|
||||
{
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY, &OldCursorX, &OldCursorY);
|
||||
Buff->CurrentX = NewCursorX + Buff->ShowX;
|
||||
Buff->CurrentY = (NewCursorY + Buff->ShowY) % Buff->MaxY;
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
OldCursorX = Buff->CurrentX;
|
||||
OldCursorY = Buff->CurrentY;
|
||||
Buff->CurrentX = NewCursorX;
|
||||
Buff->CurrentY = NewCursorY;
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
if (! ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY))
|
||||
{
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1532,8 +1478,8 @@ CSR_API(CsrWriteConsoleOutputChar)
|
|||
&Buff);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
X = Request->Data.WriteConsoleOutputCharRequest.Coord.X + Buff->ShowX;
|
||||
Y = (Request->Data.WriteConsoleOutputCharRequest.Coord.Y + Buff->ShowY) % Buff->MaxY;
|
||||
X = Request->Data.WriteConsoleOutputCharRequest.Coord.X;
|
||||
Y = (Request->Data.WriteConsoleOutputCharRequest.Coord.Y + Buff->VirtualY) % Buff->MaxY;
|
||||
Length = Request->Data.WriteConsoleOutputCharRequest.Length;
|
||||
Buffer = &Buff->Buffer[2 * (Y * Buff->MaxX + X)];
|
||||
while (Length--)
|
||||
|
@ -1551,15 +1497,15 @@ CSR_API(CsrWriteConsoleOutputChar)
|
|||
X = 0;
|
||||
}
|
||||
}
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
ConioComputeUpdateRect(Buff, &UpdateRect, &Request->Data.WriteConsoleOutputCharRequest.Coord,
|
||||
Request->Data.WriteConsoleOutputCharRequest.Length);
|
||||
ConioDrawRegion(Console, &UpdateRect);
|
||||
}
|
||||
|
||||
Request->Data.WriteConsoleOutputCharRequest.EndCoord.X = X - Buff->ShowX;
|
||||
Request->Data.WriteConsoleOutputCharRequest.EndCoord.Y = (Y + Buff->MaxY - Buff->ShowY) % Buff->MaxY;
|
||||
Request->Data.WriteConsoleOutputCharRequest.EndCoord.X = X;
|
||||
Request->Data.WriteConsoleOutputCharRequest.EndCoord.Y = (Y + Buff->MaxY - Buff->VirtualY) % Buff->MaxY;
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
}
|
||||
|
@ -1568,10 +1514,7 @@ CSR_API(CsrWriteConsoleOutputChar)
|
|||
RtlFreeHeap(GetProcessHeap(), 0, tmpString);
|
||||
}
|
||||
}
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
Request->Data.WriteConsoleOutputCharRequest.NrCharactersWritten = Written;
|
||||
return Request->Status = Status;
|
||||
|
@ -1601,15 +1544,12 @@ CSR_API(CsrFillOutputChar)
|
|||
Status = ConioLockScreenBuffer(ProcessData, Request->Data.FillOutputRequest.ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
X = Request->Data.FillOutputRequest.Position.X + Buff->ShowX;
|
||||
Y = (Request->Data.FillOutputRequest.Position.Y + Buff->ShowY) % Buff->MaxY;
|
||||
X = Request->Data.FillOutputRequest.Position.X;
|
||||
Y = (Request->Data.FillOutputRequest.Position.Y + Buff->VirtualY) % Buff->MaxY;
|
||||
Buffer = &Buff->Buffer[2 * (Y * Buff->MaxX + X)];
|
||||
if(Request->Data.FillOutputRequest.Unicode)
|
||||
ConsoleUnicodeCharToAnsiChar(Console, &Char, &Request->Data.FillOutputRequest.Char.UnicodeChar);
|
||||
|
@ -1632,7 +1572,7 @@ CSR_API(CsrFillOutputChar)
|
|||
}
|
||||
}
|
||||
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
ConioComputeUpdateRect(Buff, &UpdateRect, &Request->Data.FillOutputRequest.Position,
|
||||
Request->Data.FillOutputRequest.Length);
|
||||
|
@ -1640,10 +1580,7 @@ CSR_API(CsrFillOutputChar)
|
|||
}
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
Length = Request->Data.FillOutputRequest.Length;
|
||||
Request->Data.FillOutputRequest.NrCharactersWritten = Length;
|
||||
return Request->Status;
|
||||
|
@ -1763,15 +1700,12 @@ CSR_API(CsrWriteConsoleOutputAttrib)
|
|||
&Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
X = Request->Data.WriteConsoleOutputAttribRequest.Coord.X + Buff->ShowX;
|
||||
Y = (Request->Data.WriteConsoleOutputAttribRequest.Coord.Y + Buff->ShowY) % Buff->MaxY;
|
||||
X = Request->Data.WriteConsoleOutputAttribRequest.Coord.X;
|
||||
Y = (Request->Data.WriteConsoleOutputAttribRequest.Coord.Y + Buff->VirtualY) % Buff->MaxY;
|
||||
Length = Request->Data.WriteConsoleOutputAttribRequest.Length;
|
||||
Buffer = &Buff->Buffer[2 * (Y * Buff->MaxX + X) + 1];
|
||||
Attribute = Request->Data.WriteConsoleOutputAttribRequest.Attribute;
|
||||
|
@ -1790,20 +1724,17 @@ CSR_API(CsrWriteConsoleOutputAttrib)
|
|||
}
|
||||
}
|
||||
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
ConioComputeUpdateRect(Buff, &UpdateRect, &Request->Data.WriteConsoleOutputAttribRequest.Coord,
|
||||
Request->Data.WriteConsoleOutputAttribRequest.Length);
|
||||
ConioDrawRegion(Console, &UpdateRect);
|
||||
}
|
||||
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
Request->Data.WriteConsoleOutputAttribRequest.EndCoord.X = Buff->CurrentX - Buff->ShowX;
|
||||
Request->Data.WriteConsoleOutputAttribRequest.EndCoord.Y = (Buff->CurrentY + Buff->MaxY - Buff->ShowY) % Buff->MaxY;
|
||||
Request->Data.WriteConsoleOutputAttribRequest.EndCoord.X = X;
|
||||
Request->Data.WriteConsoleOutputAttribRequest.EndCoord.Y = (Y + Buff->MaxY - Buff->VirtualY) % Buff->MaxY;
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
|
||||
|
@ -1833,15 +1764,12 @@ CSR_API(CsrFillOutputAttrib)
|
|||
Status = ConioLockScreenBuffer(ProcessData, Request->Data.FillOutputAttribRequest.ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
X = Request->Data.FillOutputAttribRequest.Coord.X + Buff->ShowX;
|
||||
Y = (Request->Data.FillOutputAttribRequest.Coord.Y + Buff->ShowY) % Buff->MaxY;
|
||||
X = Request->Data.FillOutputAttribRequest.Coord.X;
|
||||
Y = (Request->Data.FillOutputAttribRequest.Coord.Y + Buff->VirtualY) % Buff->MaxY;
|
||||
Length = Request->Data.FillOutputAttribRequest.Length;
|
||||
Attr = Request->Data.FillOutputAttribRequest.Attribute;
|
||||
Buffer = &Buff->Buffer[(Y * Buff->MaxX * 2) + (X * 2) + 1];
|
||||
|
@ -1860,7 +1788,7 @@ CSR_API(CsrFillOutputAttrib)
|
|||
}
|
||||
}
|
||||
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
ConioComputeUpdateRect(Buff, &UpdateRect, &Request->Data.FillOutputAttribRequest.Coord,
|
||||
Request->Data.FillOutputAttribRequest.Length);
|
||||
|
@ -1868,10 +1796,7 @@ CSR_API(CsrFillOutputAttrib)
|
|||
}
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1921,10 +1846,7 @@ CSR_API(CsrSetCursorInfo)
|
|||
Status = ConioLockScreenBuffer(ProcessData, Request->Data.SetCursorInfoRequest.ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
|
@ -1945,7 +1867,7 @@ CSR_API(CsrSetCursorInfo)
|
|||
Buff->CursorInfo.dwSize = Size;
|
||||
Buff->CursorInfo.bVisible = Visible;
|
||||
|
||||
if (NULL != Console && ! ConioSetCursorInfo(Console, Buff))
|
||||
if (! ConioSetCursorInfo(Console, Buff))
|
||||
{
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
ConioUnlockConsole(Console);
|
||||
|
@ -1954,10 +1876,7 @@ CSR_API(CsrSetCursorInfo)
|
|||
}
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1979,15 +1898,12 @@ CSR_API(CsrSetTextAttrib)
|
|||
Status = ConioLockScreenBuffer(ProcessData, Request->Data.SetCursorRequest.ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
Buff->DefaultAttrib = Request->Data.SetAttribRequest.Attrib;
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
if (! ConioUpdateScreenInfo(Console, Buff))
|
||||
{
|
||||
|
@ -1998,10 +1914,7 @@ CSR_API(CsrSetTextAttrib)
|
|||
}
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -2095,10 +2008,6 @@ CSR_API(CsrCreateScreenBuffer)
|
|||
{
|
||||
return Request->Status = Status;
|
||||
}
|
||||
if (NULL == Console)
|
||||
{
|
||||
return Request->Status = STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
@ -2162,11 +2071,6 @@ CSR_API(CsrSetScreenBuffer)
|
|||
{
|
||||
return Request->Status = Status;
|
||||
}
|
||||
if (NULL == Console)
|
||||
{
|
||||
DPRINT1("Trying to set screen buffer for app without console\n");
|
||||
return Request->Status = STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
|
@ -2192,7 +2096,6 @@ CSR_API(CsrSetScreenBuffer)
|
|||
}
|
||||
/* tie console to new buffer */
|
||||
Console->ActiveBuffer = Buff;
|
||||
Console->hActiveBuffer = Request->Data.SetScreenBufferRequest.OutputHandle;
|
||||
/* inc ref count on new buffer */
|
||||
InterlockedIncrement(&Buff->Header.ReferenceCount);
|
||||
/* Redraw the console */
|
||||
|
@ -2222,7 +2125,7 @@ CSR_API(CsrSetTitle)
|
|||
return Request->Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = ConioLockConsole(ProcessData, Request->Data.SetTitleRequest.Console, &Console);
|
||||
Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
if(! NT_SUCCESS(Status))
|
||||
|
@ -2252,8 +2155,8 @@ CSR_API(CsrSetTitle)
|
|||
{
|
||||
Request->Status = STATUS_NO_MEMORY;
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status;
|
||||
}
|
||||
|
@ -2268,9 +2171,7 @@ CSR_API(CsrGetTitle)
|
|||
|
||||
Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
|
||||
Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
|
||||
Status = ConioLockConsole(ProcessData,
|
||||
Request->Data.GetTitleRequest.ConsoleHandle,
|
||||
&Console);
|
||||
Status = ConioConsoleFromProcessData(ProcessData, &Console);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Can't get console\n");
|
||||
|
@ -2327,10 +2228,7 @@ CSR_API(CsrWriteConsoleOutput)
|
|||
&Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
|
@ -2371,7 +2269,7 @@ CSR_API(CsrWriteConsoleOutput)
|
|||
for (i = 0, Y = WriteRegion.top; Y <= WriteRegion.bottom; i++, Y++)
|
||||
{
|
||||
CurCharInfo = CharInfo + (i + BufferCoord.Y) * BufferSize.X + BufferCoord.X;
|
||||
Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + WriteRegion.left) * 2;
|
||||
Offset = ConioGetBufferOffset(Buff, WriteRegion.left, Y);
|
||||
for (X = WriteRegion.left; X <= WriteRegion.right; X++)
|
||||
{
|
||||
if (Request->Data.WriteConsoleOutputRequest.Unicode)
|
||||
|
@ -2388,10 +2286,7 @@ CSR_API(CsrWriteConsoleOutput)
|
|||
}
|
||||
}
|
||||
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioDrawRegion(Console, &WriteRegion);
|
||||
}
|
||||
ConioDrawRegion(Console, &WriteRegion);
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
ConioUnlockConsole(Console);
|
||||
|
@ -2474,10 +2369,7 @@ CSR_API(CsrScrollConsoleScreenBuffer)
|
|||
Status = ConioLockScreenBuffer(ProcessData, ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
|
@ -2491,10 +2383,7 @@ CSR_API(CsrScrollConsoleScreenBuffer)
|
|||
if (! ConioGetIntersection(&SrcRegion, &ScreenBuffer, &ScrollRectangle))
|
||||
{
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2516,10 +2405,7 @@ CSR_API(CsrScrollConsoleScreenBuffer)
|
|||
ClipRectangle.bottom = Request->Data.ScrollConsoleScreenBufferRequest.ClipRectangle.Bottom;
|
||||
if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -2542,7 +2428,7 @@ CSR_API(CsrScrollConsoleScreenBuffer)
|
|||
|
||||
ConioMoveRegion(Buff, &SrcRegion, &DstRegion, &ClipRectangle, Fill.Attributes << 8 | (BYTE)FillChar);
|
||||
|
||||
if (NULL != Console && Buff == Console->ActiveBuffer)
|
||||
if (Buff == Console->ActiveBuffer)
|
||||
{
|
||||
ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion);
|
||||
if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &ClipRectangle))
|
||||
|
@ -2553,10 +2439,7 @@ CSR_API(CsrScrollConsoleScreenBuffer)
|
|||
}
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -2589,15 +2472,12 @@ CSR_API(CsrReadConsoleOutputChar)
|
|||
Status = ConioLockScreenBuffer(ProcessData, Request->Data.ReadConsoleOutputCharRequest.ConsoleHandle, &Buff);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
Xpos = Request->Data.ReadConsoleOutputCharRequest.ReadCoord.X + Buff->ShowX;
|
||||
Ypos = (Request->Data.ReadConsoleOutputCharRequest.ReadCoord.Y + Buff->ShowY) % Buff->MaxY;
|
||||
Xpos = Request->Data.ReadConsoleOutputCharRequest.ReadCoord.X;
|
||||
Ypos = (Request->Data.ReadConsoleOutputCharRequest.ReadCoord.Y + Buff->VirtualY) % Buff->MaxY;
|
||||
|
||||
for (i = 0; i < Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead; ++i)
|
||||
{
|
||||
|
@ -2627,14 +2507,11 @@ CSR_API(CsrReadConsoleOutputChar)
|
|||
|
||||
*ReadBuffer = 0;
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
Request->Data.ReadConsoleOutputCharRequest.EndCoord.X = Xpos - Buff->ShowX;
|
||||
Request->Data.ReadConsoleOutputCharRequest.EndCoord.Y = (Ypos - Buff->ShowY + Buff->MaxY) % Buff->MaxY;
|
||||
Request->Data.ReadConsoleOutputCharRequest.EndCoord.X = Xpos;
|
||||
Request->Data.ReadConsoleOutputCharRequest.EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
if (NULL != Console)
|
||||
{
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
Request->Data.ReadConsoleOutputCharRequest.CharsRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)Request->Data.ReadConsoleOutputCharRequest.String) / CharSize;
|
||||
if (Request->Data.ReadConsoleOutputCharRequest.CharsRead * CharSize + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) > sizeof(CSR_API_MESSAGE))
|
||||
|
@ -2668,8 +2545,8 @@ CSR_API(CsrReadConsoleOutputAttrib)
|
|||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
Xpos = Request->Data.ReadConsoleOutputAttribRequest.ReadCoord.X + Buff->ShowX;
|
||||
Ypos = (Request->Data.ReadConsoleOutputAttribRequest.ReadCoord.Y + Buff->ShowY) % Buff->MaxY;
|
||||
Xpos = Request->Data.ReadConsoleOutputAttribRequest.ReadCoord.X;
|
||||
Ypos = (Request->Data.ReadConsoleOutputAttribRequest.ReadCoord.Y + Buff->VirtualY) % Buff->MaxY;
|
||||
|
||||
for (i = 0; i < Request->Data.ReadConsoleOutputAttribRequest.NumAttrsToRead; ++i)
|
||||
{
|
||||
|
@ -2693,8 +2570,8 @@ CSR_API(CsrReadConsoleOutputAttrib)
|
|||
*ReadBuffer = 0;
|
||||
|
||||
Request->Status = STATUS_SUCCESS;
|
||||
Request->Data.ReadConsoleOutputAttribRequest.EndCoord.X = Xpos - Buff->ShowX;
|
||||
Request->Data.ReadConsoleOutputAttribRequest.EndCoord.Y = (Ypos - Buff->ShowY + Buff->MaxY) % Buff->MaxY;
|
||||
Request->Data.ReadConsoleOutputAttribRequest.EndCoord.X = Xpos;
|
||||
Request->Data.ReadConsoleOutputAttribRequest.EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
|
||||
|
||||
ConioUnlockScreenBuffer(Buff);
|
||||
|
||||
|
@ -2890,7 +2767,7 @@ CSR_API(CsrReadConsoleOutput)
|
|||
{
|
||||
CurCharInfo = CharInfo + (i * BufferSize.X);
|
||||
|
||||
Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + ReadRegion.left) * 2;
|
||||
Offset = ConioGetBufferOffset(Buff, ReadRegion.left, Y);
|
||||
for (X = ReadRegion.left; X < ReadRegion.right; ++X)
|
||||
{
|
||||
if (Request->Data.ReadConsoleOutputRequest.Unicode)
|
||||
|
@ -3095,8 +2972,8 @@ CSR_API(CsrSetConsoleIcon)
|
|||
return Request->Status = Status;
|
||||
}
|
||||
|
||||
Console->hWindowIcon = Request->Data.SetConsoleIconRequest.WindowIcon;
|
||||
Request->Status = (ConioChangeIcon(Console) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
|
||||
Request->Status = (ConioChangeIcon(Console, Request->Data.SetConsoleIconRequest.WindowIcon)
|
||||
? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Request->Status;
|
||||
|
|
|
@ -779,21 +779,6 @@ GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create)
|
|||
return (BOOL) DefWindowProcW(hWnd, WM_NCCREATE, 0, (LPARAM) Create);
|
||||
}
|
||||
|
||||
static VOID FASTCALL
|
||||
GuiConsoleGetLogicalCursorPos(PCSRSS_SCREEN_BUFFER Buff, ULONG *CursorX, ULONG *CursorY)
|
||||
{
|
||||
*CursorX = Buff->CurrentX;
|
||||
if (Buff->CurrentY < Buff->ShowY)
|
||||
{
|
||||
*CursorY = Buff->MaxY - Buff->ShowY + Buff->CurrentY;
|
||||
}
|
||||
else
|
||||
{
|
||||
*CursorY = Buff->CurrentY - Buff->ShowY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static VOID FASTCALL
|
||||
GuiConsoleUpdateSelection(HWND hWnd, PRECT rc, PGUI_CONSOLE_DATA GuiData)
|
||||
{
|
||||
|
@ -895,15 +880,7 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
|||
|
||||
for (Line = TopLine; Line <= BottomLine; Line++)
|
||||
{
|
||||
if (Line + Buff->ShowY < Buff->MaxY)
|
||||
{
|
||||
From = Buff->Buffer + ((Line + Buff->ShowY) * Buff->MaxX + LeftChar) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
From = Buff->Buffer +
|
||||
((Line - (Buff->MaxY - Buff->ShowY)) * Buff->MaxX + LeftChar) * 2;
|
||||
}
|
||||
From = Buff->Buffer + ConioGetBufferOffset(Buff, LeftChar, Line);
|
||||
Start = LeftChar;
|
||||
To = GuiData->LineBuffer;
|
||||
|
||||
|
@ -947,9 +924,8 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
|||
if (Buff->CursorInfo.bVisible && GuiData->CursorBlinkOn &&
|
||||
!GuiData->ForceCursorOff)
|
||||
{
|
||||
GuiConsoleGetLogicalCursorPos(Buff,
|
||||
&CursorX,
|
||||
&CursorY);
|
||||
CursorX = Buff->CurrentX;
|
||||
CursorY = Buff->CurrentY;
|
||||
if (LeftChar <= CursorX && CursorX <= RightChar &&
|
||||
TopLine <= CursorY && CursorY <= BottomLine)
|
||||
{
|
||||
|
@ -958,7 +934,7 @@ GuiConsolePaint(PCSRSS_CONSOLE Console,
|
|||
{
|
||||
CursorHeight = 1;
|
||||
}
|
||||
From = Buff->Buffer + (Buff->CurrentY * Buff->MaxX + Buff->CurrentX) * 2 + 1;
|
||||
From = Buff->Buffer + ConioGetBufferOffset(Buff, Buff->CurrentX, Buff->CurrentY) + 1;
|
||||
|
||||
if (*From != DEFAULT_ATTRIB)
|
||||
{
|
||||
|
@ -1165,8 +1141,8 @@ GuiWriteStream(PCSRSS_CONSOLE Console, RECT *Region, LONG CursorStartX, LONG Cur
|
|||
GuiInvalidateCell(GuiData, Console->hWindow, CursorStartX, CursorStartY);
|
||||
}
|
||||
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY,
|
||||
&CursorEndX, &CursorEndY);
|
||||
CursorEndX = Buff->CurrentX;
|
||||
CursorEndY = Buff->CurrentY;
|
||||
if ((CursorEndX < Region->left || Region->right < CursorEndX
|
||||
|| CursorEndY < Region->top || Region->bottom < CursorEndY)
|
||||
&& (CursorEndX != CursorStartX || CursorEndY != CursorStartY))
|
||||
|
@ -1182,8 +1158,8 @@ GuiSetCursorInfo(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff)
|
|||
|
||||
if (Console->ActiveBuffer == Buff)
|
||||
{
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY,
|
||||
&UpdateRect.left, &UpdateRect.top);
|
||||
UpdateRect.left = Buff->CurrentX;
|
||||
UpdateRect.top = Buff->CurrentY;
|
||||
UpdateRect.right = UpdateRect.left;
|
||||
UpdateRect.bottom = UpdateRect.top;
|
||||
ConioDrawRegion(Console, &UpdateRect);
|
||||
|
@ -1206,8 +1182,8 @@ GuiSetScreenInfo(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff, UINT OldCurs
|
|||
UpdateRect.bottom = OldCursorY;
|
||||
ConioDrawRegion(Console, &UpdateRect);
|
||||
/* Redraw char at new position (shows cursor) */
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY,
|
||||
&(UpdateRect.left), &(UpdateRect.top));
|
||||
UpdateRect.left = Buff->CurrentX;
|
||||
UpdateRect.top = Buff->CurrentY;
|
||||
UpdateRect.right = UpdateRect.left;
|
||||
UpdateRect.bottom = UpdateRect.top;
|
||||
ConioDrawRegion(Console, &UpdateRect);
|
||||
|
@ -1236,16 +1212,14 @@ GuiConsoleHandleTimer(HWND hWnd)
|
|||
PCSRSS_CONSOLE Console;
|
||||
PGUI_CONSOLE_DATA GuiData;
|
||||
RECT CursorRect;
|
||||
ULONG CursorX, CursorY;
|
||||
|
||||
GuiConsoleGetDataPointers(hWnd, &Console, &GuiData);
|
||||
GuiData->CursorBlinkOn = ! GuiData->CursorBlinkOn;
|
||||
|
||||
GuiConsoleGetLogicalCursorPos(Console->ActiveBuffer, &CursorX, &CursorY);
|
||||
CursorRect.left = CursorX;
|
||||
CursorRect.top = CursorY;
|
||||
CursorRect.right = CursorX;
|
||||
CursorRect.bottom = CursorY;
|
||||
CursorRect.left = Console->ActiveBuffer->CurrentX;
|
||||
CursorRect.top = Console->ActiveBuffer->CurrentY;
|
||||
CursorRect.right = CursorRect.left;
|
||||
CursorRect.bottom = CursorRect.top;
|
||||
GuiDrawRegion(Console, &CursorRect);
|
||||
}
|
||||
|
||||
|
@ -1575,21 +1549,16 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
{
|
||||
DWORD windx, windy;
|
||||
RECT rect;
|
||||
PCSRSS_SCREEN_BUFFER ActiveBuffer;
|
||||
PCSRSS_PROCESS_DATA ProcessData = NULL;
|
||||
PCSRSS_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
|
||||
|
||||
if (Console->ProcessList.Flink != &Console->ProcessList)
|
||||
{
|
||||
ProcessData = CONTAINING_RECORD(Console->ProcessList.Flink, CSRSS_PROCESS_DATA, ProcessEntry);
|
||||
ConioLockScreenBuffer(ProcessData, Console->hActiveBuffer, (Object_t **)&ActiveBuffer);
|
||||
}
|
||||
EnterCriticalSection(&ActiveBuffer->Header.Lock);
|
||||
|
||||
/* apply text / background color */
|
||||
GuiData->ScreenText = pConInfo->ScreenText;
|
||||
GuiData->ScreenBackground = pConInfo->ScreenBackground;
|
||||
|
||||
/* apply cursor size */
|
||||
Console->ActiveBuffer->CursorInfo.dwSize = max(min(pConInfo->CursorSize, 1), 100);
|
||||
ActiveBuffer->CursorInfo.dwSize = max(min(pConInfo->CursorSize, 1), 100);
|
||||
|
||||
windx = LOWORD(pConInfo->ScreenBuffer);
|
||||
windy = HIWORD(pConInfo->ScreenBuffer);
|
||||
|
@ -1640,13 +1609,13 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
}
|
||||
#endif
|
||||
Offset += (diff * 2);
|
||||
BufferOffset += (Console->ActiveBuffer->MaxX * 2);
|
||||
BufferOffset += (ActiveBuffer->MaxX * 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (windy > Console->ActiveBuffer->MaxY)
|
||||
if (windy > ActiveBuffer->MaxY)
|
||||
{
|
||||
diff = windy - Console->ActiveBuffer->MaxX;
|
||||
diff = windy - ActiveBuffer->MaxX;
|
||||
#if HAVE_WMEMSET
|
||||
wmemset((WCHAR*)&Buffer[Offset], value, diff * windx);
|
||||
#else
|
||||
|
@ -1658,18 +1627,15 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
#endif
|
||||
}
|
||||
|
||||
(void)InterlockedExchangePointer((PVOID volatile *)&Console->ActiveBuffer->Buffer, Buffer);
|
||||
(void)InterlockedExchangePointer((PVOID volatile *)&ActiveBuffer->Buffer, Buffer);
|
||||
HeapFree(Win32CsrApiHeap, 0, OldBuffer);
|
||||
Console->ActiveBuffer->MaxX = windx;
|
||||
Console->ActiveBuffer->MaxY = windy;
|
||||
ActiveBuffer->MaxX = windx;
|
||||
ActiveBuffer->MaxY = windy;
|
||||
InvalidateRect(pConInfo->hConsoleWindow, NULL, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ProcessData)
|
||||
{
|
||||
ConioUnlockScreenBuffer(ActiveBuffer);
|
||||
}
|
||||
LeaveCriticalSection(&ActiveBuffer->Header.Lock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1687,10 +1653,7 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ProcessData)
|
||||
{
|
||||
ConioUnlockScreenBuffer(ActiveBuffer);
|
||||
}
|
||||
LeaveCriticalSection(&ActiveBuffer->Header.Lock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1709,7 +1672,7 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
|
||||
MoveWindow(pConInfo->hConsoleWindow, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE);
|
||||
|
||||
if (Console->Size.X < Console->ActiveBuffer->MaxX)
|
||||
if (Console->Size.X < ActiveBuffer->MaxX)
|
||||
{
|
||||
/* show scrollbar when window becomes smaller than active screen buffer */
|
||||
ShowScrollBar(pConInfo->hConsoleWindow, SB_CTL, TRUE);
|
||||
|
@ -1720,10 +1683,7 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole
|
|||
ShowScrollBar(pConInfo->hConsoleWindow, SB_CTL, FALSE);
|
||||
}
|
||||
}
|
||||
if (ProcessData)
|
||||
{
|
||||
ConioUnlockScreenBuffer(ActiveBuffer);
|
||||
}
|
||||
LeaveCriticalSection(&ActiveBuffer->Header.Lock);
|
||||
InvalidateRect(pConInfo->hConsoleWindow, NULL, TRUE);
|
||||
}
|
||||
|
||||
|
@ -2087,10 +2047,10 @@ GuiChangeTitle(PCSRSS_CONSOLE Console)
|
|||
}
|
||||
|
||||
static BOOL STDCALL
|
||||
GuiChangeIcon(PCSRSS_CONSOLE Console)
|
||||
GuiChangeIcon(PCSRSS_CONSOLE Console, HICON hWindowIcon)
|
||||
{
|
||||
SendMessageW(Console->hWindow, WM_SETICON, ICON_BIG, (LPARAM)Console->hWindowIcon);
|
||||
SendMessageW(Console->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)Console->hWindowIcon);
|
||||
SendMessageW(Console->hWindow, WM_SETICON, ICON_BIG, (LPARAM)hWindowIcon);
|
||||
SendMessageW(Console->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -86,8 +86,7 @@ TuiCopyRect(char *Dest, PCSRSS_SCREEN_BUFFER Buff, RECT *Region)
|
|||
LONG i;
|
||||
PBYTE Src, SrcEnd;
|
||||
|
||||
Src = Buff->Buffer + (((Region->top + Buff->ShowY) % Buff->MaxY) * Buff->MaxX
|
||||
+ Region->left + Buff->ShowX) * 2;
|
||||
Src = Buff->Buffer + ConioGetBufferOffset(Buff, Region->left, Region->top);
|
||||
SrcDelta = Buff->MaxX * 2;
|
||||
SrcEnd = Buff->Buffer + Buff->MaxY * Buff->MaxX * 2;
|
||||
DestDelta = ConioRectWidth(Region) * 2;
|
||||
|
@ -108,7 +107,6 @@ TuiDrawRegion(PCSRSS_CONSOLE Console, RECT *Region)
|
|||
{
|
||||
DWORD BytesReturned;
|
||||
PCSRSS_SCREEN_BUFFER Buff = Console->ActiveBuffer;
|
||||
LONG CursorX, CursorY;
|
||||
PCONSOLE_DRAW ConsoleDraw;
|
||||
UINT ConsoleDrawSize;
|
||||
|
||||
|
@ -125,13 +123,12 @@ TuiDrawRegion(PCSRSS_CONSOLE Console, RECT *Region)
|
|||
DPRINT1("HeapAlloc failed\n");
|
||||
return;
|
||||
}
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY, &CursorX, &CursorY);
|
||||
ConsoleDraw->X = Region->left;
|
||||
ConsoleDraw->Y = Region->top;
|
||||
ConsoleDraw->SizeX = ConioRectWidth(Region);
|
||||
ConsoleDraw->SizeY = ConioRectHeight(Region);
|
||||
ConsoleDraw->CursorX = CursorX;
|
||||
ConsoleDraw->CursorY = CursorY;
|
||||
ConsoleDraw->CursorX = Buff->CurrentX;
|
||||
ConsoleDraw->CursorY = Buff->CurrentY;
|
||||
|
||||
TuiCopyRect((char *) (ConsoleDraw + 1), Buff, Region);
|
||||
|
||||
|
@ -189,7 +186,6 @@ static BOOL STDCALL
|
|||
TuiSetScreenInfo(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO Info;
|
||||
LONG CursorX, CursorY;
|
||||
DWORD BytesReturned;
|
||||
|
||||
if (ActiveConsole->ActiveBuffer != Buff)
|
||||
|
@ -197,9 +193,8 @@ TuiSetScreenInfo(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff, UINT OldCurs
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
ConioPhysicalToLogical(Buff, Buff->CurrentX, Buff->CurrentY, &CursorX, &CursorY);
|
||||
Info.dwCursorPosition.X = CursorX;
|
||||
Info.dwCursorPosition.Y = CursorY;
|
||||
Info.dwCursorPosition.X = Buff->CurrentX;
|
||||
Info.dwCursorPosition.Y = Buff->CurrentY;
|
||||
Info.wAttributes = Buff->DefaultAttrib;
|
||||
|
||||
if (! DeviceIoControl(ConsoleDeviceHandle, IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO,
|
||||
|
|
Loading…
Reference in a new issue