ReactOS  0.4.14-dev-384-g5b37caa
conoutput.c File Reference
#include "consrv.h"
#include "console.h"
#include "include/conio.h"
#include "include/conio2.h"
#include "conoutput.h"
#include "handle.h"
#include <debug.h>
Include dependency graph for conoutput.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI ConDrvInvalidateBitMapRect (IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer, IN PSMALL_RECT Region)
 
 CSR_API (SrvInvalidateBitMapRect)
 
NTSTATUS NTAPI ConDrvGetConsoleCursorInfo (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, OUT PCONSOLE_CURSOR_INFO CursorInfo)
 
 CSR_API (SrvGetConsoleCursorInfo)
 
NTSTATUS NTAPI ConDrvSetConsoleCursorInfo (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCONSOLE_CURSOR_INFO CursorInfo)
 
 CSR_API (SrvSetConsoleCursorInfo)
 
NTSTATUS NTAPI ConDrvSetConsoleCursorPosition (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCOORD Position)
 
 CSR_API (SrvSetConsoleCursorPosition)
 
 CSR_API (SrvCreateConsoleScreenBuffer)
 
NTSTATUS NTAPI ConDrvSetConsoleActiveScreenBuffer (IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer)
 
 CSR_API (SrvSetConsoleActiveScreenBuffer)
 
static NTSTATUS DoWriteConsole (IN PCSR_API_MESSAGE ApiMessage, IN PCSR_THREAD ClientThread, IN BOOL CreateWaitBlock OPTIONAL)
 
static BOOLEAN WriteConsoleThread (IN PLIST_ENTRY WaitList, IN PCSR_THREAD WaitThread, IN PCSR_API_MESSAGE WaitApiMessage, IN PVOID WaitContext, IN PVOID WaitArgument1, IN PVOID WaitArgument2, IN ULONG WaitFlags)
 
NTSTATUS NTAPI ConDrvWriteConsole (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER ScreenBuffer, IN BOOLEAN Unicode, IN PVOID StringBuffer, IN ULONG NumCharsToWrite, OUT PULONG NumCharsWritten OPTIONAL)
 
NTSTATUS NTAPI ConDrvReadConsoleOutput (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, OUT PCHAR_INFO CharInfo, IN PCOORD BufferSize, IN PCOORD BufferCoord, IN OUT PSMALL_RECT ReadRegion)
 
 CSR_API (SrvReadConsoleOutput)
 
NTSTATUS NTAPI ConDrvWriteConsoleOutput (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, IN PCHAR_INFO CharInfo, IN PCOORD BufferSize, IN PCOORD BufferCoord, IN OUT PSMALL_RECT WriteRegion)
 
 CSR_API (SrvWriteConsoleOutput)
 
 CSR_API (SrvWriteConsole)
 
NTSTATUS NTAPI ConDrvReadConsoleOutputString (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, OUT PVOID StringBuffer, IN ULONG NumCodesToRead, IN PCOORD ReadCoord, OUT PCOORD EndCoord, OUT PULONG CodesRead)
 
 CSR_API (SrvReadConsoleOutputString)
 
NTSTATUS NTAPI ConDrvWriteConsoleOutputString (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, IN PVOID StringBuffer, IN ULONG NumCodesToWrite, IN PCOORD WriteCoord)
 
 CSR_API (SrvWriteConsoleOutputString)
 
NTSTATUS NTAPI ConDrvFillConsoleOutput (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, IN PVOID Code, IN ULONG NumCodesToWrite, IN PCOORD WriteCoord)
 
 CSR_API (SrvFillConsoleOutput)
 
NTSTATUS NTAPI ConDrvGetConsoleScreenBufferInfo (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, OUT PCONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo)
 
 CSR_API (SrvGetConsoleScreenBufferInfo)
 
NTSTATUS NTAPI ConDrvSetConsoleTextAttribute (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN WORD Attribute)
 
 CSR_API (SrvSetConsoleTextAttribute)
 
NTSTATUS NTAPI ConDrvSetConsoleScreenBufferSize (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCOORD Size)
 
 CSR_API (SrvSetConsoleScreenBufferSize)
 
NTSTATUS NTAPI ConDrvScrollConsoleScreenBuffer (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, IN PSMALL_RECT ScrollRectangle, IN BOOLEAN UseClipRectangle, IN PSMALL_RECT ClipRectangle OPTIONAL, IN PCOORD DestinationOrigin, IN CHAR_INFO FillChar)
 
 CSR_API (SrvScrollConsoleScreenBuffer)
 
NTSTATUS NTAPI ConDrvSetConsoleWindowInfo (IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Absolute, IN PSMALL_RECT WindowRect)
 
 CSR_API (SrvSetConsoleWindowInfo)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 19 of file conoutput.c.

Function Documentation

◆ ConDrvFillConsoleOutput()

NTSTATUS NTAPI ConDrvFillConsoleOutput ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN CODE_TYPE  CodeType,
IN PVOID  Code,
IN ULONG  NumCodesToWrite,
IN PCOORD  WriteCoord 
)

Definition at line 1070 of file text.c.

1077 {
1078  DWORD X, Y, Length; // , Written = 0;
1079  PCHAR_INFO Ptr;
1081 
1082  if (Console == NULL || Buffer == NULL || Code == NULL ||
1083  WriteCoord == NULL /* || CodesWritten == NULL */)
1084  {
1085  return STATUS_INVALID_PARAMETER;
1086  }
1087 
1088  /* Validity check */
1089  ASSERT(Console == Buffer->Header.Console);
1090 
1091 #if 0
1092  switch (CodeType)
1093  {
1094  case CODE_ASCII:
1095  /* On-place conversion from the ASCII char to the UNICODE char */
1096  ConsoleAnsiCharToUnicodeChar(Console, &Code->UnicodeChar, &Code->AsciiChar);
1097  /* Fall through */
1098  case CODE_UNICODE:
1099  Code = &Code->UnicodeChar;
1100  break;
1101 
1102  case CODE_ATTRIBUTE:
1103  Code = &Code->Attribute;
1104  break;
1105  }
1106 #else
1107  if (CodeType == CODE_ASCII)
1108  {
1109  /* On-place conversion from the ASCII char to the UNICODE char */
1110  // FIXME: What if Code points to an invalid memory zone ??
1112  }
1113 #endif
1114 
1115  X = WriteCoord->X;
1116  Y = (WriteCoord->Y + Buffer->VirtualY) % Buffer->ScreenBufferSize.Y;
1117  Length = NumCodesToWrite;
1118  // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work
1119  // Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X]; // May work
1120 
1121  while (Length--)
1122  {
1123  // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work either
1124  Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X];
1125 
1126  switch (CodeType)
1127  {
1128  case CODE_ASCII:
1129  case CODE_UNICODE:
1130  Ptr->Char.UnicodeChar = *(PWCHAR)Code;
1131  break;
1132 
1133  case CODE_ATTRIBUTE:
1134  Ptr->Attributes = *(PWORD)Code;
1135  break;
1136  }
1137  // ++Ptr;
1138 
1139  // Written++;
1140  if (++X == Buffer->ScreenBufferSize.X)
1141  {
1142  X = 0;
1143 
1144  if (++Y == Buffer->ScreenBufferSize.Y)
1145  {
1146  Y = 0;
1147  }
1148  }
1149  }
1150 
1151  if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
1152  {
1153  ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite);
1155  }
1156 
1157  // CodesWritten = Written; // NumCodesToWrite;
1158  return STATUS_SUCCESS;
1159 }
signed char * PCHAR
Definition: retypes.h:7
#define ConioDrawRegion(Console, Region)
Definition: conio2.h:13
#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar)
Definition: conio.h:361
#define Y(I)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
uint16_t * PWCHAR
Definition: typedefs.h:54
while(1)
Definition: macro.lex.yy.c:740
X(int i_=0)
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
WORD * PWORD
Definition: pedump.c:67
#define Code
Definition: deflate.h:80
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CConsole Console
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
return STATUS_SUCCESS
Definition: btrfs.c:2938
static VOID FASTCALL ConioComputeUpdateRect(IN PTEXTMODE_SCREEN_BUFFER Buff, IN OUT PSMALL_RECT UpdateRect, IN PCOORD Start, IN UINT Length)
Definition: text.c:209
#define X(b, s)

◆ ConDrvGetConsoleCursorInfo()

NTSTATUS NTAPI ConDrvGetConsoleCursorInfo ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
OUT PCONSOLE_CURSOR_INFO  CursorInfo 
)

Definition at line 263 of file conoutput.c.

266 {
267  if (Console == NULL || Buffer == NULL || CursorInfo == NULL)
269 
270  /* Validity check */
271  ASSERT(Console == Buffer->Header.Console);
272 
273  *CursorInfo = Buffer->CursorInfo;
274  // CursorInfo->bVisible = Buffer->CursorInfo.bVisible;
275  // CursorInfo->dwSize = Buffer->CursorInfo.dwSize;
276 
277  return STATUS_SUCCESS;
278 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CSR_API().

◆ ConDrvGetConsoleScreenBufferInfo()

NTSTATUS NTAPI ConDrvGetConsoleScreenBufferInfo ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
OUT PCONSOLE_SCREEN_BUFFER_INFO  ScreenBufferInfo 
)

Definition at line 1162 of file text.c.

