ReactOS  0.4.14-dev-1331-g167fa2c
conio_winsrv.h File Reference
#include "rect.h"
Include dependency graph for conio_winsrv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _CHAR_CELL
 
struct  _FRONTEND_VTBL
 
struct  _FRONTEND
 
struct  _WINSRV_CONSOLE
 

Macros

#define _CONSRV_CONSOLE   _CONSOLE
 
#define CONSRV_CONSOLE   CONSOLE
 
#define PCONSRV_CONSOLE   PCONSOLE
 
#define CSR_DEFAULT_CURSOR_SIZE   25
 
#define PAUSED_FROM_KEYBOARD   0x1
 
#define PAUSED_FROM_SCROLLBAR   0x2
 
#define PAUSED_FROM_SELECTION   0x4
 

Typedefs

typedef struct _CHAR_CELL CHAR_CELL
 
typedef struct _CHAR_CELLPCHAR_CELL
 
typedef struct _WINSRV_CONSOLEPWINSRV_CONSOLE
 
typedef struct _FRONTEND FRONTEND
 
typedef struct _FRONTENDPFRONTEND
 
typedef struct _FRONTEND_VTBL FRONTEND_VTBL
 
typedef struct _FRONTEND_VTBLPFRONTEND_VTBL
 
typedef struct _WINSRV_CONSOLE WINSRV_CONSOLE
 

Functions

 C_ASSERT (sizeof(CHAR_CELL)==2)
 
VOID ConioPause (PCONSRV_CONSOLE Console, UCHAR Flags)
 
VOID ConioUnpause (PCONSRV_CONSOLE Console, UCHAR Flags)
 
PCONSOLE_PROCESS_DATA NTAPI ConSrvGetConsoleLeaderProcess (IN PCONSRV_CONSOLE Console)
 
