Author: hbelusca
Date: Wed Jul 3 22:40:58 2013
New Revision: 59420
URL:
http://svn.reactos.org/svn/reactos?rev=59420&view=rev
Log:
[CONSRV]
- Move SrvSetConsoleWindowInfo to a better place.
- When enlarging the console buffer, use the attributes of the last cell of each line to
fill the new cells for each line.
- Remove usage of HAVE_WMEMSET / wmemset for resizing the buffer (NOTE: maybe it will be
needed again later on...)
Modified:
trunk/reactos/win32ss/user/consrv/condrv/text.c
trunk/reactos/win32ss/user/consrv/conoutput.c
trunk/reactos/win32ss/user/consrv/frontendctl.c
Modified: trunk/reactos/win32ss/user/consrv/condrv/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/condrv/text.c [iso-8859-1] Wed Jul 3 22:40:58 2013
@@ -17,12 +17,6 @@
#define NDEBUG
#include <debug.h>
-
-/*
-// Define wmemset(...)
-#include <wchar.h>
-#define HAVE_WMEMSET
-*/
/* GLOBALS ********************************************************************/
@@ -323,13 +317,10 @@
PCHAR_INFO Buffer;
DWORD Offset = 0;
PCHAR_INFO ptr;
+ WORD CurrentAttribute;
USHORT CurrentY;
PCHAR_INFO OldBuffer;
-#ifdef HAVE_WMEMSET
- USHORT value = MAKEWORD(' ', ScreenBuffer->ScreenDefaultAttrib);
-#else
DWORD i;
-#endif
DWORD diff;
/* Buffer size is not allowed to be smaller than the view size */
@@ -374,28 +365,29 @@
RtlCopyMemory(Buffer + Offset, ptr, ScreenBuffer->ScreenBufferSize.X *
sizeof(CHAR_INFO));
Offset += ScreenBuffer->ScreenBufferSize.X;
+ /* The attribute to be used is the one of the last cell of the current line
*/
+ CurrentAttribute = ConioCoordToPointer(ScreenBuffer,
+ ScreenBuffer->ScreenBufferSize.X -
1,
+ CurrentY)->Attributes;
+
diff = Size.X - ScreenBuffer->ScreenBufferSize.X;
- /* Zero new part of it */
-#ifdef HAVE_WMEMSET
- wmemset((PWCHAR)&Buffer[Offset], value, diff);
-#else
+
+ /* Zero-out the new part of the buffer */
for (i = 0; i < diff; i++)
{
ptr = Buffer + Offset;
ptr->Char.UnicodeChar = L' ';
- ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib;
+ ptr->Attributes = CurrentAttribute;
++Offset;
}
-#endif
}
}
if (Size.Y > ScreenBuffer->ScreenBufferSize.Y)
{
diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y);
-#ifdef HAVE_WMEMSET
- wmemset((PWCHAR)&Buffer[Offset], value, diff);
-#else
+
+ /* Zero-out the new part of the buffer */
for (i = 0; i < diff; i++)
{
ptr = Buffer + Offset;
@@ -403,7 +395,6 @@
ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib;
++Offset;
}
-#endif
}
(void)InterlockedExchangePointer((PVOID volatile*)&ScreenBuffer->Buffer,
Buffer);
Modified: trunk/reactos/win32ss/user/consrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/conout…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/conoutput.c [iso-8859-1] Wed Jul 3 22:40:58 2013
@@ -756,4 +756,56 @@
return Status;
}
+
+
+
+
+CSR_API(SrvSetConsoleWindowInfo)
+{
+ NTSTATUS Status;
+ PCONSOLE_SETWINDOWINFO SetWindowInfoRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetWindowInfoRequest;
+ PCONSOLE_SCREEN_BUFFER Buff;
+ SMALL_RECT WindowRect = SetWindowInfoRequest->WindowRect;
+
+ DPRINT("SrvSetConsoleWindowInfo(0x%08x, %d, {L%d, T%d, R%d, B%d})
called\n",
+ SetWindowInfoRequest->OutputHandle, SetWindowInfoRequest->Absolute,
+ WindowRect.Left, WindowRect.Top, WindowRect.Right, WindowRect.Bottom);
+
+ Status =
ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+ SetWindowInfoRequest->OutputHandle,
+ &Buff,
+ GENERIC_READ,
+ TRUE);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ if (SetWindowInfoRequest->Absolute == FALSE)
+ {
+ /* Relative positions given. Transform them to absolute ones */
+ WindowRect.Left += Buff->ViewOrigin.X;
+ WindowRect.Top += Buff->ViewOrigin.Y;
+ WindowRect.Right += Buff->ViewOrigin.X + Buff->ViewSize.X - 1;
+ WindowRect.Bottom += Buff->ViewOrigin.Y + Buff->ViewSize.Y - 1;
+ }
+
+ /* See MSDN documentation on SetConsoleWindowInfo about the performed checks */
+ if ( (WindowRect.Left < 0) || (WindowRect.Top < 0) ||
+ (WindowRect.Right >= Buff->ScreenBufferSize.X) ||
+ (WindowRect.Bottom >= Buff->ScreenBufferSize.Y) ||
+ (WindowRect.Right <= WindowRect.Left) ||
+ (WindowRect.Bottom <= WindowRect.Top) )
+ {
+ ConSrvReleaseScreenBuffer(Buff, TRUE);
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ Buff->ViewOrigin.X = WindowRect.Left;
+ Buff->ViewOrigin.Y = WindowRect.Top;
+
+ Buff->ViewSize.X = WindowRect.Right - WindowRect.Left + 1;
+ Buff->ViewSize.Y = WindowRect.Bottom - WindowRect.Top + 1;
+
+ ConSrvReleaseScreenBuffer(Buff, TRUE);
+ return STATUS_SUCCESS;
+}
+
/* EOF */
Modified: trunk/reactos/win32ss/user/consrv/frontendctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/fronte…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/frontendctl.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/frontendctl.c [iso-8859-1] Wed Jul 3 22:40:58 2013
@@ -278,54 +278,6 @@
return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
}
-CSR_API(SrvSetConsoleWindowInfo)
-{
- NTSTATUS Status;
- PCONSOLE_SETWINDOWINFO SetWindowInfoRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetWindowInfoRequest;
- PCONSOLE_SCREEN_BUFFER Buff;
- SMALL_RECT WindowRect = SetWindowInfoRequest->WindowRect;
-
- DPRINT("SrvSetConsoleWindowInfo(0x%08x, %d, {L%d, T%d, R%d, B%d})
called\n",
- SetWindowInfoRequest->OutputHandle, SetWindowInfoRequest->Absolute,
- WindowRect.Left, WindowRect.Top, WindowRect.Right, WindowRect.Bottom);
-
- Status =
ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
- SetWindowInfoRequest->OutputHandle,
- &Buff,
- GENERIC_READ,
- TRUE);
- if (!NT_SUCCESS(Status)) return Status;
-
- if (SetWindowInfoRequest->Absolute == FALSE)
- {
- /* Relative positions given. Transform them to absolute ones */
- WindowRect.Left += Buff->ViewOrigin.X;
- WindowRect.Top += Buff->ViewOrigin.Y;
- WindowRect.Right += Buff->ViewOrigin.X + Buff->ViewSize.X - 1;
- WindowRect.Bottom += Buff->ViewOrigin.Y + Buff->ViewSize.Y - 1;
- }
-
- /* See MSDN documentation on SetConsoleWindowInfo about the performed checks */
- if ( (WindowRect.Left < 0) || (WindowRect.Top < 0) ||
- (WindowRect.Right >= Buff->ScreenBufferSize.X) ||
- (WindowRect.Bottom >= Buff->ScreenBufferSize.Y) ||
- (WindowRect.Right <= WindowRect.Left) ||
- (WindowRect.Bottom <= WindowRect.Top) )
- {
- ConSrvReleaseScreenBuffer(Buff, TRUE);
- return STATUS_INVALID_PARAMETER;
- }
-
- Buff->ViewOrigin.X = WindowRect.Left;
- Buff->ViewOrigin.Y = WindowRect.Top;
-
- Buff->ViewSize.X = WindowRect.Right - WindowRect.Left + 1;
- Buff->ViewSize.Y = WindowRect.Bottom - WindowRect.Top + 1;
-
- ConSrvReleaseScreenBuffer(Buff, TRUE);
- return STATUS_SUCCESS;
-}
-
CSR_API(SrvGetConsoleWindow)
{
NTSTATUS Status;