1165 {
1166  if (Console == NULL || Buffer == NULL || ScreenBufferInfo == NULL)
1167  return STATUS_INVALID_PARAMETER;
1168 
1169  /* Validity check */
1170  ASSERT(Console == Buffer->Header.Console);
1171 
1172  ScreenBufferInfo->dwSize = Buffer->ScreenBufferSize;
1173  ScreenBufferInfo->dwCursorPosition = Buffer->CursorPosition;
1174  ScreenBufferInfo->wAttributes = Buffer->ScreenDefaultAttrib;
1175  ScreenBufferInfo->srWindow.Left = Buffer->ViewOrigin.X;
1176  ScreenBufferInfo->srWindow.Top = Buffer->ViewOrigin.Y;
1177  ScreenBufferInfo->srWindow.Right = Buffer->ViewOrigin.X + Buffer->ViewSize.X - 1;
1178  ScreenBufferInfo->srWindow.Bottom = Buffer->ViewOrigin.Y + Buffer->ViewSize.Y - 1;
1179 
1180  // FIXME: Refine the computation
1181  ScreenBufferInfo->dwMaximumWindowSize = Buffer->ScreenBufferSize;
1182 
1183  return STATUS_SUCCESS;
1184 }
CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo
Definition: notevil.c:38
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:25
SHORT Bottom
Definition: blue.h:28
SHORT Top
Definition: blue.h:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CConsole Console
SHORT Right
Definition: blue.h:27
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ConDrvInvalidateBitMapRect()

NTSTATUS NTAPI ConDrvInvalidateBitMapRect ( IN PCONSOLE  Console,
IN PCONSOLE_SCREEN_BUFFER  Buffer,
IN PSMALL_RECT  Region 
)

Definition at line 202 of file conoutput.c.

205 {
206  if (Console == NULL || Buffer == NULL || Region == NULL)
208 
209  /* Validity check */
210  ASSERT(Console == Buffer->Header.Console);
211 
212  /* If the output buffer is the current one, redraw the correct portion of the screen */
213  if (Buffer == Console->ActiveBuffer) TermDrawRegion(Console, Region);
214 
215  return STATUS_SUCCESS;
216 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TermDrawRegion(Console, Region)
Definition: term.h:22
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CSR_API().

◆ ConDrvReadConsoleOutput()

NTSTATUS NTAPI ConDrvReadConsoleOutput ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN BOOLEAN  Unicode,
OUT PCHAR_INFO  CharInfo,
IN PCOORD  BufferSize,
IN PCOORD  BufferCoord,
IN OUT PSMALL_RECT  ReadRegion 
)

Definition at line 598 of file text.c.

605 {
606  PCHAR_INFO CurCharInfo;
607  SHORT SizeX, SizeY;
608  SMALL_RECT CapturedReadRegion;
609  SMALL_RECT ScreenRect;
610  DWORD i;
611  PCHAR_INFO Ptr;
612  LONG X, Y;
613  UINT CodePage;
614 
615  if (Console == NULL || Buffer == NULL || CharInfo == NULL ||
616  BufferSize == NULL || BufferCoord == NULL || ReadRegion == NULL)
617  {
619  }
620 
621  /* Validity check */
622  ASSERT(Console == Buffer->Header.Console);
623 
624  CapturedReadRegion = *ReadRegion;
625 
626  /* FIXME: Is this correct? */
627  CodePage = Console->OutputCodePage;
628 
629  SizeX = min(BufferSize->X - BufferCoord->X, ConioRectWidth(&CapturedReadRegion));
630  SizeY = min(BufferSize->Y - BufferCoord->Y, ConioRectHeight(&CapturedReadRegion));
631  CapturedReadRegion.Right = CapturedReadRegion.Left + SizeX;
632  CapturedReadRegion.Bottom = CapturedReadRegion.Top + SizeY;
633 
634  ConioInitRect(&ScreenRect, 0, 0, Buffer->ScreenBufferSize.Y, Buffer->ScreenBufferSize.X);
635  if (!ConioGetIntersection(&CapturedReadRegion, &ScreenRect, &CapturedReadRegion))
636  {
637  return STATUS_SUCCESS;
638  }
639 
640  for (i = 0, Y = CapturedReadRegion.Top; Y < CapturedReadRegion.Bottom; ++i, ++Y)
641  {
642  CurCharInfo = CharInfo + (i * BufferSize->X);
643 
644  Ptr = ConioCoordToPointer(Buffer, CapturedReadRegion.Left, Y);
645  for (X = CapturedReadRegion.Left; X < CapturedReadRegion.Right; ++X)
646  {
647  if (Unicode)
648  {
649  CurCharInfo->Char.UnicodeChar = Ptr->Char.UnicodeChar;
650  }
651  else
652  {
653  // ConsoleUnicodeCharToAnsiChar(Console, &CurCharInfo->Char.AsciiChar, &Ptr->Char.UnicodeChar);
654  WideCharToMultiByte(CodePage, 0, &Ptr->Char.UnicodeChar, 1,
655  &CurCharInfo->Char.AsciiChar, 1, NULL, NULL);
656  }
657  CurCharInfo->Attributes = Ptr->Attributes;
658  ++Ptr;
659  ++CurCharInfo;
660  }
661  }
662 
663  ReadRegion->Left = CapturedReadRegion.Left;
664  ReadRegion->Top = CapturedReadRegion.Top ;
665  ReadRegion->Right = CapturedReadRegion.Left + SizeX - 1;
666  ReadRegion->Bottom = CapturedReadRegion.Top + SizeY - 1;
667 
668  return STATUS_SUCCESS;
669 }
CHAR AsciiChar
Definition: wincon.h:170
#define WideCharToMultiByte
Definition: compat.h:101
#define Y(I)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:140
WCHAR UnicodeChar
Definition: wincon.h:169
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
static ULONG SizeX
Definition: display.c:138
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
smooth NULL
Definition: ftsmooth.c:416
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:25
SHORT Bottom
Definition: blue.h:28
WORD Attributes
Definition: wincon.h:172
#define BufferSize
Definition: classpnp.h:419
unsigned long DWORD
Definition: ntddk_ex.h:95
SHORT Top
Definition: blue.h:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ConioInitRect(Rect, top, left, bottom, right)
Definition: rect.h:20
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
CConsole Console
static __inline BOOLEAN ConioGetIntersection(OUT PSMALL_RECT Intersection, IN PSMALL_RECT Rect1, IN PSMALL_RECT Rect2)
Definition: text.c:150
SHORT Right
Definition: blue.h:27
union _CHAR_INFO::@3175 Char
return STATUS_SUCCESS
Definition: btrfs.c:2938
static ULONG SizeY
Definition: display.c:139
#define X(b, s)

◆ ConDrvReadConsoleOutputString()

NTSTATUS NTAPI ConDrvReadConsoleOutputString ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN CODE_TYPE  CodeType,
OUT PVOID  StringBuffer,
IN ULONG  NumCodesToRead,
IN PCOORD  ReadCoord,
OUT PCOORD  EndCoord,
OUT PULONG  CodesRead 
)

Definition at line 819 of file text.c.

827 {
828  SHORT Xpos, Ypos;
830  ULONG i;
831  ULONG CodeSize;
832  PCHAR_INFO Ptr;
833 
834  if (Console == NULL || Buffer == NULL ||
835  ReadCoord == NULL || EndCoord == NULL || CodesRead == NULL)
836  {
838  }
839 
840  /* Validity checks */
841  ASSERT(Console == Buffer->Header.Console);
842  ASSERT( (StringBuffer != NULL && NumCodesToRead >= 0) ||
843  (StringBuffer == NULL && NumCodesToRead == 0) );
844 
845  switch (CodeType)
846  {
847  case CODE_ASCII:
848  CodeSize = sizeof(CHAR);
849  break;
850 
851  case CODE_UNICODE:
852  CodeSize = sizeof(WCHAR);
853  break;
854 
855  case CODE_ATTRIBUTE:
856  CodeSize = sizeof(WORD);
857  break;
858 
859  default:
861  }
862 
864  Xpos = ReadCoord->X;
865  Ypos = (ReadCoord->Y + Buffer->VirtualY) % Buffer->ScreenBufferSize.Y;
866 
867  /*
868  * MSDN (ReadConsoleOutputAttribute and ReadConsoleOutputCharacter) :
869  *
870  * If the number of attributes (resp. characters) to be read from extends
871  * beyond the end of the specified screen buffer row, attributes (resp.
872  * characters) are read from the next row. If the number of attributes
873  * (resp. characters) to be read from extends beyond the end of the console
874  * screen buffer, attributes (resp. characters) up to the end of the console
875  * screen buffer are read.
876  *
877  * TODO: Do NOT loop up to NumCodesToRead, but stop before
878  * if we are going to overflow...
879  */
880  // Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work
881  for (i = 0; i < min(NumCodesToRead, Buffer->ScreenBufferSize.X * Buffer->ScreenBufferSize.Y); ++i)
882  {
883  // Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work either
884  Ptr = &Buffer->Buffer[Xpos + Ypos * Buffer->ScreenBufferSize.X];
885 
886  switch (CodeType)
887  {
888  case CODE_ASCII:
890  break;
891 
892  case CODE_UNICODE:
893  *(PWCHAR)ReadBuffer = Ptr->Char.UnicodeChar;
894  break;
895 
896  case CODE_ATTRIBUTE:
897  *(PWORD)ReadBuffer = Ptr->Attributes;
898  break;
899  }
900  ReadBuffer = (PVOID)((ULONG_PTR)ReadBuffer + CodeSize);
901  // ++Ptr;
902 
903  Xpos++;
904 
905  if (Xpos == Buffer->ScreenBufferSize.X)
906  {
907  Xpos = 0;
908  Ypos++;
909 
910  if (Ypos == Buffer->ScreenBufferSize.Y)
911  {
912  Ypos = 0;
913  }
914  }
915  }
916 
917  // switch (CodeType)
918  // {
919  // case CODE_UNICODE:
920  // *(PWCHAR)ReadBuffer = 0;
921  // break;
922 
923  // case CODE_ASCII:
924  // *(PCHAR)ReadBuffer = 0;
925  // break;
926 
927  // case CODE_ATTRIBUTE:
928  // *(PWORD)ReadBuffer = 0;
929  // break;
930  // }
931 
932  EndCoord->X = Xpos;
933  EndCoord->Y = (Ypos - Buffer->VirtualY + Buffer->ScreenBufferSize.Y) % Buffer->ScreenBufferSize.Y;
934 
935  *CodesRead = (ULONG)((ULONG_PTR)ReadBuffer - (ULONG_PTR)StringBuffer) / CodeSize;
936  // <= NumCodesToRead
937 
938  return STATUS_SUCCESS;
939 }
signed char * PCHAR
Definition: retypes.h:7
#define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar)
Definition: conio.h:358
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ReadBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:339
uint16_t * PWCHAR
Definition: typedefs.h:54
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
short SHORT
Definition: pedump.c:59
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
WORD * PWORD
Definition: pedump.c:67
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
#define for
Definition: utility.h:88
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define min(a, b)
Definition: monoChain.cc:55
CConsole Console
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define CHAR(Char)
WCHAR StringBuffer[156]
Definition: ldrinit.c:41