NTSTATUS ConSrvConsoleCtrlEvent (IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
 
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent (IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
 
VOID ConSrvSetProcessFocus (IN PCSR_PROCESS CsrProcess, IN BOOLEAN SetForeground)
 
NTSTATUS NTAPI ConSrvSetConsoleProcessFocus (IN PCONSRV_CONSOLE Console, IN BOOLEAN SetForeground)
 
VOID NTAPI ConioProcessKey (PCONSRV_CONSOLE Console, MSG *msg)
 
DWORD ConioEffectiveCursorSize (PCONSRV_CONSOLE Console, DWORD Scale)
 
NTSTATUS ConioProcessInputEvent (PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
 
PCHAR_INFO ConioCoordToPointer (PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
 
NTSTATUS ConioResizeBuffer (PCONSOLE Console, PTEXTMODE_SCREEN_BUFFER ScreenBuffer, COORD Size)
 
VOID ConioDrawConsole (PCONSRV_CONSOLE Console)
 

Macro Definition Documentation

◆ _CONSRV_CONSOLE

#define _CONSRV_CONSOLE   _CONSOLE

Definition at line 26 of file conio_winsrv.h.

◆ CONSRV_CONSOLE

#define CONSRV_CONSOLE   CONSOLE

Definition at line 27 of file conio_winsrv.h.

◆ CSR_DEFAULT_CURSOR_SIZE

#define CSR_DEFAULT_CURSOR_SIZE   25

Definition at line 32 of file conio_winsrv.h.

◆ PAUSED_FROM_KEYBOARD

#define PAUSED_FROM_KEYBOARD   0x1

Definition at line 126 of file conio_winsrv.h.

◆ PAUSED_FROM_SCROLLBAR

#define PAUSED_FROM_SCROLLBAR   0x2

Definition at line 127 of file conio_winsrv.h.

◆ PAUSED_FROM_SELECTION

#define PAUSED_FROM_SELECTION   0x4

Definition at line 128 of file conio_winsrv.h.

◆ PCONSRV_CONSOLE

#define PCONSRV_CONSOLE   PCONSOLE

Definition at line 28 of file conio_winsrv.h.

Typedef Documentation

◆ CHAR_CELL

◆ FRONTEND

Definition at line 49 of file conio_winsrv.h.

◆ FRONTEND_VTBL

◆ PCHAR_CELL

◆ PFRONTEND

Definition at line 49 of file conio_winsrv.h.

◆ PFRONTEND_VTBL

◆ PWINSRV_CONSOLE

Definition at line 44 of file conio_winsrv.h.

◆ WINSRV_CONSOLE

Function Documentation

◆ C_ASSERT()

C_ASSERT ( sizeof(CHAR_CELL = =2)

◆ ConioCoordToPointer()

PCHAR_INFO ConioCoordToPointer ( PTEXTMODE_SCREEN_BUFFER  Buff,
ULONG  X,
ULONG  Y 
)

Definition at line 156 of file text.c.

157 {
158  ASSERT(X < Buff->ScreenBufferSize.X);
159  ASSERT(Y < Buff->ScreenBufferSize.Y);
160  return &Buff->Buffer[((Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y) * Buff->ScreenBufferSize.X + X];
161 }
#define Y(I)
X(int i_=0)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PCHAR_INFO Buffer
Definition: conio.h:154
#define X(b, s)

◆ ConioDrawConsole()

VOID ConioDrawConsole ( PCONSRV_CONSOLE  Console)

Definition at line 859 of file terminal.c.

860 {
862  PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
863 
864  if (!ActiveBuffer) return;
865 
866  ConioInitRect(&Region, 0, 0,
867  ActiveBuffer->ViewSize.Y - 1,
868  ActiveBuffer->ViewSize.X - 1);
870  // Console->FrontEndIFace.Vtbl->DrawRegion(&Console->FrontEndIFace, &Region);
871 }
#define TermDrawRegion(Console, Region)
Definition: term.h:22
ULONG X
Definition: bl.h:1340
#define ConioInitRect(Rect, top, left, bottom, right)
Definition: rect.h:20
CConsole Console
ULONG Y
Definition: bl.h:1341

Referenced by ConDrvProcessKey(), and ConioProcessKey().

◆ ConioEffectiveCursorSize()

DWORD ConioEffectiveCursorSize ( PCONSRV_CONSOLE  Console,
DWORD  Scale 
)

Definition at line 182 of file input.c.

183 {
184  DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100;
185  /* If line input in progress, perhaps adjust for insert toggle */
186  if (Console->LineBuffer && !Console->LineComplete && (Console->InsertMode ? !Console->LineInsertToggle : Console->LineInsertToggle))
187  return (Size * 2 <= Scale) ? (Size * 2) : (Size / 2);
188  return Size;
189 }
unsigned long DWORD
Definition: ntddk_ex.h:95
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
CConsole Console

◆ ConioPause()

VOID ConioPause ( PCONSRV_CONSOLE  Console,
UCHAR  Flags 
)

Definition at line 243 of file console.c.

244 {
245  Console->PauseFlags |= Flags;
247 }
VOID NTAPI ConDrvPause(PCONSOLE Console)
Definition: console.c:80
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
CConsole Console

Referenced by ConioProcessInputEvent(), GuiConsoleHandleScroll(), GuiConsoleUpdateSelection(), OnScroll(), PreprocessInput(), and UpdateSelection().

◆ ConioProcessInputEvent()

NTSTATUS ConioProcessInputEvent ( PCONSRV_CONSOLE  Console,
PINPUT_RECORD  InputEvent 
)

Definition at line 201 of file coninput.c.

203 {
204  ULONG NumEventsWritten;
205 
206  if (InputEvent->EventType == KEY_EVENT)
207  {
208  BOOL Down = InputEvent->Event.KeyEvent.bKeyDown;
209  UINT VirtualKeyCode = InputEvent->Event.KeyEvent.wVirtualKeyCode;
210  DWORD ShiftState = InputEvent->Event.KeyEvent.dwControlKeyState;
211 
212  /* Process Ctrl-C and Ctrl-Break */
214  Down && (VirtualKeyCode == VK_PAUSE || VirtualKeyCode == 'C') &&
215  (ShiftState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) )
216  {
217  DPRINT1("Console_Api Ctrl-C\n");
219 
220  if (Console->LineBuffer && !Console->LineComplete)
221  {
222  /* Line input is in progress; end it */
223  Console->LinePos = Console->LineSize = 0;
224  Console->LineComplete = TRUE;
225  }
226  return STATUS_SUCCESS; // STATUS_CONTROL_C_EXIT;
227  }
228  }
229 
231  InputEvent,
232  1,
233  &NumEventsWritten,
234  TRUE);
235 }
#define TRUE
Definition: types.h:120
DWORD dwControlKeyState
Definition: wincon.h:248
#define CTRL_C_EVENT
Definition: wincon.h:68
WORD wVirtualKeyCode
Definition: wincon.h:242
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
Definition: console.c:907
unsigned int BOOL
Definition: ntddk_ex.h:94
#define KEY_EVENT
Definition: wincon.h:128
#define GetConsoleInputBufferMode(Console)
Definition: conio.h:363
union _INPUT_RECORD::@3182 Event
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LEFT_CTRL_PRESSED
Definition: wincon.h:140
static NTSTATUS ConioAddInputEvents(PCONSRV_CONSOLE Console, PINPUT_RECORD InputRecords, ULONG NumEventsToWrite, PULONG NumEventsWritten, BOOLEAN AppendToEnd)
Definition: coninput.c:167
#define ENABLE_PROCESSED_INPUT
Definition: wincon.h:78
unsigned int UINT
Definition: ndis.h:50
CConsole Console
WORD EventType
Definition: wincon.h:276
#define DPRINT1
Definition: precomp.h:8
#define VK_PAUSE
Definition: winuser.h:2180
unsigned int ULONG
Definition: retypes.h:1
#define RIGHT_CTRL_PRESSED
Definition: wincon.h:139
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by ConDrvProcessKey(), ConDrvWriteConsoleInput(), ConioProcessKey(), ConioResizeBuffer(), GuiConsoleHandleMouse(), GuiConsoleWndProc(), GuiPasteToTextModeBuffer(), GuiSendMenuEvent(), OnFocus(), OnMouse(), PasteText(), and SendMenuEvent().

◆ ConioProcessKey()

VOID NTAPI ConioProcessKey ( PCONSRV_CONSOLE  Console,
MSG msg 
)

Definition at line 60 of file input.c.

61 {
62  static BYTE KeyState[256] = { 0 };
63  /* MSDN mentions that you should use the last virtual key code received
64  * when putting a virtual key identity to a WM_CHAR message since multiple
65  * or translated keys may be involved. */
66  static UINT LastVirtualKey = 0;
67  DWORD ShiftState;
68  WCHAR UnicodeChar;
69  UINT VirtualKeyCode;
70  UINT VirtualScanCode;
71  BOOL Down = FALSE;
72  BOOLEAN Fake; // Synthesized, not a real event
73  BOOLEAN NotChar; // Message should not be used to return a character
74 
75  INPUT_RECORD er;
76 
77  if (Console == NULL)
78  {
79  DPRINT1("No Active Console!\n");
80  return;
81  }
82 
83  VirtualScanCode = HIWORD(msg->lParam) & 0xFF;
84  Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR ||
85  msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSCHAR;
86 
87  GetKeyboardState(KeyState);
88  ShiftState = ConioGetShiftState(KeyState, msg->lParam);
89 
90  if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
91  {
92  VirtualKeyCode = LastVirtualKey;
93  UnicodeChar = msg->wParam;
94  }
95  else
96  {
97  WCHAR Chars[2];
98  INT RetChars = 0;
99 
100  VirtualKeyCode = msg->wParam;
101  RetChars = ToUnicodeEx(VirtualKeyCode,
102  VirtualScanCode,
103  KeyState,
104  Chars,
105  2,
106  0,
107  NULL);
108  UnicodeChar = (RetChars == 1 ? Chars[0] : 0);
109  }
110 
111  Fake = UnicodeChar &&
112  (msg->message != WM_CHAR && msg->message != WM_SYSCHAR &&
113  msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP);
114  NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR);
115  if (NotChar) LastVirtualKey = msg->wParam;
116 
117  DPRINT("CONSRV: %s %s %s %s %02x %02x '%lc' %04x\n",
118  Down ? "down" : "up ",
119  (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) ?
120  "char" : "key ",
121  Fake ? "fake" : "real",
122  NotChar ? "notc" : "char",
123  VirtualScanCode,
124  VirtualKeyCode,
125  (UnicodeChar >= L' ') ? UnicodeChar : L'.',
126  ShiftState);
127 
128  if (Fake) return;
129 
130 //
131 // FIXME: Scrolling via keyboard shortcuts must be done differently,
132 // without touching the internal VirtualY variable.
133 //
134 #if 0
135  if ( (ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) != 0 &&
136  (VirtualKeyCode == VK_UP || VirtualKeyCode == VK_DOWN) )
137  {
138  if (!Down) return;
139 
140  /* Scroll up or down */
141  if (VirtualKeyCode == VK_UP)
142  {
143  /* Only scroll up if there is room to scroll up into */
144  if (Console->ActiveBuffer->CursorPosition.Y != Console->ActiveBuffer->ScreenBufferSize.Y - 1)
145  {
146  Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY +
147  Console->ActiveBuffer->ScreenBufferSize.Y - 1) %
148  Console->ActiveBuffer->ScreenBufferSize.Y;
149  Console->ActiveBuffer->CursorPosition.Y++;
150  }
151  }
152  else
153  {
154  /* Only scroll down if there is room to scroll down into */
155  if (Console->ActiveBuffer->CursorPosition.Y != 0)
156  {
157  Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + 1) %
158  Console->ActiveBuffer->ScreenBufferSize.Y;
159  Console->ActiveBuffer->CursorPosition.Y--;
160  }
161  }
162 
164  return;
165  }
166 #endif
167 
168  /* Send the key press to the console driver */
169 
170  er.EventType = KEY_EVENT;
171  er.Event.KeyEvent.bKeyDown = Down;
172  er.Event.KeyEvent.wRepeatCount = 1;
173  er.Event.KeyEvent.wVirtualKeyCode = VirtualKeyCode;
174  er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode;
175  er.Event.KeyEvent.uChar.UnicodeChar = UnicodeChar;
176  er.Event.KeyEvent.dwControlKeyState = ShiftState;
177 
179 }
WCHAR UnicodeChar
Definition: wincon.h:245
WORD wVirtualScanCode
Definition: wincon.h:243
#define WM_CHAR
Definition: winuser.h:1699
VOID ConioDrawConsole(PCONSRV_CONSOLE Console)
Definition: terminal.c:859
DWORD dwControlKeyState
Definition: wincon.h:248
#define VK_DOWN
Definition: winuser.h:2202
int32_t INT
Definition: typedefs.h:57
WORD wVirtualKeyCode
Definition: wincon.h:242
WORD wRepeatCount
Definition: wincon.h:241
#define VK_UP
Definition: winuser.h:2200
unsigned int BOOL
Definition: ntddk_ex.h:94
#define KEY_EVENT
Definition: wincon.h:128
#define WM_SYSCHAR
Definition: winuser.h:1703
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1697
void DPRINT(...)
Definition: polytest.cpp:61
#define LEFT_ALT_PRESSED
Definition: wincon.h:138
__wchar_t WCHAR
Definition: xmlstorage.h:180
union _INPUT_RECORD::@3182 Event
#define WM_KEYUP
Definition: winuser.h:1698
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:278
unsigned long DWORD
Definition: ntddk_ex.h:95
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
static DWORD ConioGetShiftState(PBYTE KeyState, LPARAM lParam)
Definition: input.c:23
int WINAPI ToUnicodeEx(UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl)
Definition: input.c:481
#define WM_SYSKEYUP
Definition: winuser.h:1702
unsigned int UINT
Definition: ndis.h:50
CConsole Console
WORD EventType
Definition: wincon.h:276
#define DPRINT1
Definition: precomp.h:8
#define msg(x)
Definition: auth_time.c:54
union _KEY_EVENT_RECORD::@3181 uChar
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
#define HIWORD(l)
Definition: typedefs.h:246
#define RIGHT_ALT_PRESSED
Definition: wincon.h:137
NTSTATUS ConioProcessInputEvent(PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:201

Referenced by GuiConsoleHandleKey(), and OnKey().

◆ ConioResizeBuffer()

NTSTATUS ConioResizeBuffer ( PCONSOLE  Console,
PTEXTMODE_SCREEN_BUFFER  ScreenBuffer,
COORD  Size 
)

Definition at line 372 of file text.c.

375 {
377  PCHAR_INFO Ptr;
378  ULONG_PTR Offset = 0;
379  WORD CurrentAttribute;
380  USHORT CurrentY;
381  PCHAR_INFO OldBuffer;
382  DWORD i;
383  DWORD diff;
384 
385  /* Zero size is invalid */
386  if (Size.X == 0 || Size.Y == 0)
388 
389  /* Buffer size is not allowed to be smaller than the view size */
390  if (Size.X < ScreenBuffer->ViewSize.X || Size.Y < ScreenBuffer->ViewSize.Y)
392 
393  if (Size.X == ScreenBuffer->ScreenBufferSize.X && Size.Y == ScreenBuffer->ScreenBufferSize.Y)
394  {
395  // FIXME: Trigger a buffer resize event ??
396  return STATUS_SUCCESS;
397  }
398 
399  if (Console->FixedSize)
400  {
401  /*
402  * The console is in fixed-size mode, so we cannot resize anything
403  * at the moment. However, keep those settings somewhere so that
404  * we can try to set them up when we will be allowed to do so.
405  */
406  ScreenBuffer->OldScreenBufferSize = Size;
407  return STATUS_NOT_SUPPORTED; // STATUS_SUCCESS
408  }
409 
411  if (!Buffer) return STATUS_NO_MEMORY;
412 
413  DPRINT("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->ScreenBufferSize.X, ScreenBuffer->ScreenBufferSize.Y, Size.X, Size.Y);
414 
415  OldBuffer = ScreenBuffer->Buffer;
416 
417  for (CurrentY = 0; CurrentY < ScreenBuffer->ScreenBufferSize.Y && CurrentY < Size.Y; CurrentY++)
418  {
419  Ptr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY);
420 
421  if (Size.X <= ScreenBuffer->ScreenBufferSize.X)
422  {
423  /* Reduce size */
424  RtlCopyMemory(Buffer + Offset, Ptr, Size.X * sizeof(CHAR_INFO));
425  Offset += Size.X;
426 
427  /* If we have cut a trailing full-width character in half, remove it completely */
428  Ptr = Buffer + Offset - 1;
429  if (Ptr->Attributes & COMMON_LVB_LEADING_BYTE)
430  {
431  Ptr->Char.UnicodeChar = L' ';
432  /* Keep all the other original attributes intact */
433  Ptr->Attributes &= ~COMMON_LVB_SBCSDBCS;
434  }
435  }
436  else
437  {
438  /* Enlarge size */
439  RtlCopyMemory(Buffer + Offset, Ptr, ScreenBuffer->ScreenBufferSize.X * sizeof(CHAR_INFO));
440  Offset += ScreenBuffer->ScreenBufferSize.X;
441 
442  /* The attribute to be used is the one of the last cell of the current line */
443  CurrentAttribute = ConioCoordToPointer(ScreenBuffer,
444  ScreenBuffer->ScreenBufferSize.X - 1,
445  CurrentY)->Attributes;
446  CurrentAttribute &= ~COMMON_LVB_SBCSDBCS;
447 
448  diff = Size.X - ScreenBuffer->ScreenBufferSize.X;
449 
450  /* Zero-out the new part of the buffer */
451  for (i = 0; i < diff; i++)
452  {
453  Ptr = Buffer + Offset;
454  Ptr->Char.UnicodeChar = L' ';
455  Ptr->Attributes = CurrentAttribute;
456  ++Offset;
457  }
458  }
459  }
460 
461  if (Size.Y > ScreenBuffer->ScreenBufferSize.Y)
462  {
463  diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y);
464 
465  /* Zero-out the new part of the buffer */
466  for (i = 0; i < diff; i++)
467  {
468  Ptr = Buffer + Offset;
469  Ptr->Char.UnicodeChar = L' ';
470  Ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib;
471  ++Offset;
472  }
473  }
474 
476  ConsoleFreeHeap(OldBuffer);
477  ScreenBuffer->ScreenBufferSize = ScreenBuffer->OldScreenBufferSize = Size;
478  ScreenBuffer->VirtualY = 0;
479 
480  /* Ensure the cursor and the view are within the buffer */
481  ScreenBuffer->CursorPosition.X = min(ScreenBuffer->CursorPosition.X, Size.X - 1);
482  ScreenBuffer->CursorPosition.Y = min(ScreenBuffer->CursorPosition.Y, Size.Y - 1);
483  ScreenBuffer->ViewOrigin.X = min(ScreenBuffer->ViewOrigin.X, Size.X - ScreenBuffer->ViewSize.X);
484  ScreenBuffer->ViewOrigin.Y = min(ScreenBuffer->ViewOrigin.Y, Size.Y - ScreenBuffer->ViewSize.Y);
485 
486  /*
487  * Trigger a buffer resize event
488  */
489  if (Console->InputBuffer.Mode & ENABLE_WINDOW_INPUT)
490  {
491  ULONG NumEventsWritten;
492  INPUT_RECORD er;
493 
495  er.Event.WindowBufferSizeEvent.dwSize = ScreenBuffer->ScreenBufferSize;
496 
497  // ConioProcessInputEvent(Console, &er);
499  &Console->InputBuffer,
500  TRUE,
501  &er,
502  1,
503  &NumEventsWritten);
504  }
505 
506  return STATUS_SUCCESS;
507 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:156
#define WINDOW_BUFFER_SIZE_EVENT
Definition: wincon.h:130
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define COMMON_LVB_SBCSDBCS
Definition: wincon.h:56
#define ConsoleAllocHeap(Flags, Size)
Definition: heap.h:14
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
Definition: wincon.h:280
uint32_t ULONG_PTR
Definition: typedefs.h:64
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
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
union _INPUT_RECORD::@3182 Event
WORD Attributes
Definition: wincon.h:187
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define ENABLE_WINDOW_INPUT
Definition: wincon.h:81
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define min(a, b)
Definition: monoChain.cc:55
NTSTATUS NTAPI ConDrvWriteConsoleInput(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, IN BOOLEAN AppendToEnd, IN PINPUT_RECORD InputRecord, IN ULONG NumEventsToWrite, OUT PULONG NumEventsWritten OPTIONAL)
Definition: coninput.c:330
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
CConsole Console
WORD EventType
Definition: wincon.h:276
#define ConsoleFreeHeap(HeapBase)
Definition: heap.h:15
HANDLE ScreenBuffer
Definition: notevil.c:37
#define COMMON_LVB_LEADING_BYTE
Definition: wincon.h:48
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ ConioUnpause()

VOID ConioUnpause ( PCONSRV_CONSOLE  Console,
UCHAR  Flags 
)

Definition at line 250 of file console.c.

251 {
252  Console->PauseFlags &= ~Flags;
253 
254  // if ((Console->PauseFlags & (PAUSED_FROM_KEYBOARD | PAUSED_FROM_SCROLLBAR | PAUSED_FROM_SELECTION)) == 0)
255  if (Console->PauseFlags == 0)
256  {
258 
259  CsrNotifyWait(&Console->WriteWaitQueue,
260  TRUE,
261  NULL,
262  NULL);
263  if (!IsListEmpty(&Console->WriteWaitQueue))
264  {
265  CsrDereferenceWait(&Console->WriteWaitQueue);
266  }
267  }
268 }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
BOOLEAN NTAPI CsrNotifyWait(IN PLIST_ENTRY WaitList, IN BOOLEAN NotifyAll, IN PVOID WaitArgument1, IN PVOID WaitArgument2)
Definition: wait.c:388
VOID NTAPI ConDrvUnpause(PCONSOLE Console)
Definition: console.c:90
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI CsrDereferenceWait(IN PLIST_ENTRY WaitList)
Definition: wait.c:266
CConsole Console

Referenced by ConioProcessInputEvent(), GuiConsoleHandleScroll(), GuiConsoleUpdateSelection(), OnScroll(), PreprocessInput(), and UpdateSelection().

◆ ConSrvConsoleCtrlEvent()

NTSTATUS ConSrvConsoleCtrlEvent ( IN ULONG  CtrlEvent,
IN PCONSOLE_PROCESS_DATA  ProcessData 
)

Definition at line 861 of file console.c.

863 {
864  return ConSrvConsoleCtrlEventTimeout(CtrlEvent, ProcessData, 0);
865 }
NTSTATUS ConSrvConsoleCtrlEventTimeout(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData, IN ULONG Timeout)
Definition: console.c:810

Referenced by ConSrvConsoleProcessCtrlEvent(), and ConSrvRemoveConsole().

◆ ConSrvConsoleProcessCtrlEvent()

NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent ( IN PCONSRV_CONSOLE  Console,
IN ULONG  ProcessGroupId,
IN ULONG  CtrlEvent 
)

Definition at line 907 of file console.c.

910 {
912  PLIST_ENTRY current_entry;
914 
915  /* If the console is already being destroyed, just return */
917  return STATUS_UNSUCCESSFUL;
918 
919  /*
920  * Loop through the process list, from the most recent process
921  * (the active one) to the oldest one (the first created, i.e.
922  * the console leader process), and for each, send an event
923  * (new processes are inserted at the head of the console process list).
924  */
925  current_entry = Console->ProcessList.Flink;
926  while (current_entry != &Console->ProcessList)
927  {
928  current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
929  current_entry = current_entry->Flink;
930 
931  /*
932  * Only processes belonging to the same process group are signaled.
933  * If the process group ID is zero, then all the processes are signaled.
934  */
935  if (ProcessGroupId == 0 || current->Process->ProcessGroupId == ProcessGroupId)
936  {
937  Status = ConSrvConsoleCtrlEvent(CtrlEvent, current);
938  }
939  }
940 
941  return Status;
942 }
BOOLEAN NTAPI ConDrvValidateConsoleState(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState)
Definition: console.c:105
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
Definition: console.c:861
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: typedefs.h:118
Status
Definition: gdiplustypes.h:24
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct task_struct * current
Definition: linux.c:32

Referenced by ConioProcessInputEvent(), CSR_API(), and OnClose().

◆ ConSrvGetConsoleLeaderProcess()

PCONSOLE_PROCESS_DATA NTAPI ConSrvGetConsoleLeaderProcess ( IN PCONSRV_CONSOLE  Console)

Definition at line 868 of file console.c.

869 {
870  if (Console == NULL) return NULL;
871 
872  return CONTAINING_RECORD(Console->ProcessList.Blink,
874  ConsoleLink);
875 }
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
CConsole Console

Referenced by ConSrvRemoveConsole(), GuiApplyUserSettings(), GuiConsoleShowConsoleProperties(), and SetConWndConsoleLeaderCID().

◆ ConSrvSetConsoleProcessFocus()

NTSTATUS NTAPI ConSrvSetConsoleProcessFocus ( IN PCONSRV_CONSOLE  Console,
IN BOOLEAN  SetForeground 
)

Definition at line 958 of file console.c.

960 {
961  PLIST_ENTRY current_entry;
963 
964  /* If the console is already being destroyed, just return */
966  return STATUS_UNSUCCESSFUL;
967 
968  /*
969  * Loop through the process list, from the most recent process
970  * to the oldest one, and for each, set its foreground priority.
971  */
972  current_entry = Console->ProcessList.Flink;
973  while (current_entry != &Console->ProcessList)
974  {
975  current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
976  current_entry = current_entry->Flink;
977 
978  ConSrvSetProcessFocus(current->Process, SetForeground);
979  }
980 
981  return STATUS_SUCCESS;
982 }
BOOLEAN NTAPI ConDrvValidateConsoleState(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState)
Definition: console.c:105
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: typedefs.h:118
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct task_struct * current
Definition: linux.c:32
VOID ConSrvSetProcessFocus(IN PCSR_PROCESS CsrProcess, IN BOOLEAN SetForeground)
Definition: console.c:945

Referenced by OnFocus().

◆ ConSrvSetProcessFocus()

VOID ConSrvSetProcessFocus ( IN PCSR_PROCESS  CsrProcess,
IN BOOLEAN  SetForeground 
)

Definition at line 945 of file console.c.

947 {
948  // FIXME: Call NtUserSetInformationProcess (currently unimplemented!)
949  // for setting Win32 foreground/background flags.
950 
951  if (SetForeground)
953  else
955 }
PKPROCESS CsrProcess
Definition: videoprt.c:37
VOID NTAPI CsrSetForegroundPriority(IN PCSR_PROCESS CsrProcess)
Definition: procsup.c:1129
VOID NTAPI CsrSetBackgroundPriority(IN PCSR_PROCESS CsrProcess)
Definition: procsup.c:1098

Referenced by ConSrvAllocateConsole(), ConSrvInheritConsole(), and ConSrvSetConsoleProcessFocus().