Author: hbelusca
Date: Sat Jul 6 15:59:28 2013
New Revision: 59433
URL:
http://svn.reactos.org/svn/reactos?rev=59433&view=rev
Log:
[CONSRV]
- Fix some files' info-header text.
- Move code of SrvSetConsoleWindowInfo to ConDrvSetConsoleWindowInfo.
- Introduce the helper function GetScreenBufferSizeUnits to retrieve screen-buffer
width/height units.
Modified:
trunk/reactos/win32ss/user/consrv/condrv/coninput.c
trunk/reactos/win32ss/user/consrv/condrv/conoutput.c
trunk/reactos/win32ss/user/consrv/condrv/graphics.c
trunk/reactos/win32ss/user/consrv/condrv/text.c
trunk/reactos/win32ss/user/consrv/conoutput.c
trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c
Modified: trunk/reactos/win32ss/user/consrv/condrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/condrv/coninput.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/condrv/coninput.c [iso-8859-1] Sat Jul 6 15:59:28
2013
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/coninput.c
+ * PROJECT: ReactOS Console Driver DLL
+ * FILE: win32ss/user/consrv/condrv/coninput.c
* PURPOSE: Console Input functions
* PROGRAMMERS: Jeffrey Morlan
* Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
@@ -200,7 +200,7 @@
}
-/* PUBLIC SERVER APIS *********************************************************/
+/* PUBLIC DRIVER APIS *********************************************************/
NTSTATUS NTAPI
ConDrvReadConsole(IN PCONSOLE Console,
Modified: trunk/reactos/win32ss/user/consrv/condrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/condrv/conoutput.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/condrv/conoutput.c [iso-8859-1] Sat Jul 6 15:59:28
2013
@@ -1,6 +1,6 @@
/*
* COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Console Server DLL
+ * PROJECT: ReactOS Console Driver DLL
* FILE: win32ss/user/consrv/condrv/conoutput.c
* PURPOSE: General Console Output Functions
* PROGRAMMERS: Jeffrey Morlan
@@ -184,7 +184,7 @@
return (Console ? Console->ActiveBuffer : NULL);
}
-/* PUBLIC SERVER APIS *********************************************************/
+/* PUBLIC DRIVER APIS *********************************************************/
NTSTATUS NTAPI
ConDrvInvalidateBitMapRect(IN PCONSOLE Console,
Modified: trunk/reactos/win32ss/user/consrv/condrv/graphics.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/condrv…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/condrv/graphics.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/condrv/graphics.c [iso-8859-1] Sat Jul 6 15:59:28
2013
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/graphics.c
+ * PROJECT: ReactOS Console Driver DLL
+ * FILE: win32ss/user/consrv/condrv/graphics.c
* PURPOSE: Console Output Functions for graphics-mode screen-buffers
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*
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] Sat Jul 6 15:59:28 2013
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/text.c
+ * PROJECT: ReactOS Console Driver DLL
+ * FILE: win32ss/user/consrv/condrv/text.c
* PURPOSE: Console Output Functions for text-mode screen-buffers
* PROGRAMMERS: Jeffrey Morlan
* Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
@@ -592,7 +592,7 @@
}
-/* PUBLIC SERVER APIS *********************************************************/
+/* PUBLIC DRIVER APIS *********************************************************/
NTSTATUS NTAPI
ConDrvReadConsoleOutput(IN PCONSOLE Console,
@@ -1299,4 +1299,48 @@
return STATUS_SUCCESS;
}
+NTSTATUS NTAPI
+ConDrvSetConsoleWindowInfo(IN PCONSOLE Console,
+ IN PTEXTMODE_SCREEN_BUFFER Buffer,
+ IN BOOLEAN Absolute,
+ IN PSMALL_RECT WindowRect)
+{
+ SMALL_RECT CapturedWindowRect;
+
+ if (Console == NULL || Buffer == NULL || WindowRect == NULL)
+ return STATUS_INVALID_PARAMETER;
+
+ /* Validity check */
+ ASSERT(Console == Buffer->Header.Console);
+
+ CapturedWindowRect = *WindowRect;
+
+ if (Absolute == FALSE)
+ {
+ /* Relative positions given. Transform them to absolute ones */
+ CapturedWindowRect.Left += Buffer->ViewOrigin.X;
+ CapturedWindowRect.Top += Buffer->ViewOrigin.Y;
+ CapturedWindowRect.Right += Buffer->ViewOrigin.X + Buffer->ViewSize.X -
1;
+ CapturedWindowRect.Bottom += Buffer->ViewOrigin.Y + Buffer->ViewSize.Y -
1;
+ }
+
+ /* See MSDN documentation on SetConsoleWindowInfo about the performed checks */
+ if ( (CapturedWindowRect.Left < 0) || (CapturedWindowRect.Top < 0) ||
+ (CapturedWindowRect.Right >= Buffer->ScreenBufferSize.X) ||
+ (CapturedWindowRect.Bottom >= Buffer->ScreenBufferSize.Y) ||
+ (CapturedWindowRect.Right <= CapturedWindowRect.Left) ||
+ (CapturedWindowRect.Bottom <= CapturedWindowRect.Top) )
+ {
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ Buffer->ViewOrigin.X = CapturedWindowRect.Left;
+ Buffer->ViewOrigin.Y = CapturedWindowRect.Top;
+
+ Buffer->ViewSize.X = CapturedWindowRect.Right - CapturedWindowRect.Left + 1;
+ Buffer->ViewSize.Y = CapturedWindowRect.Bottom - CapturedWindowRect.Top + 1;
+
+ return STATUS_SUCCESS;
+}
+
/* EOF */
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] Sat Jul 6 15:59:28 2013
@@ -756,56 +756,38 @@
return Status;
}
-
-
-
-
+NTSTATUS NTAPI
+ConDrvSetConsoleWindowInfo(IN PCONSOLE Console,
+ IN PTEXTMODE_SCREEN_BUFFER Buffer,
+ IN BOOLEAN Absolute,
+ IN PSMALL_RECT WindowRect);
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",
+ // PCONSOLE_SCREEN_BUFFER Buffer;
+ PTEXTMODE_SCREEN_BUFFER Buffer;
+
+ DPRINT1("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);
-
+ SetWindowInfoRequest->WindowRect.Left ,
+ SetWindowInfoRequest->WindowRect.Top ,
+ SetWindowInfoRequest->WindowRect.Right,
+ SetWindowInfoRequest->WindowRect.Bottom);
+
+ // ConSrvGetScreenBuffer
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;
+ &Buffer, GENERIC_READ, TRUE);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ Status = ConDrvSetConsoleWindowInfo(Buffer->Header.Console,
+ Buffer,
+ SetWindowInfoRequest->Absolute,
+ &SetWindowInfoRequest->WindowRect);
+
+ ConSrvReleaseScreenBuffer(Buffer, TRUE);
+ return Status;
}
/* EOF */
Modified: trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/fronte…
==============================================================================
--- trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c [iso-8859-1] Sat Jul 6
15:59:28 2013
@@ -142,6 +142,32 @@
};
/* FUNCTIONS ******************************************************************/
+
+static VOID
+GetScreenBufferSizeUnits(IN PCONSOLE_SCREEN_BUFFER Buffer,
+ IN PGUI_CONSOLE_DATA GuiData,
+ OUT PUINT WidthUnit,
+ OUT PUINT HeightUnit)
+{
+ if (Buffer == NULL || GuiData == NULL ||
+ WidthUnit == NULL || HeightUnit == NULL)
+ {
+ return;
+ }
+
+ if (GetType(Buffer) == TEXTMODE_BUFFER)
+ {
+ *WidthUnit = GuiData->CharWidth ;
+ *HeightUnit = GuiData->CharHeight;
+ }
+ else /* if (GetType(Buffer) == GRAPHICS_BUFFER) */
+ {
+ *WidthUnit = 1;
+ *HeightUnit = 1;
+ }
+}
+
+
static VOID
GuiConsoleAppendMenuItems(HMENU hMenu,
@@ -374,16 +400,7 @@
DWORD Width, Height;
UINT WidthUnit, HeightUnit;
- if (GetType(Buff) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(Buff) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(Buff, GuiData, &WidthUnit, &HeightUnit);
Width = Buff->ViewSize.X * WidthUnit +
2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE));
@@ -576,16 +593,7 @@
PCONSOLE_SCREEN_BUFFER Buffer = ConDrvGetActiveScreenBuffer(Console);
UINT WidthUnit, HeightUnit;
- if (GetType(Buffer) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(Buffer) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(Buffer, GuiData, &WidthUnit, &HeightUnit);
Rect->left = (SmallRect->Left - Buffer->ViewOrigin.X) * WidthUnit ;
Rect->top = (SmallRect->Top - Buffer->ViewOrigin.Y) * HeightUnit;
@@ -1061,16 +1069,7 @@
COORD Coord;
UINT WidthUnit, HeightUnit;
- if (GetType(Buffer) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(Buffer) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(Buffer, GuiData, &WidthUnit, &HeightUnit);
Coord.X = Buffer->ViewOrigin.X + ((SHORT)LOWORD(lParam) / (int)WidthUnit );
Coord.Y = Buffer->ViewOrigin.Y + ((SHORT)HIWORD(lParam) / (int)HeightUnit);
@@ -1400,16 +1399,7 @@
ActiveBuffer = ConDrvGetActiveScreenBuffer(Console);
- if (GetType(ActiveBuffer) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(ActiveBuffer, GuiData, &WidthUnit, &HeightUnit);
windx = CONGUI_MIN_WIDTH * WidthUnit + 2 * (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXEDGE));
windy = CONGUI_MIN_HEIGHT * HeightUnit + 2 * (GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION);
@@ -1443,16 +1433,7 @@
DWORD windx, windy, charx, chary;
UINT WidthUnit, HeightUnit;
- if (GetType(Buff) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(Buff) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(Buff, GuiData, &WidthUnit, &HeightUnit);
GuiData->WindowSizeLock = TRUE;
@@ -1615,16 +1596,7 @@
*pShowXY = sInfo.nPos;
- if (GetType(Buff) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(Buff) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(Buff, GuiData, &WidthUnit, &HeightUnit);
ScrollWindowEx(GuiData->hWindow,
(OldX - Buff->ViewOrigin.X) * WidthUnit ,
@@ -2684,16 +2656,7 @@
ActiveBuffer = ConDrvGetActiveScreenBuffer(GuiData->Console);
if (ActiveBuffer)
{
- if (GetType(ActiveBuffer) == TEXTMODE_BUFFER)
- {
- WidthUnit = GuiData->CharWidth ;
- HeightUnit = GuiData->CharHeight;
- }
- else /* if (GetType(ActiveBuffer) == GRAPHICS_BUFFER) */
- {
- WidthUnit = 1;
- HeightUnit = 1;
- }
+ GetScreenBufferSizeUnits(ActiveBuffer, GuiData, &WidthUnit,
&HeightUnit);
}
else
{