◆ ConDrvScrollConsoleScreenBuffer()

NTSTATUS NTAPI ConDrvScrollConsoleScreenBuffer ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN BOOLEAN  Unicode,
IN PSMALL_RECT  ScrollRectangle,
IN BOOLEAN  UseClipRectangle,
IN PSMALL_RECT ClipRectangle  OPTIONAL,
IN PCOORD  DestinationOrigin,
IN CHAR_INFO  FillChar 
)

Definition at line 1133 of file text.c.

1141 {
1142  COORD CapturedDestinationOrigin;
1144  SMALL_RECT SrcRegion;
1145  SMALL_RECT DstRegion;
1146  SMALL_RECT UpdateRegion;
1147  SMALL_RECT CapturedClipRectangle;
1148 
1149  if (Console == NULL || Buffer == NULL || ScrollRectangle == NULL ||
1150  (UseClipRectangle ? ClipRectangle == NULL : FALSE) || DestinationOrigin == NULL)
1151  {
1152  return STATUS_INVALID_PARAMETER;
1153  }
1154 
1155  /* Validity check */
1156  ASSERT(Console == Buffer->Header.Console);
1157 
1158  CapturedDestinationOrigin = *DestinationOrigin;
1159 
1160  /* Make sure the source rectangle is inside the screen buffer */
1161  ConioInitRect(&ScreenBuffer, 0, 0,
1162  Buffer->ScreenBufferSize.Y - 1,
1163  Buffer->ScreenBufferSize.X - 1);
1164  if (!ConioGetIntersection(&SrcRegion, &ScreenBuffer, ScrollRectangle))
1165  {
1166  return STATUS_SUCCESS;
1167  }
1168 
1169  /* If the source was clipped on the left or top, adjust the destination accordingly */
1170  if (ScrollRectangle->Left < 0)
1171  {
1172  CapturedDestinationOrigin.X -= ScrollRectangle->Left;
1173  }
1174  if (ScrollRectangle->Top < 0)
1175  {
1176  CapturedDestinationOrigin.Y -= ScrollRectangle->Top;
1177  }
1178 
1179  if (UseClipRectangle)
1180  {
1181  CapturedClipRectangle = *ClipRectangle;
1182  if (!ConioGetIntersection(&CapturedClipRectangle, &CapturedClipRectangle, &ScreenBuffer))
1183  {
1184  return STATUS_SUCCESS;
1185  }
1186  }
1187  else
1188  {
1189  CapturedClipRectangle = ScreenBuffer;
1190  }
1191 
1192  ConioInitRect(&DstRegion,
1193  CapturedDestinationOrigin.Y,
1194  CapturedDestinationOrigin.X,
1195  CapturedDestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1,
1196  CapturedDestinationOrigin.X + ConioRectWidth(&SrcRegion ) - 1);
1197 
1198  if (!Unicode)
1199  {
1200  WCHAR tmp;
1201  ConsoleOutputAnsiToUnicodeChar(Console, &tmp, &FillChar.Char.AsciiChar);
1202  FillChar.Char.UnicodeChar = tmp;
1203  }
1204 
1205  ConioMoveRegion(Buffer, &SrcRegion, &DstRegion, &CapturedClipRectangle, FillChar);
1206 
1207  if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
1208  {
1209  ConioGetUnion(&UpdateRegion, &SrcRegion, &DstRegion);
1210  if (ConioGetIntersection(&UpdateRegion, &UpdateRegion, &CapturedClipRectangle))
1211  {
1212  /* Draw update region */
1213  TermDrawRegion(Console, &UpdateRegion);
1214  }
1215  }
1216 
1217  return STATUS_SUCCESS;
1218 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TermDrawRegion(Console, Region)
Definition: term.h:22
#define ConsoleOutputAnsiToUnicodeChar(Console, dWChar, sChar)
Definition: text.c:29
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
smooth NULL
Definition: ftsmooth.c:416
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
Definition: bufpool.h:45
ULONG X
Definition: bl.h:1340
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: bl.h:1338
#define ConioInitRect(Rect, top, left, bottom, right)
Definition: rect.h:20
static __inline BOOLEAN ConioGetUnion(OUT PSMALL_RECT Union, IN PSMALL_RECT Rect1, IN PSMALL_RECT Rect2)
Definition: text.c:176
CConsole Console
HANDLE ScreenBuffer
Definition: notevil.c:37
static VOID ConioMoveRegion(PTEXTMODE_SCREEN_BUFFER ScreenBuffer, PSMALL_RECT SrcRegion, PSMALL_RECT DstRegion, PSMALL_RECT ClipRegion, CHAR_INFO FillChar)
Definition: text.c:188
static __inline BOOLEAN ConioGetIntersection(OUT PSMALL_RECT Intersection, IN PSMALL_RECT Rect1, IN PSMALL_RECT Rect2)
Definition: text.c:150
return STATUS_SUCCESS
Definition: btrfs.c:2938
ULONG Y
Definition: bl.h:1341

◆ ConDrvSetConsoleActiveScreenBuffer()

NTSTATUS NTAPI ConDrvSetConsoleActiveScreenBuffer ( IN PCONSOLE  Console,
IN PCONSOLE_SCREEN_BUFFER  Buffer 
)

Definition at line 170 of file conoutput.c.

172 {
173  if (Console == NULL || Buffer == NULL)
175 
176  /* Validity check */
177  ASSERT(Console == Buffer->Header.Console);
178 
179  if (Buffer == Console->ActiveBuffer) return STATUS_SUCCESS;
180 
181  /* If old buffer has no handles, it's now unreferenced */
182  if (Console->ActiveBuffer->Header.ReferenceCount == 0)
183  {
184  ConDrvDeleteScreenBuffer(Console->ActiveBuffer);
185  }
186 
187  /* Tie console to new buffer and signal the change to the frontend */
189 
190  return STATUS_SUCCESS;
191 }
VOID NTAPI ConDrvDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
Definition: conoutput.c:123
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
static VOID ConioSetActiveScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
Definition: conoutput.c:161
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CSR_API().

◆ ConDrvSetConsoleCursorInfo()

NTSTATUS NTAPI ConDrvSetConsoleCursorInfo ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN PCONSOLE_CURSOR_INFO  CursorInfo 
)

Definition at line 281 of file conoutput.c.

284 {
285  ULONG Size;
286  BOOLEAN Visible, Success = TRUE;
287 
288  if (Console == NULL || Buffer == NULL || CursorInfo == NULL)
290 
291  /* Validity check */
292  ASSERT(Console == Buffer->Header.Console);
293 
294  Size = min(max(CursorInfo->dwSize, 1), 100);
295  Visible = CursorInfo->bVisible;
296 
297  if ( (Size != Buffer->CursorInfo.dwSize) ||
298  (Visible && !Buffer->CursorInfo.bVisible) ||
299  (!Visible && Buffer->CursorInfo.bVisible) )
300  {
301  Buffer->CursorInfo.dwSize = Size;
302  Buffer->CursorInfo.bVisible = Visible;
303 
305  }
306 
308 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define TermSetCursorInfo(Console, ScreenBuffer)
Definition: term.h:24
#define min(a, b)
Definition: monoChain.cc:55
CConsole Console
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CSR_API().

◆ ConDrvSetConsoleCursorPosition()

NTSTATUS NTAPI ConDrvSetConsoleCursorPosition ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN PCOORD  Position 
)

Definition at line 311 of file conoutput.c.

314 {
315  SHORT OldCursorX, OldCursorY;
316 
317  if (Console == NULL || Buffer == NULL || Position == NULL)
319 
320  /* Validity check */
321  ASSERT(Console == Buffer->Header.Console);
322 
323  if ( Position->X < 0 || Position->X >= Buffer->ScreenBufferSize.X ||
324  Position->Y < 0 || Position->Y >= Buffer->ScreenBufferSize.Y )
325  {
327  }
328 
329  OldCursorX = Buffer->CursorPosition.X;
330  OldCursorY = Buffer->CursorPosition.Y;
331  Buffer->CursorPosition = *Position;
332  // Buffer->CursorPosition.X = Position->X;
333  // Buffer->CursorPosition.Y = Position->Y;
334  if ( ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer) &&
335  (!TermSetScreenInfo(Console, (PCONSOLE_SCREEN_BUFFER)Buffer, OldCursorX, OldCursorY)) )
336  {
337  return STATUS_UNSUCCESSFUL;
338  }
339 
340  return STATUS_SUCCESS;
341 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static COORD Position
Definition: mouse.c:34
#define TermSetScreenInfo(Console, ScreenBuffer, OldCursorX, OldCursorY)
Definition: term.h:26
short SHORT
Definition: pedump.c:59
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ULONG X
Definition: bl.h:1340
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938
ULONG Y
Definition: bl.h:1341

Referenced by CSR_API().

◆ ConDrvSetConsoleScreenBufferSize()

NTSTATUS NTAPI ConDrvSetConsoleScreenBufferSize ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN PCOORD  Size 
)

Definition at line 1114 of file text.c.

