00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #define WWSB_NEUTRAL_FILE 1
00014
00015
#if !defined(FE_SB)
00016
#error This header file should be included with FE_SB
00017
#endif
00018
00019
#if !defined(WWSB_FE) && !defined(WWSB_NOFE)
00020
#error Either WWSB_FE and WWSB_NOFE must be defined.
00021
#endif
00022
00023
#if defined(WWSB_FE) && defined(WWSB_NOFE)
00024
#error Both WWSB_FE and WWSB_NOFE defined.
00025
#endif
00026
00027
#include "dispatch.h"
00028
00029
#ifdef WWSB_FE
00030
#pragma alloc_text(FE_TEXT, FE_WriteRegionToScreenHW)
00031
#endif
00032
00033
#if defined(WWSB_NOFE)
00034
VOID
00035 SB_WriteRegionToScreenHW(
00036 IN
PSCREEN_INFORMATION ScreenInfo,
00037 IN PSMALL_RECT Region
00038 )
00039 #
else
00040
VOID
00041 FE_WriteRegionToScreenHW(
00042 IN
PSCREEN_INFORMATION ScreenInfo,
00043 IN PSMALL_RECT Region
00044 )
00045 #endif
00046 {
00047
SHORT ScreenY,ScreenX;
00048
SHORT WindowY,WindowX,WindowSizeX;
00049 PCHAR_INFO ScreenBufPtr,ScreenBufPtrTmp;
00050 PCHAR_INFO ScreenBufSrc;
00051 COORD TargetSize,SourcePoint;
00052 SMALL_RECT Target;
00053 COORD WindowOrigin;
00054
#ifdef WWSB_FE
00055
PCHAR_IMAGE_INFO CharImageBufPtr,CharImageBufPtrTmp;
00056 PCHAR_IMAGE_INFO CharImageBufSrc;
00057
PFONT_IMAGE FontImage;
00058
#endif
00059
ULONG ModeIndex = ScreenInfo->BufferInfo.TextInfo.ModeIndex;
00060 COORD FsFontSize1 =
RegModeFontPairs[ModeIndex].
FontSize;
00061 COORD FsFontSize2 = FsFontSize1;
00062
NTSTATUS Status;
00063
00064
#ifdef WWSB_FE
00065
SMALL_RECT CaTextRect;
00066 PCONVERSIONAREA_INFORMATION ConvAreaInfo = ScreenInfo->ConvScreenInfo;
00067
PSCREEN_INFORMATION CurrentScreenBuffer = ScreenInfo->Console->CurrentScreenBuffer;
00068
#endif
00069
00070 FsFontSize2.X *= 2;
00071
00072
#ifdef WWSB_NOFE
00073
if (ScreenInfo->Console->FontCacheInformation ==
NULL) {
00074
Status =
SetRAMFontCodePage(ScreenInfo);
00075
if (!
NT_SUCCESS(
Status)) {
00076
return;
00077 }
00078 }
00079
#endif
00080
00081
if (ScreenInfo->Console->Flags &
CONSOLE_VDM_REGISTERED) {
00082
return;
00083 }
00084
00085
#ifdef WWSB_FE
00086
if (ConvAreaInfo) {
00087 CaTextRect.Left = Region->Left - CurrentScreenBuffer->
Window.Left - ConvAreaInfo->CaInfo.coordConView.X;
00088 CaTextRect.Right = CaTextRect.Left + (Region->Right - Region->Left);
00089 CaTextRect.Top = Region->Top - CurrentScreenBuffer->
Window.Top - ConvAreaInfo->CaInfo.coordConView.Y;
00090 CaTextRect.Bottom = CaTextRect.Top + (Region->Bottom - Region->Top);
00091 }
00092
#endif
00093
00094 TargetSize.X = Region->Right - Region->Left + 1;
00095 TargetSize.Y = Region->Bottom - Region->Top + 1;
00096 ScreenBufPtrTmp = ScreenBufPtr = (PCHAR_INFO)
ConsoleHeapAlloc(
MAKE_TAG(
TMP_TAG ),
sizeof(CHAR_INFO) * TargetSize.X * TargetSize.Y);
00097
if (ScreenBufPtr ==
NULL)
00098
return;
00099
#ifdef WWSB_FE
00100
CharImageBufPtrTmp = CharImageBufPtr = (PCHAR_IMAGE_INFO)
ConsoleHeapAlloc(
MAKE_TAG(
TMP_TAG ),
sizeof(CHAR_IMAGE_INFO) * TargetSize.X * TargetSize.Y);
00101
if (CharImageBufPtr ==
NULL)
00102 {
00103
ConsoleHeapFree(ScreenBufPtrTmp);
00104
return;
00105 }
00106
if (ConvAreaInfo) {
00107 SourcePoint.X = CaTextRect.Left;
00108 SourcePoint.Y = CaTextRect.Top;
00109 }
00110
else {
00111 SourcePoint.X = Region->Left;
00112 SourcePoint.Y = Region->Top;
00113 }
00114
#else
00115
SourcePoint.X = Region->Left;
00116 SourcePoint.Y = Region->Top;
00117
#endif
00118
Target.Left = 0;
00119 Target.Top = 0;
00120 Target.Right = TargetSize.X-1;
00121 Target.Bottom = TargetSize.Y-1;
00122
ReadRectFromScreenBuffer(ScreenInfo,
00123 SourcePoint,
00124 ScreenBufPtr,
00125 TargetSize,
00126 &Target
00127 );
00128
00129
00130
00131
00132
00133
if (Region->Bottom > ScreenInfo->Window.Bottom) {
00134 WindowOrigin.X = 0;
00135 WindowOrigin.Y = Region->Bottom - ScreenInfo->Window.Bottom;
00136
SetWindowOrigin(ScreenInfo,
FALSE, WindowOrigin);
00137 }
00138
00139
#ifdef WWSB_FE
00140
if (ConvAreaInfo) {
00141 WindowY = Region->Top - CurrentScreenBuffer->
Window.Top;
00142 WindowX = Region->Left - CurrentScreenBuffer->
Window.Left;
00143 }
00144
else {
00145 WindowY = Region->Top - ScreenInfo->Window.Top;
00146 WindowX = Region->Left - ScreenInfo->Window.Left;
00147 }
00148
#else
00149
WindowY = Region->Top - ScreenInfo->Window.Top;
00150 WindowX = Region->Left - ScreenInfo->Window.Left;
00151
#endif
00152
WindowSizeX =
CONSOLE_WINDOW_SIZE_X(ScreenInfo);
00153
00154
for (ScreenY = Region->Top;
00155 ScreenY <= Region->Bottom;
00156 ScreenY++, WindowY++) {
00157
00158
#ifdef WWSB_FE
00159
CharImageBufSrc = CharImageBufPtr;
00160
SetRAMFont(ScreenInfo, ScreenBufPtr,
WINDOW_SIZE_X(Region));
00161
#else
00162
ULONG CurFrameBufPtr;
00163
00164 CurFrameBufPtr =
SCREEN_BUFFER_POINTER(WindowX,
00165 WindowY,
00166 WindowSizeX,
00167
sizeof(VGA_CHAR));
00168
#endif
00169
ScreenBufSrc = ScreenBufPtr;
00170
00171
00172
for (ScreenX = Region->Left;
00173 ScreenX <= Region->Right;
00174 ScreenX++, ScreenBufPtr++) {
00175
00176
#ifdef WWSB_FE
00177
CharImageBufPtr->CharInfo = *ScreenBufPtr;
00178
Status =
GetFontImagePointer(ScreenInfo->Console->FontCacheInformation,
00179 ScreenBufPtr->Char.UnicodeChar,
00180 ScreenBufPtr->Attributes & COMMON_LVB_SBCSDBCS ?
00181 FsFontSize2 : FsFontSize1,
00182 &FontImage);
00183
if (!
NT_SUCCESS(
Status))
00184 {
00185 CharImageBufPtr->FontImageInfo.FontSize.X = 0;
00186 CharImageBufPtr->FontImageInfo.FontSize.Y = 0;
00187 CharImageBufPtr->FontImageInfo.ImageBits =
NULL;
00188 }
00189
else
00190 {
00191 CharImageBufPtr->FontImageInfo.FontSize = FontImage->
FontSize;
00192 CharImageBufPtr->FontImageInfo.ImageBits = FontImage->
ImageBits;
00193 }
00194 CharImageBufPtr++;
00195
#else
00196
00197
00198
00199
if (ScreenBufPtr->Char.UnicodeChar > 127) {
00200 ScreenBufPtr->Char.AsciiChar =
WcharToChar(
00201 ScreenInfo->Console->OutputCP,
00202 ScreenBufPtr->Char.UnicodeChar);
00203 }
00204
#endif
00205
}
00206
00207
#ifdef WWSB_FE
00208
{
00209 FSCNTL_SCREEN_INFO FsCntl;
00210
00211 FsCntl.Position.X = WindowX;
00212 FsCntl.Position.Y = WindowY;
00213 FsCntl.ScreenSize.X = WindowSizeX;
00214 FsCntl.ScreenSize.Y =
CONSOLE_WINDOW_SIZE_Y(ScreenInfo);
00215 FsCntl.nNumberOfChars =
WINDOW_SIZE_X(Region);
00216 GdiFullscreenControl(FullscreenControlWriteToFrameBufferDB,
00217 CharImageBufSrc,
00218 (Region->Right - Region->Left + 1) *
00219
sizeof(CHAR_IMAGE_INFO),
00220 &FsCntl,
00221 (PULONG)
sizeof(FsCntl));
00222
00223 }
00224
#else
00225
GdiFullscreenControl(FullscreenControlWriteToFrameBuffer,
00226 ScreenBufSrc,
00227 (Region->Right - Region->Left + 1) *
00228
sizeof(CHAR_INFO),
00229 (PULONG) CurFrameBufPtr,
00230 (PULONG) ((Region->Right - Region->Left + 1) *
00231
sizeof(VGA_CHAR)));
00232
#endif
00233
00234 }
00235
00236
ConsoleHeapFree(ScreenBufPtrTmp);
00237
#ifdef WWSB_FE
00238
ConsoleHeapFree(CharImageBufPtrTmp);
00239
#endif
00240
00241 ReverseMousePointer(ScreenInfo, Region);
00242
00243 }
00244