Author: jmorlan
Date: Wed May 12 05:03:12 2010
New Revision: 47163
URL:
http://svn.reactos.org/svn/reactos?rev=47163&view=rev
Log:
[WIN32CSR] Get rid of dynamic "LineBuffer": it wasn't being resized properly
in all cases, causing corruption of Win32CsrApiHeap. Replaced with fixed buffer (painting
a line with multiple TextOutW calls if necessary).
Modified:
trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c [iso-8859-1] Wed May 12
05:03:12 2010
@@ -22,7 +22,6 @@
HFONT Font;
unsigned CharWidth;
unsigned CharHeight;
- PWCHAR LineBuffer;
BOOL CursorBlinkOn;
BOOL ForceCursorOff;
CRITICAL_SECTION Lock;
@@ -713,9 +712,6 @@
InitializeCriticalSection(&GuiData->Lock);
- GuiData->LineBuffer = (PWCHAR)HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY,
- Console->Size.X * sizeof(WCHAR));
-
GuiData->Font = CreateFontW(LOWORD(GuiData->FontSize),
0, //HIWORD(GuiData->FontSize),
0,
@@ -895,21 +891,22 @@
for (Line = TopLine; Line <= BottomLine; Line++)
{
+ WCHAR LineBuffer[80];
From = ConioCoordToPointer(Buff, LeftChar, Line);
Start = LeftChar;
- To = GuiData->LineBuffer;
+ To = LineBuffer;
for (Char = LeftChar; Char <= RightChar; Char++)
{
- if (*(From + 1) != LastAttribute)
+ if (*(From + 1) != LastAttribute || (Char - Start == sizeof(LineBuffer) /
sizeof(WCHAR)))
{
TextOutW(hDC,
(Start - Buff->ShowX) * GuiData->CharWidth,
(Line - Buff->ShowY) * GuiData->CharHeight,
- GuiData->LineBuffer,
+ LineBuffer,
Char - Start);
Start = Char;
- To = GuiData->LineBuffer;
+ To = LineBuffer;
Attribute = *(From + 1);
if (Attribute != LastAttribute)
{
@@ -932,7 +929,7 @@
TextOutW(hDC,
(Start - Buff->ShowX) * GuiData->CharWidth,
(Line - Buff->ShowY) * GuiData->CharHeight,
- GuiData->LineBuffer,
+ LineBuffer,
RightChar - Start + 1);
}
@@ -1808,22 +1805,6 @@
windx = LOWORD(pConInfo->WindowSize);
windy = HIWORD(pConInfo->WindowSize);
-
- if (windx > Console->Size.X)
- {
- PWCHAR LineBuffer = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, windx *
sizeof(WCHAR));
- if (LineBuffer)
- {
- HeapFree(Win32CsrApiHeap, 0, GuiData->LineBuffer);
- GuiData->LineBuffer = LineBuffer;
- }
- else
- {
- LeaveCriticalSection(&ActiveBuffer->Header.Lock);
- return;
- }
- }
-
if (windx != Console->Size.X || windy != Console->Size.Y)
{