1117 {
1118  NTSTATUS Status;
1119 
1120  if (Console == NULL || Buffer == NULL || Size == NULL)
1121  return STATUS_INVALID_PARAMETER;
1122 
1123  /* Validity check */
1124  ASSERT(Console == Buffer->Header.Console);
1125 
1128 
1129  return Status;
1130 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define TermResizeTerminal(Console)
Definition: term.h:28
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
NTSTATUS ConioResizeBuffer(PCONSOLE Console, PTEXTMODE_SCREEN_BUFFER ScreenBuffer, COORD Size)
Definition: text.c:257
CConsole Console

◆ ConDrvSetConsoleTextAttribute()

NTSTATUS NTAPI ConDrvSetConsoleTextAttribute ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN WORD  Attribute 
)

Definition at line 1099 of file text.c.

1102 {
1103  if (Console == NULL || Buffer == NULL)
1104  return STATUS_INVALID_PARAMETER;
1105 
1106  /* Validity check */
1107  ASSERT(Console == Buffer->Header.Console);
1108 
1109  Buffer->ScreenDefaultAttrib = Attributes;
1110  return STATUS_SUCCESS;
1111 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ConDrvSetConsoleWindowInfo()

NTSTATUS NTAPI ConDrvSetConsoleWindowInfo ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN BOOLEAN  Absolute,
IN PSMALL_RECT  WindowRect 
)

Definition at line 1221 of file text.c.

1225 {
1226  SMALL_RECT CapturedWindowRect;
1227  COORD LargestWindowSize;
1228 
1229  if (Console == NULL || Buffer == NULL || WindowRect == NULL)
1230  return STATUS_INVALID_PARAMETER;
1231 
1232  /* Validity check */
1233  ASSERT(Console == Buffer->Header.Console);
1234 
1235  CapturedWindowRect = *WindowRect;
1236 
1237  if (!Absolute)
1238  {
1239  /* Relative positions are given, transform them to absolute ones */
1240  CapturedWindowRect.Left += Buffer->ViewOrigin.X;
1241  CapturedWindowRect.Top += Buffer->ViewOrigin.Y;
1242  CapturedWindowRect.Right += Buffer->ViewOrigin.X + Buffer->ViewSize.X - 1;
1243  CapturedWindowRect.Bottom += Buffer->ViewOrigin.Y + Buffer->ViewSize.Y - 1;
1244  }
1245 
1246  /*
1247  * The MSDN documentation on SetConsoleWindowInfo is partially wrong about
1248  * the performed checks this API performs. While it is correct that the
1249  * 'Right'/'Bottom' members cannot be strictly smaller than the 'Left'/'Top'
1250  * members, they can be equal.
1251  * Also, if the 'Left' or 'Top' members are negative, this is automatically
1252  * corrected for, and the window rectangle coordinates are shifted accordingly.
1253  */
1254  if ((CapturedWindowRect.Right < CapturedWindowRect.Left) ||
1255  (CapturedWindowRect.Bottom < CapturedWindowRect.Top))
1256  {
1257  return STATUS_INVALID_PARAMETER;
1258  }
1259 
1260  /*
1261  * Forbid window sizes larger than the largest allowed console window size,
1262  * taking into account the size of the console screen buffer.
1263  */
1264  TermGetLargestConsoleWindowSize(Console, &LargestWindowSize);
1265  LargestWindowSize.X = min(LargestWindowSize.X, Buffer->ScreenBufferSize.X);
1266  LargestWindowSize.Y = min(LargestWindowSize.Y, Buffer->ScreenBufferSize.Y);
1267  if ((CapturedWindowRect.Right - CapturedWindowRect.Left + 1 > LargestWindowSize.X) ||
1268  (CapturedWindowRect.Bottom - CapturedWindowRect.Top + 1 > LargestWindowSize.Y))
1269  {
1270  return STATUS_INVALID_PARAMETER;
1271  }
1272 
1273  /* Shift the window rectangle coordinates if 'Left' or 'Top' are negative */
1274  if (CapturedWindowRect.Left < 0)
1275  {
1276  CapturedWindowRect.Right -= CapturedWindowRect.Left;
1277  CapturedWindowRect.Left = 0;
1278  }
1279  if (CapturedWindowRect.Top < 0)
1280  {
1281  CapturedWindowRect.Bottom -= CapturedWindowRect.Top;
1282  CapturedWindowRect.Top = 0;
1283  }
1284 
1285  /* Clip the window rectangle to the screen buffer */
1286  CapturedWindowRect.Right = min(CapturedWindowRect.Right , Buffer->ScreenBufferSize.X);
1287  CapturedWindowRect.Bottom = min(CapturedWindowRect.Bottom, Buffer->ScreenBufferSize.Y);
1288 
1289  Buffer->ViewOrigin.X = CapturedWindowRect.Left;
1290  Buffer->ViewOrigin.Y = CapturedWindowRect.Top;
1291 
1292  Buffer->ViewSize.X = CapturedWindowRect.Right - CapturedWindowRect.Left + 1;
1293  Buffer->ViewSize.Y = CapturedWindowRect.Bottom - CapturedWindowRect.Top + 1;
1294 
1296 
1297  return STATUS_SUCCESS;
1298 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TermResizeTerminal(Console)
Definition: term.h:28
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:25
ULONG X
Definition: bl.h:1340
SHORT Bottom
Definition: blue.h:28
#define TermGetLargestConsoleWindowSize(Console, pSize)
Definition: term.h:34
SHORT Top
Definition: blue.h:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: bl.h:1338
#define min(a, b)
Definition: monoChain.cc:55
CConsole Console
SHORT Right
Definition: blue.h:27
return STATUS_SUCCESS
Definition: btrfs.c:2938
ULONG Y
Definition: bl.h:1341

◆ ConDrvWriteConsole()

NTSTATUS NTAPI ConDrvWriteConsole ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  ScreenBuffer,
IN BOOLEAN  Unicode,
IN PVOID  StringBuffer,
IN ULONG  NumCharsToWrite,
OUT PULONG NumCharsWritten  OPTIONAL 
)

Definition at line 655 of file text.c.

661 {
663  PWCHAR Buffer = NULL;
664  ULONG Written = 0;
665  ULONG Length;
666 
667  if (Console == NULL || ScreenBuffer == NULL /* || StringBuffer == NULL */)
669 
670  /* Validity checks */
671  ASSERT(Console == ScreenBuffer->Header.Console);
672  ASSERT((StringBuffer != NULL) || (StringBuffer == NULL && NumCharsToWrite == 0));
673 
674  /* Stop here if the console is paused */
675  if (Console->UnpauseEvent != NULL) return STATUS_PENDING;
676 
677  /* Convert the string to UNICODE */
678  if (Unicode)
679  {
681  }
682  else
683  {
684  Length = MultiByteToWideChar(Console->OutputCodePage, 0,
686  NumCharsToWrite,
687  NULL, 0);
688  Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR));
689  if (Buffer)
690  {
691  MultiByteToWideChar(Console->OutputCodePage, 0,
693  NumCharsToWrite,
694  (PWCHAR)Buffer, Length);
695  }
696  else
697  {
699  }
700  }
701 
702  /* Send it */
703  if (Buffer)
704  {
705  if (NT_SUCCESS(Status))
706  {
708  ScreenBuffer,
709  Buffer,
710  NumCharsToWrite,
711  TRUE);
712  if (NT_SUCCESS(Status))
713  {
714  Written = NumCharsToWrite;
715  }
716  }
717 
718  if (!Unicode) RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
719  }
720 
721  if (NumCharsWritten) *NumCharsWritten = Written;
722 
723  return Status;
724 }
signed char * PCHAR
Definition: retypes.h:7
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
uint16_t * PWCHAR
Definition: typedefs.h:54
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define MultiByteToWideChar
Definition: compat.h:100
CConsole Console
HANDLE ScreenBuffer
Definition: notevil.c:37
unsigned int ULONG
Definition: retypes.h:1
#define TermWriteStream(Console, ScreenBuffer, Buffer, Length, Attrib)
Definition: term.h:17
return STATUS_SUCCESS
Definition: btrfs.c:2938
WCHAR StringBuffer[156]
Definition: ldrinit.c:41

◆ ConDrvWriteConsoleOutput()

NTSTATUS NTAPI ConDrvWriteConsoleOutput ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN BOOLEAN  Unicode,
IN PCHAR_INFO  CharInfo,
IN PCOORD  BufferSize,
IN PCOORD  BufferCoord,
IN OUT PSMALL_RECT  WriteRegion 
)

Definition at line 672 of file text.c.

679 {
680  SHORT i, X, Y, SizeX, SizeY;
682  PCHAR_INFO CurCharInfo;
683  SMALL_RECT CapturedWriteRegion;
684  PCHAR_INFO Ptr;
685 
686  if (Console == NULL || Buffer == NULL || CharInfo == NULL ||
687  BufferSize == NULL || BufferCoord == NULL || WriteRegion == NULL)
688  {
690  }
691 
692  /* Validity check */
693  ASSERT(Console == Buffer->Header.Console);
694 
695  CapturedWriteRegion = *WriteRegion;
696 
697  SizeX = min(BufferSize->X - BufferCoord->X, ConioRectWidth(&CapturedWriteRegion));
698  SizeY = min(BufferSize->Y - BufferCoord->Y, ConioRectHeight(&CapturedWriteRegion));
699  CapturedWriteRegion.Right = CapturedWriteRegion.Left + SizeX - 1;
700  CapturedWriteRegion.Bottom = CapturedWriteRegion.Top + SizeY - 1;
701 
702  /* Make sure WriteRegion is inside the screen buffer */
703  ConioInitRect(&ScreenBuffer, 0, 0, Buffer->ScreenBufferSize.Y - 1, Buffer->ScreenBufferSize.X - 1);
704  if (!ConioGetIntersection(&CapturedWriteRegion, &ScreenBuffer, &CapturedWriteRegion))
705  {
706  /*
707  * It is okay to have a WriteRegion completely outside
708  * the screen buffer. No data is written then.
709  */
710  return STATUS_SUCCESS;
711  }
712 
713  for (i = 0, Y = CapturedWriteRegion.Top; Y <= CapturedWriteRegion.Bottom; i++, Y++)
714  {
715  CurCharInfo = CharInfo + (i + BufferCoord->Y) * BufferSize->X + BufferCoord->X;
716 
717  Ptr = ConioCoordToPointer(Buffer, CapturedWriteRegion.Left, Y);
718  for (X = CapturedWriteRegion.Left; X <= CapturedWriteRegion.Right; X++)
719  {
720  if (Unicode)
721  {
722  Ptr->Char.UnicodeChar = CurCharInfo->Char.UnicodeChar;
723  }
724  else
725  {
726  ConsoleAnsiCharToUnicodeChar(Console, &Ptr->Char.UnicodeChar, &CurCharInfo->Char.AsciiChar);
727  }
728  Ptr->Attributes = CurCharInfo->Attributes;
729  ++Ptr;
730  ++CurCharInfo;
731  }
732  }
733 
734  ConioDrawRegion(Console, &CapturedWriteRegion);
735 
736  WriteRegion->Left = CapturedWriteRegion.Left;
737  WriteRegion->Top = CapturedWriteRegion.Top ;
738  WriteRegion->Right = CapturedWriteRegion.Left + SizeX - 1;
739  WriteRegion->Bottom = CapturedWriteRegion.Top + SizeY - 1;
740 
741  return STATUS_SUCCESS;
742 }
#define ConioDrawRegion(Console, Region)
Definition: conio2.h:13
#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar)
Definition: conio.h:361
CHAR AsciiChar
Definition: wincon.h:170
#define Y(I)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:140
WCHAR UnicodeChar
Definition: wincon.h:169
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
static ULONG SizeX
Definition: display.c:138
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
short SHORT
Definition: pedump.c:59
#define ConioRectWidth(Rect)
Definition: readwrite.c:24
smooth NULL
Definition: ftsmooth.c:416
#define ConioRectHeight(Rect)
Definition: readwrite.c:22
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:25
SHORT Bottom
Definition: blue.h:28
WORD Attributes
Definition: wincon.h:172
#define BufferSize
Definition: classpnp.h:419
SHORT Top
Definition: blue.h:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ConioInitRect(Rect, top, left, bottom, right)
Definition: rect.h:20
#define min(a, b)
Definition: monoChain.cc:55
CConsole Console
HANDLE ScreenBuffer
Definition: notevil.c:37
static __inline BOOLEAN ConioGetIntersection(OUT PSMALL_RECT Intersection, IN PSMALL_RECT Rect1, IN PSMALL_RECT Rect2)
Definition: text.c:150
SHORT Right
Definition: blue.h:27
union _CHAR_INFO::@3175 Char
return STATUS_SUCCESS
Definition: btrfs.c:2938
static ULONG SizeY
Definition: display.c:139
#define X(b, s)

◆ ConDrvWriteConsoleOutputString()

NTSTATUS NTAPI ConDrvWriteConsoleOutputString ( IN PCONSOLE  Console,
IN PTEXTMODE_SCREEN_BUFFER  Buffer,
IN CODE_TYPE  CodeType,
IN PVOID  StringBuffer,
IN ULONG  NumCodesToWrite,
IN PCOORD  WriteCoord 
)

Definition at line 942 of file text.c.

950 {
953  PWCHAR tmpString = NULL;
954  DWORD X, Y, Length; // , Written = 0;
955  ULONG CodeSize;
957  PCHAR_INFO Ptr;
958 
959  if (Console == NULL || Buffer == NULL ||
960  WriteCoord == NULL /* || EndCoord == NULL || CodesWritten == NULL */)
961  {
963  }
964 
965  /* Validity checks */
966  ASSERT(Console == Buffer->Header.Console);
967  ASSERT( (StringBuffer != NULL && NumCodesToWrite >= 0) ||
968  (StringBuffer == NULL && NumCodesToWrite == 0) );
969 
970  switch (CodeType)
971  {
972  case CODE_ASCII:
973  CodeSize = sizeof(CHAR);
974  break;
975 
976  case CODE_UNICODE:
977  CodeSize = sizeof(WCHAR);
978  break;
979 
980  case CODE_ATTRIBUTE:
981  CodeSize = sizeof(WORD);
982  break;
983 
984  default:
986  }
987 
988  if (CodeType == CODE_ASCII)
989  {
990  /* Convert the ASCII string into Unicode before writing it to the console */
991  Length = MultiByteToWideChar(Console->OutputCodePage, 0,
993  NumCodesToWrite,
994  NULL, 0);
995  tmpString = WriteBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR));
996  if (WriteBuffer)
997  {
998  MultiByteToWideChar(Console->OutputCodePage, 0,
1000  NumCodesToWrite,
1002  }
1003  else
1004  {
1006  }
1007  }
1008  else
1009  {
1010  /* For CODE_UNICODE or CODE_ATTRIBUTE, we are already OK */
1012  }
1013 
1014  if (WriteBuffer == NULL || !NT_SUCCESS(Status)) goto Cleanup;
1015 
1016  X = WriteCoord->X;
1017  Y = (WriteCoord->Y + Buffer->VirtualY) % Buffer->ScreenBufferSize.Y;
1018  Length = NumCodesToWrite;
1019  // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work
1020  // Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X]; // May work
1021 
1022  while (Length--)
1023  {
1024  // Ptr = ConioCoordToPointer(Buffer, X, Y); // Doesn't work either
1025  Ptr = &Buffer->Buffer[X + Y * Buffer->ScreenBufferSize.X];
1026 
1027  switch (CodeType)
1028  {
1029  case CODE_ASCII:
1030  case CODE_UNICODE:
1031  Ptr->Char.UnicodeChar = *(PWCHAR)WriteBuffer;
1032  break;
1033 
1034  case CODE_ATTRIBUTE:
1035  Ptr->Attributes = *(PWORD)WriteBuffer;
1036  break;
1037  }
1038  WriteBuffer = (PVOID)((ULONG_PTR)WriteBuffer + CodeSize);
1039  // ++Ptr;
1040 
1041  // Written++;
1042  if (++X == Buffer->ScreenBufferSize.X)
1043  {
1044  X = 0;
1045 
1046  if (++Y == Buffer->ScreenBufferSize.Y)
1047  {
1048  Y = 0;
1049  }
1050  }
1051  }
1052 
1053  if ((PCONSOLE_SCREEN_BUFFER)Buffer == Console->ActiveBuffer)
1054  {
1055  ConioComputeUpdateRect(Buffer, &UpdateRect, WriteCoord, NumCodesToWrite);
1057  }
1058 
1059  // EndCoord->X = X;
1060  // EndCoord->Y = (Y + Buffer->ScreenBufferSize.Y - Buffer->VirtualY) % Buffer->ScreenBufferSize.Y;
1061 
1062 Cleanup:
1063  if (tmpString) RtlFreeHeap(RtlGetProcessHeap(), 0, tmpString);
1064 
1065  // CodesWritten = Written;
1066  return Status;
1067 }
signed char * PCHAR
Definition: retypes.h:7
#define ConioDrawRegion(Console, Region)
Definition: conio2.h:13
#define Y(I)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
uint16_t * PWCHAR
Definition: typedefs.h:54
uint32_t ULONG_PTR
Definition: typedefs.h:63
while(1)
Definition: macro.lex.yy.c:740
X(int i_=0)
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
WORD * PWORD
Definition: pedump.c:67
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define MultiByteToWideChar
Definition: compat.h:100
CConsole Console
unsigned int ULONG
Definition: retypes.h:1
static int UpdateRect(TreeListData *pData, unsigned uItem, unsigned uSub)
Definition: treelist.c:1529
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define CHAR(Char)
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
#define WriteBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:344
static VOID FASTCALL ConioComputeUpdateRect(IN PTEXTMODE_SCREEN_BUFFER Buff, IN OUT PSMALL_RECT UpdateRect, IN PCOORD Start, IN UINT Length)
Definition: text.c:209
#define X(b, s)

◆ CSR_API() [1/17]

CSR_API ( SrvInvalidateBitMapRect  )

Definition at line 32 of file conoutput.c.

33 {
35  PCONSOLE_INVALIDATEDIBITS InvalidateDIBitsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.InvalidateDIBitsRequest;
37 
38  DPRINT("SrvInvalidateBitMapRect\n");
39 
41  InvalidateDIBitsRequest->OutputHandle,
43  if (!NT_SUCCESS(Status)) return Status;
44 
45  Status = ConDrvInvalidateBitMapRect(Buffer->Header.Console,
46  Buffer,
47  &InvalidateDIBitsRequest->Region);
48 
50  return Status;
51 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:26
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConDrvInvalidateBitMapRect(IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer, IN PSMALL_RECT Region)
Definition: conoutput.c:202
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [2/17]

CSR_API ( SrvGetConsoleCursorInfo  )

Definition at line 57 of file conoutput.c.

58 {
60  PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CursorInfoRequest;
62 
63  DPRINT("SrvGetConsoleCursorInfo\n");
64 
66  CursorInfoRequest->OutputHandle,
68  if (!NT_SUCCESS(Status)) return Status;
69 
70  Status = ConDrvGetConsoleCursorInfo(Buffer->Header.Console,
71  Buffer,
72  &CursorInfoRequest->Info);
73 
75  return Status;
76 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ConDrvGetConsoleCursorInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, OUT PCONSOLE_CURSOR_INFO CursorInfo)
Definition: conoutput.c:263
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
CONSOLE_CURSOR_INFO Info
Definition: conmsg.h:346
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [3/17]

CSR_API ( SrvSetConsoleCursorInfo  )

Definition at line 82 of file conoutput.c.

83 {
85  PCONSOLE_GETSETCURSORINFO CursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CursorInfoRequest;
87 
88  DPRINT("SrvSetConsoleCursorInfo\n");
89 
91  CursorInfoRequest->OutputHandle,
93  if (!NT_SUCCESS(Status)) return Status;
94 
95  Status = ConDrvSetConsoleCursorInfo(Buffer->Header.Console,
96  Buffer,
97  &CursorInfoRequest->Info);
98 
100  return Status;
101 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
CONSOLE_CURSOR_INFO Info
Definition: conmsg.h:346
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
NTSTATUS NTAPI ConDrvSetConsoleCursorInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCONSOLE_CURSOR_INFO CursorInfo)
Definition: conoutput.c:281
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [4/17]

CSR_API ( SrvSetConsoleCursorPosition  )

Definition at line 107 of file conoutput.c.

108 {
110  PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorPositionRequest;
112 
113  DPRINT("SrvSetConsoleCursorPosition\n");
114 
116  SetCursorPositionRequest->OutputHandle,
118  if (!NT_SUCCESS(Status)) return Status;
119 
120  Status = ConDrvSetConsoleCursorPosition(Buffer->Header.Console,
121  Buffer,
122  &SetCursorPositionRequest->Position);
123 
125  return Status;
126 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
NTSTATUS NTAPI ConDrvSetConsoleCursorPosition(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCOORD Position)
Definition: conoutput.c:311
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [5/17]

CSR_API ( SrvCreateConsoleScreenBuffer  )

Definition at line 128 of file conoutput.c.

129 {
131  PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest;
135 
137  TEXTMODE_BUFFER_INFO TextModeInfo = {{80, 25},
140  TRUE,
142  GRAPHICS_BUFFER_INFO GraphicsInfo;
143  GraphicsInfo.Info = CreateScreenBufferRequest->GraphicsBufferInfo; // HACK for MSVC
144 
145  DPRINT("SrvCreateConsoleScreenBuffer\n");
146 
147  Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
148  if (!NT_SUCCESS(Status)) return Status;
149 
150  if (CreateScreenBufferRequest->ScreenBufferType == CONSOLE_TEXTMODE_BUFFER)
151  {
152  ScreenBufferInfo = &TextModeInfo;
153 
154  /*
155  if (Console->ActiveBuffer)
156  {
157  TextModeInfo.ScreenBufferSize = Console->ActiveBuffer->ScreenBufferSize;
158  if (TextModeInfo.ScreenBufferSize.X == 0) TextModeInfo.ScreenBufferSize.X = 80;
159  if (TextModeInfo.ScreenBufferSize.Y == 0) TextModeInfo.ScreenBufferSize.Y = 25;
160 
161  TextModeInfo.ScreenAttrib = Console->ActiveBuffer->ScreenBuffer.TextBuffer.ScreenDefaultAttrib;
162  TextModeInfo.PopupAttrib = Console->ActiveBuffer->ScreenBuffer.TextBuffer.PopupDefaultAttrib;
163 
164  TextModeInfo.IsCursorVisible = Console->ActiveBuffer->CursorInfo.bVisible;
165  TextModeInfo.CursorSize = Console->ActiveBuffer->CursorInfo.dwSize;
166  }
167  */
168 
169  /*
170  * This is Windows' behaviour
171  */
172 
173  /* Use the current console size. Regularize it if needed. */
174  TextModeInfo.ScreenBufferSize = Console->ConsoleSize;
175  if (TextModeInfo.ScreenBufferSize.X == 0) TextModeInfo.ScreenBufferSize.X = 1;
176  if (TextModeInfo.ScreenBufferSize.Y == 0) TextModeInfo.ScreenBufferSize.Y = 1;
177 
178  /* If we have an active screen buffer, use its attributes as the new ones */
179  if (Console->ActiveBuffer && GetType(Console->ActiveBuffer) == TEXTMODE_BUFFER)
180  {
182 
183  TextModeInfo.ScreenAttrib = Buffer->ScreenDefaultAttrib;
184  TextModeInfo.PopupAttrib = Buffer->PopupDefaultAttrib;
185 
186  TextModeInfo.IsCursorVisible = Buffer->CursorInfo.bVisible;
187  TextModeInfo.CursorSize = Buffer->CursorInfo.dwSize;
188  }
189  }
190  else if (CreateScreenBufferRequest->ScreenBufferType == CONSOLE_GRAPHICS_BUFFER)
191  {
192  /* Get infos from the graphics buffer information structure */
193  if (!CsrValidateMessageBuffer(ApiMessage,
194  (PVOID*)&CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMapInfo,
195  1,
196  CreateScreenBufferRequest->GraphicsBufferInfo.dwBitMapInfoLength))
197  {
199  goto Quit;
200  }
201 
202  ScreenBufferInfo = &GraphicsInfo;
203 
204  /* Initialize shared variables */
205  CreateScreenBufferRequest->GraphicsBufferInfo.hMutex = GraphicsInfo.Info.hMutex = INVALID_HANDLE_VALUE;
206  CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap = GraphicsInfo.Info.lpBitMap = NULL;
207 
208  /* A graphics screen buffer is never inheritable */
209  CreateScreenBufferRequest->Inheritable = FALSE;
210  }
211 
213  Console,
214  CreateScreenBufferRequest->ScreenBufferType,
216  if (!NT_SUCCESS(Status)) goto Quit;
217 
218  /* Insert the new handle inside the process handles table */
220 
221  Status = ConSrvInsertObject(ProcessData,
222  &CreateScreenBufferRequest->OutputHandle,
223  &Buff->Header,
224  CreateScreenBufferRequest->Access,
225  CreateScreenBufferRequest->Inheritable,
226  CreateScreenBufferRequest->ShareMode);
227 
229 
230  if (!NT_SUCCESS(Status)) goto Quit;
231 
232  if (CreateScreenBufferRequest->ScreenBufferType == CONSOLE_GRAPHICS_BUFFER)
233  {
235  /*
236  * Initialize the graphics buffer information structure
237  * and give it back to the client.
238  */
239  CreateScreenBufferRequest->GraphicsBufferInfo.hMutex = Buffer->ClientMutex;
240  CreateScreenBufferRequest->GraphicsBufferInfo.lpBitMap = Buffer->ClientBitMap;
241  }
242 
243 Quit:
245  return Status;
246 }
CONSOLE_GRAPHICS_BUFFER_INFO Info
Definition: conio.h:167
#define DEFAULT_SCREEN_ATTRIB
Definition: settings.c:29
NTSTATUS ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PCONSRV_CONSOLE *Console, IN BOOLEAN LockConsole)
Definition: console.c:271
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo
Definition: notevil.c:38
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
BOOLEAN IsCursorVisible
Definition: conio.h:147
NTSTATUS ConDrvCreateScreenBuffer(OUT PCONSOLE_SCREEN_BUFFER *Buffer, IN PCONSOLE Console, IN HANDLE ProcessHandle OPTIONAL, IN ULONG BufferType, IN PVOID ScreenBufferInfo)
Definition: conoutput.c:79
#define TEXTMODE_BUFFER
Definition: pccons.c:21
VOID ConSrvReleaseConsole(IN PCONSRV_CONSOLE Console, IN BOOLEAN IsConsoleLocked)
Definition: console.c:296
CONSOLE_IO_OBJECT Header
Definition: conio.h:82
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
ULONG X
Definition: bl.h:1340
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define CSR_DEFAULT_CURSOR_SIZE
Definition: settings.c:26
struct _GRAPHICS_SCREEN_BUFFER * PGRAPHICS_SCREEN_BUFFER
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
Definition: gettype.c:129
CONSOLE_GRAPHICS_BUFFER_INFO GraphicsBufferInfo
Definition: conmsg.h:456
USHORT PopupAttrib
Definition: conio.h:145
Status
Definition: gdiplustypes.h:24
#define DEFAULT_POPUP_ATTRIB
Definition: settings.c:30
#define CONSOLE_TEXTMODE_BUFFER
Definition: wincon.h:59
#define CONSOLE_GRAPHICS_BUFFER
Definition: wincon.h:60
CConsole Console
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS ConSrvInsertObject(IN PCONSOLE_PROCESS_DATA ProcessData, OUT PHANDLE Handle, IN PCONSOLE_IO_OBJECT Object, IN ULONG Access, IN BOOLEAN Inheritable, IN ULONG ShareMode)
Definition: handle.c:310
ULONG Y
Definition: bl.h:1341
struct _TEXTMODE_SCREEN_BUFFER * PTEXTMODE_SCREEN_BUFFER
COORD ScreenBufferSize
Definition: conio.h:143
USHORT ScreenAttrib
Definition: conio.h:144
RTL_CRITICAL_SECTION HandleTableLock
Definition: consrv.h:48

◆ CSR_API() [6/17]

CSR_API ( SrvSetConsoleActiveScreenBuffer  )

Definition at line 251 of file conoutput.c.

252 {
254  PCONSOLE_SETACTIVESCREENBUFFER SetScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferRequest;
256 
257  DPRINT("SrvSetConsoleActiveScreenBuffer\n");
258 
260  SetScreenBufferRequest->OutputHandle,
262  if (!NT_SUCCESS(Status)) return Status;
263 
265  Buffer);
266 
268  return Status;
269 }
NTSTATUS NTAPI ConDrvSetConsoleActiveScreenBuffer(IN PCONSOLE Console, IN PCONSOLE_SCREEN_BUFFER Buffer)
Definition: conoutput.c:170
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:26
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [7/17]

CSR_API ( SrvReadConsoleOutput  )

Definition at line 382 of file conoutput.c.

383 {
385  PCONSOLE_READOUTPUT ReadOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputRequest;
387 
388  DPRINT("SrvReadConsoleOutput\n");
389 
390  if (!CsrValidateMessageBuffer(ApiMessage,
391  (PVOID*)&ReadOutputRequest->CharInfo,
392  ReadOutputRequest->BufferSize.X * ReadOutputRequest->BufferSize.Y,
393  sizeof(CHAR_INFO)))
394  {
396  }
397 
399  ReadOutputRequest->OutputHandle,
401  if (!NT_SUCCESS(Status)) return Status;
402 
403  Status = ConDrvReadConsoleOutput(Buffer->Header.Console,
404  Buffer,
405  ReadOutputRequest->Unicode,
406  ReadOutputRequest->CharInfo,
407  &ReadOutputRequest->BufferSize,
408  &ReadOutputRequest->BufferCoord,
409  &ReadOutputRequest->ReadRegion);
410 
412  return Status;
413 }
HANDLE OutputHandle
Definition: conmsg.h:587
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
BOOLEAN Unicode
Definition: conmsg.h:593
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
PCHAR_INFO CharInfo
Definition: conmsg.h:590
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
SMALL_RECT ReadRegion
Definition: conmsg.h:592
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvReadConsoleOutput(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, OUT PCHAR_INFO CharInfo, IN OUT PSMALL_RECT ReadRegion)
Definition: text.c:467
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [8/17]

CSR_API ( SrvWriteConsoleOutput  )

Definition at line 423 of file conoutput.c.

424 {
426  PCONSOLE_WRITEOUTPUT WriteOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputRequest;
428 
429  DPRINT("SrvWriteConsoleOutput\n");
430 
431  if (!CsrValidateMessageBuffer(ApiMessage,
432  (PVOID*)&WriteOutputRequest->CharInfo,
433  WriteOutputRequest->BufferSize.X * WriteOutputRequest->BufferSize.Y,
434  sizeof(CHAR_INFO)))
435  {
437  }
438 
440  WriteOutputRequest->OutputHandle,
442  if (!NT_SUCCESS(Status)) return Status;
443 
444  Status = ConDrvWriteConsoleOutput(Buffer->Header.Console,
445  Buffer,
446  WriteOutputRequest->Unicode,
447  WriteOutputRequest->CharInfo,
448  &WriteOutputRequest->BufferSize,
449  &WriteOutputRequest->BufferCoord,
450  &WriteOutputRequest->WriteRegion);
451 
453  return Status;
454 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
HANDLE OutputHandle
Definition: conmsg.h:599
Definition: bufpool.h:45
NTSTATUS NTAPI ConDrvWriteConsoleOutput(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, IN PCHAR_INFO CharInfo, IN OUT PSMALL_RECT WriteRegion)
Definition: text.c:531
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
SMALL_RECT WriteRegion
Definition: conmsg.h:604
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
PCHAR_INFO CharInfo
Definition: conmsg.h:602

◆ CSR_API() [9/17]

CSR_API ( SrvWriteConsole  )

Definition at line 456 of file conoutput.c.

457 {
459  PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest;
460 
461  DPRINT("SrvWriteConsole\n");
462 
463  if (!CsrValidateMessageBuffer(ApiMessage,
464  (PVOID)&WriteConsoleRequest->Buffer,
465  WriteConsoleRequest->BufferSize,
466  sizeof(BYTE)))
467  {
469  }
470 
471  Status = DoWriteConsole(ApiMessage,
473  TRUE);
474 
475  if (Status == STATUS_PENDING) *ReplyCode = CsrReplyPending;
476 
477  return Status;
478 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_PENDING
Definition: ntstatus.h:82
static NTSTATUS DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, IN PCSR_THREAD ClientThread, IN BOOL CreateWaitBlock OPTIONAL)
Definition: conoutput.c:325
unsigned char BYTE
Definition: mem.h:68
Status
Definition: gdiplustypes.h:24

◆ CSR_API() [10/17]

CSR_API ( SrvReadConsoleOutputString  )

Definition at line 489 of file conoutput.c.

490 {
492  PCONSOLE_READOUTPUTCODE ReadOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadOutputCodeRequest;
494  ULONG CodeSize;
495 
496  DPRINT("SrvReadConsoleOutputString\n");
497 
498  switch (ReadOutputCodeRequest->CodeType)
499  {
500  case CODE_ASCII:
501  CodeSize = sizeof(CHAR);
502  break;
503 
504  case CODE_UNICODE:
505  CodeSize = sizeof(WCHAR);
506  break;
507 
508  case CODE_ATTRIBUTE:
509  CodeSize = sizeof(WORD);
510  break;
511 
512  default:
514  }
515 
516  if (!CsrValidateMessageBuffer(ApiMessage,
517  (PVOID*)&ReadOutputCodeRequest->pCode.pCode,
518  ReadOutputCodeRequest->NumCodesToRead,
519  CodeSize))
520  {
522  }
523 
525  ReadOutputCodeRequest->OutputHandle,
527  if (!NT_SUCCESS(Status)) return Status;
528 
529  Status = ConDrvReadConsoleOutputString(Buffer->Header.Console,
530  Buffer,
531  ReadOutputCodeRequest->CodeType,
532  ReadOutputCodeRequest->pCode.pCode,
533  ReadOutputCodeRequest->NumCodesToRead,
534  &ReadOutputCodeRequest->ReadCoord,
535  &ReadOutputCodeRequest->EndCoord,
536  &ReadOutputCodeRequest->CodesRead);
537 
539  return Status;
540 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
CODE_TYPE CodeType
Definition: conmsg.h:535
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
unsigned short WORD
Definition: ntddk_ex.h:93
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
HANDLE OutputHandle
Definition: conmsg.h:532
NTSTATUS NTAPI ConDrvReadConsoleOutputString(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, OUT PVOID StringBuffer, IN ULONG NumCodesToRead, IN PCOORD ReadCoord, OUT PULONG NumCodesRead OPTIONAL)
Definition: text.c:727
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define CHAR(Char)

◆ CSR_API() [11/17]

CSR_API ( SrvWriteConsoleOutputString  )

Definition at line 551 of file conoutput.c.

552 {
554  PCONSOLE_WRITEOUTPUTCODE WriteOutputCodeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteOutputCodeRequest;
556  ULONG CodeSize;
557 
558  DPRINT("SrvWriteConsoleOutputString\n");
559 
560  switch (WriteOutputCodeRequest->CodeType)
561  {
562  case CODE_ASCII:
563  CodeSize = sizeof(CHAR);
564  break;
565 
566  case CODE_UNICODE:
567  CodeSize = sizeof(WCHAR);
568  break;
569 
570  case CODE_ATTRIBUTE:
571  CodeSize = sizeof(WORD);
572  break;
573 
574  default:
576  }
577 
578  if (!CsrValidateMessageBuffer(ApiMessage,
579  (PVOID*)&WriteOutputCodeRequest->pCode.pCode,
580  WriteOutputCodeRequest->Length,
581  CodeSize))
582  {
584  }
585 
587  WriteOutputCodeRequest->OutputHandle,
589  if (!NT_SUCCESS(Status)) return Status;
590 
591  Status = ConDrvWriteConsoleOutputString(Buffer->Header.Console,
592  Buffer,
593  WriteOutputCodeRequest->CodeType,
594  WriteOutputCodeRequest->pCode.pCode,
595  WriteOutputCodeRequest->Length, // NumCodesToWrite,
596  &WriteOutputCodeRequest->Coord /*, // WriteCoord,
597  &WriteOutputCodeRequest->EndCoord,
598  &WriteOutputCodeRequest->NrCharactersWritten */);
599 
600  // WriteOutputCodeRequest->NrCharactersWritten = Written;
601 
603  return Status;
604 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
CODE_TYPE CodeType
Definition: conmsg.h:535
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI CsrValidateMessageBuffer(IN PCSR_API_MESSAGE ApiMessage, IN PVOID *Buffer, IN ULONG ElementCount, IN ULONG ElementSize)
Definition: api.c:1315
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSTATUS NTAPI ConDrvWriteConsoleOutputString(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, IN PVOID StringBuffer, IN ULONG NumCodesToWrite, IN PCOORD WriteCoord, OUT PULONG NumCodesWritten OPTIONAL)
Definition: text.c:840
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
unsigned short WORD
Definition: ntddk_ex.h:93
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
unsigned int ULONG
Definition: retypes.h:1
HANDLE OutputHandle
Definition: conmsg.h:532
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define CHAR(Char)

◆ CSR_API() [12/17]

CSR_API ( SrvFillConsoleOutput  )

Definition at line 614 of file conoutput.c.

615 {
617  PCONSOLE_FILLOUTPUTCODE FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest;
619  USHORT CodeType = FillOutputRequest->CodeType;
620 
621  DPRINT("SrvFillConsoleOutput\n");
622 
623  if ( (CodeType != CODE_ASCII ) &&
624  (CodeType != CODE_UNICODE ) &&
625  (CodeType != CODE_ATTRIBUTE) )
626  {
628  }
629 
631  FillOutputRequest->OutputHandle,
633  if (!NT_SUCCESS(Status)) return Status;
634 
635  Status = ConDrvFillConsoleOutput(Buffer->Header.Console,
636  Buffer,
637  CodeType,
638  &FillOutputRequest->Code,
639  FillOutputRequest->Length, // NumCodesToWrite,
640  &FillOutputRequest->Coord /*, // WriteCoord,
641  &FillOutputRequest->NrCharactersWritten */);
642 
643  // FillOutputRequest->NrCharactersWritten = Written;
644 
646  return Status;
647 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
CODE_ELEMENT Code
Definition: conmsg.h:557
CODE_TYPE CodeType
Definition: conmsg.h:556
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
NTSTATUS NTAPI ConDrvFillConsoleOutput(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN CODE_TYPE CodeType, IN CODE_ELEMENT Code, IN ULONG NumCodesToWrite, IN PCOORD WriteCoord, OUT PULONG NumCodesWritten OPTIONAL)
Definition: text.c:978

◆ CSR_API() [13/17]

CSR_API ( SrvGetConsoleScreenBufferInfo  )

Definition at line 653 of file conoutput.c.

654 {
656  PCONSOLE_GETSCREENBUFFERINFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest;
658 
659  DPRINT("SrvGetConsoleScreenBufferInfo\n");
660 
662  ScreenBufferInfoRequest->OutputHandle,
664  if (!NT_SUCCESS(Status)) return Status;
665 
667  Buffer,
668  &ScreenBufferInfoRequest->Info);
669 
671  return Status;
672 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvGetConsoleScreenBufferInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, OUT PCOORD ScreenBufferSize, OUT PCOORD CursorPosition, OUT PCOORD ViewOrigin, OUT PCOORD ViewSize, OUT PCOORD MaximumViewSize, OUT PWORD Attributes)
Definition: text.c:1059
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [14/17]

CSR_API ( SrvSetConsoleTextAttribute  )

Definition at line 678 of file conoutput.c.

679 {
681  PCONSOLE_SETTEXTATTRIB SetTextAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTextAttribRequest;
683 
684  DPRINT("SrvSetConsoleTextAttribute\n");
685 
687  SetTextAttribRequest->OutputHandle,
689  if (!NT_SUCCESS(Status)) return Status;
690 
691  Status = ConDrvSetConsoleTextAttribute(Buffer->Header.Console,
692  Buffer,
693  SetTextAttribRequest->Attrib);
694 
696  return Status;
697 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ConDrvSetConsoleTextAttribute(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN WORD Attributes)
Definition: text.c:1099
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [15/17]

CSR_API ( SrvSetConsoleScreenBufferSize  )

Definition at line 703 of file conoutput.c.

704 {
706  PCONSOLE_SETSCREENBUFFERSIZE SetScreenBufferSizeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSizeRequest;
708 
709  DPRINT("SrvSetConsoleScreenBufferSize\n");
710 
712  SetScreenBufferSizeRequest->OutputHandle,
714  if (!NT_SUCCESS(Status)) return Status;
715 
717  Buffer,
718  &SetScreenBufferSizeRequest->Size);
719 
721  return Status;
722 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvSetConsoleScreenBufferSize(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN PCOORD Size)
Definition: text.c:1114
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [16/17]

CSR_API ( SrvScrollConsoleScreenBuffer  )

Definition at line 733 of file conoutput.c.

734 {
736  PCONSOLE_SCROLLSCREENBUFFER ScrollScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollScreenBufferRequest;
738 
739  DPRINT("SrvScrollConsoleScreenBuffer\n");
740 
742  ScrollScreenBufferRequest->OutputHandle,
744  if (!NT_SUCCESS(Status)) return Status;
745 
747  Buffer,
748  ScrollScreenBufferRequest->Unicode,
749  &ScrollScreenBufferRequest->ScrollRectangle,
750  ScrollScreenBufferRequest->UseClipRectangle,
751  &ScrollScreenBufferRequest->ClipRectangle,
752  &ScrollScreenBufferRequest->DestinationOrigin,
753  ScrollScreenBufferRequest->Fill);
754 
756  return Status;
757 }
SMALL_RECT ScrollRectangle
Definition: conmsg.h:501
SMALL_RECT ClipRectangle
Definition: conmsg.h:502
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSTATUS NTAPI ConDrvScrollConsoleScreenBuffer(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Unicode, IN PSMALL_RECT ScrollRectangle, IN BOOLEAN UseClipRectangle, IN PSMALL_RECT ClipRectangle OPTIONAL, IN PCOORD DestinationOrigin, IN CHAR_INFO FillChar)
Definition: text.c:1133
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ CSR_API() [17/17]

CSR_API ( SrvSetConsoleWindowInfo  )

Definition at line 764 of file conoutput.c.

765 {
767  PCONSOLE_SETWINDOWINFO SetWindowInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetWindowInfoRequest;
768  // PCONSOLE_SCREEN_BUFFER Buffer;
770 
771  DPRINT1("SrvSetConsoleWindowInfo(0x%08x, %d, {L%d, T%d, R%d, B%d}) called\n",
772  SetWindowInfoRequest->OutputHandle, SetWindowInfoRequest->Absolute,
773  SetWindowInfoRequest->WindowRect.Left ,
774  SetWindowInfoRequest->WindowRect.Top ,
775  SetWindowInfoRequest->WindowRect.Right,
776  SetWindowInfoRequest->WindowRect.Bottom);
777 
778  // ConSrvGetScreenBuffer
780  SetWindowInfoRequest->OutputHandle,
782  if (!NT_SUCCESS(Status)) return Status;
783 
784  Status = ConDrvSetConsoleWindowInfo(Buffer->Header.Console,
785  Buffer,
786  SetWindowInfoRequest->Absolute,
787  &SetWindowInfoRequest->WindowRect);
788 
790  return Status;
791 }
#define CsrGetClientThread()
Definition: csrsrv.h:77
#define TRUE
Definition: types.h:120
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
SMALL_RECT WindowRect
Definition: conmsg.h:710
Definition: bufpool.h:45
SHORT Left
Definition: blue.h:25
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
SHORT Bottom
Definition: blue.h:28
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
SHORT Top
Definition: blue.h:26
#define GENERIC_READ
Definition: compat.h:124
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConDrvSetConsoleWindowInfo(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER Buffer, IN BOOLEAN Absolute, IN PSMALL_RECT WindowRect)
Definition: text.c:1221
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
SHORT Right
Definition: blue.h:27
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ DoWriteConsole()

static NTSTATUS DoWriteConsole ( IN PCSR_API_MESSAGE  ApiMessage,
IN PCSR_THREAD  ClientThread,
IN BOOL CreateWaitBlock  OPTIONAL 
)
static

Definition at line 325 of file conoutput.c.

328 {
330  PCONSOLE_WRITECONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest;
332 
334  WriteConsoleRequest->OutputHandle,
336  if (!NT_SUCCESS(Status)) return Status;
337 
338  Status = ConDrvWriteConsole(ScreenBuffer->Header.Console,
339  ScreenBuffer,
340  WriteConsoleRequest->Unicode,
341  WriteConsoleRequest->Buffer,
342  WriteConsoleRequest->NrCharactersToWrite,
343  &WriteConsoleRequest->NrCharactersWritten);
344 
345  if (Status == STATUS_PENDING)
346  {
347  if (CreateWaitBlock)
348  {
349  if (!CsrCreateWait(&ScreenBuffer->Header.Console->WriteWaitQueue,
351  ClientThread,
352  ApiMessage,
353  NULL,
354  NULL))
355  {
356  /* Fail */
358  goto Quit;
359  }
360  }
361 
362  /* Wait until we un-pause the console */
363  // Status = STATUS_PENDING;
364  }
365 
366 Quit:
368  return Status;
369 }
static BOOLEAN WriteConsoleThread(IN PLIST_ENTRY WaitList, IN PCSR_THREAD WaitThread, IN PCSR_API_MESSAGE WaitApiMessage, IN PVOID WaitContext, IN PVOID WaitArgument1, IN PVOID WaitArgument2, IN ULONG WaitFlags)
Definition: conoutput.c:281
struct _CONSOLE_API_MESSAGE * PCONSOLE_API_MESSAGE
LONG NTSTATUS
Definition: precomp.h:26
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
UINT CALLBACK ClientThread(_Inout_ PVOID Parameter)
#define ConSrvGetTextModeBuffer(ProcessData, Handle, Ptr, Access, LockConsole)
Definition: conoutput.h:12
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define ConsoleGetPerProcessData(Process)
Definition: consrv.h:37
#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked)
Definition: conoutput.h:33
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
HANDLE ScreenBuffer
Definition: notevil.c:37
BOOLEAN NTAPI CsrCreateWait(IN PLIST_ENTRY WaitList, IN CSR_WAIT_FUNCTION WaitFunction, IN PCSR_THREAD CsrWaitThread, IN OUT PCSR_API_MESSAGE WaitApiMessage, IN PVOID WaitContext)
Definition: wait.c:209
NTSTATUS NTAPI ConDrvWriteConsole(IN PCONSOLE Console, IN PTEXTMODE_SCREEN_BUFFER ScreenBuffer, IN BOOLEAN Unicode, IN PVOID StringBuffer, IN ULONG NumCharsToWrite, OUT PULONG NumCharsWritten OPTIONAL)
Definition: text.c:655

Referenced by CSR_API(), and WriteConsoleThread().

◆ WriteConsoleThread()

static BOOLEAN WriteConsoleThread ( IN PLIST_ENTRY  WaitList,
IN PCSR_THREAD  WaitThread,
IN PCSR_API_MESSAGE  WaitApiMessage,
IN PVOID  WaitContext,
IN PVOID  WaitArgument1,
IN PVOID  WaitArgument2,
IN ULONG  WaitFlags 
)
static

Definition at line 281 of file conoutput.c.

288 {
290 
291  DPRINT("WriteConsoleThread - WaitContext = 0x%p, WaitArgument1 = 0x%p, WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2, WaitFlags);
292 
293  /*
294  * If we are notified of the process termination via a call
295  * to CsrNotifyWaitBlock triggered by CsrDestroyProcess or
296  * CsrDestroyThread, just return.
297  */
298  if (WaitFlags & CsrProcessTerminating)
299  {
301  goto Quit;
302  }
303 
304  Status = DoWriteConsole(WaitApiMessage,
305  WaitThread,
306  FALSE);
307 
308 Quit:
309  if (Status != STATUS_PENDING)
310  {
311  WaitApiMessage->Status = Status;
312  }
313 
314  return (Status == STATUS_PENDING ? FALSE : TRUE);
315 }
#define TRUE
Definition: types.h:120
#define STATUS_THREAD_IS_TERMINATING
Definition: ntstatus.h:297
LONG NTSTATUS
Definition: precomp.h:26
void DPRINT(...)
Definition: polytest.cpp:61
#define STATUS_PENDING
Definition: ntstatus.h:82
static NTSTATUS DoWriteConsole(IN PCSR_API_MESSAGE ApiMessage, IN PCSR_THREAD ClientThread, IN BOOL CreateWaitBlock OPTIONAL)
Definition: conoutput.c:325
Status
Definition: gdiplustypes.h:24

Referenced by DoWriteConsole().