ReactOS  0.4.13-dev-249-gcba1a2f
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, UINT Flags)
 
VOID ConioUnpause (PCONSRV_CONSOLE Console, UINT 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 140 of file text.c.

141 {
142  return &Buff->Buffer[((Y + Buff->VirtualY) % Buff->ScreenBufferSize.Y) * Buff->ScreenBufferSize.X + X];
143 }
#define Y(I)
PCHAR_INFO Buffer
Definition: conio.h:154
#define X(b, s)

◆ ConioDrawConsole()

VOID ConioDrawConsole ( PCONSRV_CONSOLE  Console)

Definition at line 663 of file terminal.c.

664 {
666  PCONSOLE_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer;
667 
668  if (!ActiveBuffer) return;
669 
670  ConioInitRect(&Region, 0, 0,
671  ActiveBuffer->ViewSize.Y - 1,
672  ActiveBuffer->ViewSize.X - 1);
674  // Console->FrontEndIFace.Vtbl->DrawRegion(&Console->FrontEndIFace, &Region);
675 }
#define TermDrawRegion(Console, Region)
Definition: term.h:22
ULONG X
Definition: bl.h:1340
#define ConioInitRect(Rect, top, left, bottom, right)
Definition: rect.h:12
CConsole Console
ULONG Y
Definition: bl.h:1341

Referenced by ConDrvProcessKey(), and ConioProcessKey().

◆ ConioEffectiveCursorSize()

DWORD ConioEffectiveCursorSize ( PCONSRV_CONSOLE  Console,
DWORD  Scale 
)

Definition at line 190 of file input.c.

191 {
192  DWORD Size = (Console->ActiveBuffer->CursorInfo.dwSize * Scale + 99) / 100;
193  /* If line input in progress, perhaps adjust for insert toggle */
194  if (Console->LineBuffer && !Console->LineComplete && (Console->InsertMode ? !Console->LineInsertToggle : Console->LineInsertToggle))
195  return (Size * 2 <= Scale) ? (Size * 2) : (Size / 2);
196  return Size;
197 }
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,
UINT  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 195 of file coninput.c.

197 {
198  ULONG NumEventsWritten;
200  InputEvent,
201  1,
202  &NumEventsWritten,
203  TRUE);
204 }
#define TRUE
Definition: types.h:120
static NTSTATUS ConioAddInputEvents(PCONSRV_CONSOLE Console, PINPUT_RECORD InputRecords, ULONG NumEventsToWrite, PULONG NumEventsWritten, BOOLEAN AppendToEnd)
Definition: coninput.c:161
CConsole Console
unsigned int ULONG
Definition: retypes.h:1

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 57 of file input.c.

58 {
59  static BYTE KeyState[256] = { 0 };
60  /* MSDN mentions that you should use the last virtual key code received
61  * when putting a virtual key identity to a WM_CHAR message since multiple
62  * or translated keys may be involved. */
63  static UINT LastVirtualKey = 0;
64  DWORD ShiftState;
65  WCHAR UnicodeChar;
66  UINT VirtualKeyCode;
67  UINT VirtualScanCode;
68  BOOL Down = FALSE;
69  BOOLEAN Fake; // Synthesized, not a real event
70  BOOLEAN NotChar; // Message should not be used to return a character
71 
72  INPUT_RECORD er;
73 
74  if (Console == NULL)
75  {
76  DPRINT1("No Active Console!\n");
77  return;
78  }
79 
80  VirtualScanCode = HIWORD(msg->lParam) & 0xFF;
81  Down = msg->message == WM_KEYDOWN || msg->message == WM_CHAR ||
82  msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSCHAR;
83 
84  GetKeyboardState(KeyState);
85  ShiftState = ConioGetShiftState(KeyState, msg->lParam);
86 
87  if (msg->message == WM_CHAR || msg->message == WM_SYSCHAR)
88  {
89  VirtualKeyCode = LastVirtualKey;
90  UnicodeChar = msg->wParam;
91  }
92  else
93  {
94  WCHAR Chars[2];
95  INT RetChars = 0;
96 
97  VirtualKeyCode = msg->wParam;
98  RetChars = ToUnicodeEx(VirtualKeyCode,
99  VirtualScanCode,
100  KeyState,
101  Chars,
102  2,
103  0,
104  NULL);
105  UnicodeChar = (RetChars == 1 ? Chars[0] : 0);
106  }
107 
108  Fake = UnicodeChar &&
109  (msg->message != WM_CHAR && msg->message != WM_SYSCHAR &&
110  msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP);
111  NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR);
112  if (NotChar) LastVirtualKey = msg->wParam;
113 
114  DPRINT("CONSRV: %s %s %s %s %02x %02x '%lc' %04x\n",
115  Down ? "down" : "up ",
116  (msg->message == WM_CHAR || msg->message == WM_SYSCHAR) ?
117  "char" : "key ",
118  Fake ? "fake" : "real",
119  NotChar ? "notc" : "char",
120  VirtualScanCode,
121  VirtualKeyCode,
122  (UnicodeChar >= L' ') ? UnicodeChar : L'.',
123  ShiftState);
124 
125  if (Fake) return;
126 
127  /* Process Ctrl-C and Ctrl-Break */
128  if ( Console->InputBuffer.Mode & ENABLE_PROCESSED_INPUT &&
129  Down && (VirtualKeyCode == VK_PAUSE || VirtualKeyCode == 'C') &&
130  (ShiftState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) || KeyState[VK_CONTROL] & 0x80) )
131  {
132  DPRINT1("Console_Api Ctrl-C\n");
134 
135  if (Console->LineBuffer && !Console->LineComplete)
136  {
137  /* Line input is in progress; end it */
138  Console->LinePos = Console->LineSize = 0;
139  Console->LineComplete = TRUE;
140  }
141  return;
142  }
143 
144  if ( (ShiftState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) != 0 &&
145  (VirtualKeyCode == VK_UP || VirtualKeyCode == VK_DOWN) )
146  {
147  if (!Down) return;
148 
149  /* Scroll up or down */
150  if (VirtualKeyCode == VK_UP)
151  {
152  /* Only scroll up if there is room to scroll up into */
153  if (Console->ActiveBuffer->CursorPosition.Y != Console->ActiveBuffer->ScreenBufferSize.Y - 1)
154  {
155  Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY +
156  Console->ActiveBuffer->ScreenBufferSize.Y - 1) %
157  Console->ActiveBuffer->ScreenBufferSize.Y;
158  Console->ActiveBuffer->CursorPosition.Y++;
159  }
160  }
161  else
162  {
163  /* Only scroll down if there is room to scroll down into */
164  if (Console->ActiveBuffer->CursorPosition.Y != 0)
165  {
166  Console->ActiveBuffer->VirtualY = (Console->ActiveBuffer->VirtualY + 1) %
167  Console->ActiveBuffer->ScreenBufferSize.Y;
168  Console->ActiveBuffer->CursorPosition.Y--;
169  }
170  }
171 
173  return;
174  }
175 
176  /* Send the key press to the console driver */
177 
178  er.EventType = KEY_EVENT;
179  er.Event.KeyEvent.bKeyDown = Down;
180  er.Event.KeyEvent.wRepeatCount = 1;
181  er.Event.KeyEvent.wVirtualKeyCode = VirtualKeyCode;
182  er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode;
183  er.Event.KeyEvent.uChar.UnicodeChar = UnicodeChar;
184  er.Event.KeyEvent.dwControlKeyState = ShiftState;
185 
187 }
#define TRUE
Definition: types.h:120
WCHAR UnicodeChar
Definition: wincon.h:230
WORD wVirtualScanCode
Definition: wincon.h:228
#define WM_CHAR
Definition: winuser.h:1693
union _KEY_EVENT_RECORD::@3144 uChar
VOID ConioDrawConsole(PCONSRV_CONSOLE Console)
Definition: terminal.c:663
DWORD dwControlKeyState
Definition: wincon.h:233
#define CTRL_C_EVENT
Definition: wincon.h:65
#define VK_DOWN
Definition: winuser.h:2181
int32_t INT
Definition: typedefs.h:56
WORD wVirtualKeyCode
Definition: wincon.h:227
WORD wRepeatCount
Definition: wincon.h:226
#define VK_UP
Definition: winuser.h:2179
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
Definition: console.c:906
unsigned int BOOL
Definition: ntddk_ex.h:94
#define KEY_EVENT
Definition: wincon.h:122
#define WM_SYSCHAR
Definition: winuser.h:1697
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1691
void DPRINT(...)
Definition: polytest.cpp:61
union _INPUT_RECORD::@3145 Event
#define LEFT_ALT_PRESSED
Definition: wincon.h:132
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_KEYUP
Definition: winuser.h:1692
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:263
unsigned long DWORD
Definition: ntddk_ex.h:95
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
#define LEFT_CTRL_PRESSED
Definition: wincon.h:134
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 ENABLE_PROCESSED_INPUT
Definition: wincon.h:75
#define WM_SYSKEYUP
Definition: winuser.h:1696
unsigned int UINT
Definition: ndis.h:50
#define VK_CONTROL
Definition: winuser.h:2157
CConsole Console
WORD EventType
Definition: wincon.h:261
#define DPRINT1
Definition: precomp.h:8
#define msg(x)
Definition: auth_time.c:54
#define VK_PAUSE
Definition: winuser.h:2159
#define WM_SYSKEYDOWN
Definition: winuser.h:1695
#define HIWORD(l)
Definition: typedefs.h:246
#define RIGHT_CTRL_PRESSED
Definition: wincon.h:133
#define RIGHT_ALT_PRESSED
Definition: wincon.h:131
NTSTATUS ConioProcessInputEvent(PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:195

Referenced by GuiConsoleHandleKey(), and OnKey().

◆ ConioResizeBuffer()

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

Definition at line 257 of file text.c.

260 {
262  DWORD Offset = 0;
263  PCHAR_INFO ptr;
264  WORD CurrentAttribute;
265  USHORT CurrentY;
266  PCHAR_INFO OldBuffer;
267  DWORD i;
268  DWORD diff;
269 
270  /* Buffer size is not allowed to be smaller than the view size */
271  if (Size.X < ScreenBuffer->ViewSize.X || Size.Y < ScreenBuffer->ViewSize.Y)
273 
274  if (Size.X == ScreenBuffer->ScreenBufferSize.X && Size.Y == ScreenBuffer->ScreenBufferSize.Y)
275  {
276  // FIXME: Trigger a buffer resize event ??
277  return STATUS_SUCCESS;
278  }
279 
280  if (Console->FixedSize)
281  {
282  /*
283  * The console is in fixed-size mode, so we cannot resize anything
284  * at the moment. However, keep those settings somewhere so that
285  * we can try to set them up when we will be allowed to do so.
286  */
287  ScreenBuffer->OldScreenBufferSize = Size;
288  return STATUS_NOT_SUPPORTED; // STATUS_SUCCESS
289  }
290 
292  if (!Buffer) return STATUS_NO_MEMORY;
293 
294  DPRINT("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->ScreenBufferSize.X, ScreenBuffer->ScreenBufferSize.Y, Size.X, Size.Y);
295  OldBuffer = ScreenBuffer->Buffer;
296 
297  for (CurrentY = 0; CurrentY < ScreenBuffer->ScreenBufferSize.Y && CurrentY < Size.Y; CurrentY++)
298  {
299  ptr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY);
300  if (Size.X <= ScreenBuffer->ScreenBufferSize.X)
301  {
302  /* Reduce size */
303  RtlCopyMemory(Buffer + Offset, ptr, Size.X * sizeof(CHAR_INFO));
304  Offset += Size.X;
305  }
306  else
307  {
308  /* Enlarge size */
309  RtlCopyMemory(Buffer + Offset, ptr, ScreenBuffer->ScreenBufferSize.X * sizeof(CHAR_INFO));
310  Offset += ScreenBuffer->ScreenBufferSize.X;
311 
312  /* The attribute to be used is the one of the last cell of the current line */
313  CurrentAttribute = ConioCoordToPointer(ScreenBuffer,
314  ScreenBuffer->ScreenBufferSize.X - 1,
315  CurrentY)->Attributes;
316 
317  diff = Size.X - ScreenBuffer->ScreenBufferSize.X;
318 
319  /* Zero-out the new part of the buffer */
320  for (i = 0; i < diff; i++)
321  {
322  ptr = Buffer + Offset;
323  ptr->Char.UnicodeChar = L' ';
324  ptr->Attributes = CurrentAttribute;
325  ++Offset;
326  }
327  }
328  }
329 
330  if (Size.Y > ScreenBuffer->ScreenBufferSize.Y)
331  {
332  diff = Size.X * (Size.Y - ScreenBuffer->ScreenBufferSize.Y);
333 
334  /* Zero-out the new part of the buffer */
335  for (i = 0; i < diff; i++)
336  {
337  ptr = Buffer + Offset;
338  ptr->Char.UnicodeChar = L' ';
339  ptr->Attributes = ScreenBuffer->ScreenDefaultAttrib;
340  ++Offset;
341  }
342  }
343 
345  ConsoleFreeHeap(OldBuffer);
346  ScreenBuffer->ScreenBufferSize = ScreenBuffer->OldScreenBufferSize = Size;
347  ScreenBuffer->VirtualY = 0;
348 
349  /* Ensure cursor and window are within buffer */
350  if (ScreenBuffer->CursorPosition.X >= Size.X)
351  ScreenBuffer->CursorPosition.X = Size.X - 1;
352  if (ScreenBuffer->CursorPosition.Y >= Size.Y)
353  ScreenBuffer->CursorPosition.Y = Size.Y - 1;
354  if (ScreenBuffer->ViewOrigin.X > Size.X - ScreenBuffer->ViewSize.X)
355  ScreenBuffer->ViewOrigin.X = Size.X - ScreenBuffer->ViewSize.X;
356  if (ScreenBuffer->ViewOrigin.Y > Size.Y - ScreenBuffer->ViewSize.Y)
357  ScreenBuffer->ViewOrigin.Y = Size.Y - ScreenBuffer->ViewSize.Y;
358 
359  /*
360  * Trigger a buffer resize event
361  */
362  if (Console->InputBuffer.Mode & ENABLE_WINDOW_INPUT)
363  {
364  ULONG NumEventsWritten;
365  INPUT_RECORD er;
366 
368  er.Event.WindowBufferSizeEvent.dwSize = ScreenBuffer->ScreenBufferSize;
369 
370  // ConioProcessInputEvent(Console, &er);
372  &Console->InputBuffer,
373  TRUE,
374  &er,
375  1,
376  &NumEventsWritten);
377  }
378 
379  return STATUS_SUCCESS;
380 }
#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:140
#define WINDOW_BUFFER_SIZE_EVENT
Definition: wincon.h:124
#define ConsoleAllocHeap(Flags, Size)
Definition: heap.h:14
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
Definition: wincon.h:265
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
static PVOID ptr
Definition: dispmode.c:27
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
union _INPUT_RECORD::@3145 Event
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
WORD Attributes
Definition: wincon.h:172
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:78
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
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:325
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
CConsole Console
WORD EventType
Definition: wincon.h:261
#define ConsoleFreeHeap(HeapBase)
Definition: heap.h:15
HANDLE ScreenBuffer
Definition: notevil.c:37
#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:2745

◆ ConioUnpause()

VOID ConioUnpause ( PCONSRV_CONSOLE  Console,
UINT  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:91
_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 860 of file console.c.

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

Referenced by ConSrvConsoleProcessCtrlEvent(), and ConSrvRemoveConsole().

◆ ConSrvConsoleProcessCtrlEvent()

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

Definition at line 906 of file console.c.

909 {
911  PLIST_ENTRY current_entry;
913 
914  /* If the console is already being destroyed, just return */
916  return STATUS_UNSUCCESSFUL;
917 
918  /*
919  * Loop through the process list, from the most recent process
920  * (the active one) to the oldest one (the first created, i.e.
921  * the console leader process), and for each, send an event
922  * (new processes are inserted at the head of the console process list).
923  */
924  current_entry = Console->ProcessList.Flink;
925  while (current_entry != &Console->ProcessList)
926  {
927  current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
928  current_entry = current_entry->Flink;
929 
930  /*
931  * Only processes belonging to the same process group are signaled.
932  * If the process group ID is zero, then all the processes are signaled.
933  */
934  if (ProcessGroupId == 0 || current->Process->ProcessGroupId == ProcessGroupId)
935  {
936  Status = ConSrvConsoleCtrlEvent(CtrlEvent, current);
937  }
938  }
939 
940  return Status;
941 }
BOOLEAN NTAPI ConDrvValidateConsoleState(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState)
Definition: console.c:108
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
Definition: console.c:860
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:119
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2745
struct task_struct * current
Definition: linux.c:32

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

◆ ConSrvGetConsoleLeaderProcess()

PCONSOLE_PROCESS_DATA NTAPI ConSrvGetConsoleLeaderProcess ( IN PCONSRV_CONSOLE  Console)

Definition at line 867 of file console.c.

868 {
869  if (Console == NULL) return NULL;
870 
871  return CONTAINING_RECORD(Console->ProcessList.Blink,
873  ConsoleLink);
874 }
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 957 of file console.c.

959 {
960  PLIST_ENTRY current_entry;
962 
963  /* If the console is already being destroyed, just return */
965  return STATUS_UNSUCCESSFUL;
966 
967  /*
968  * Loop through the process list, from the most recent process
969  * to the oldest one, and for each, set its foreground priority.
970  */
971  current_entry = Console->ProcessList.Flink;
972  while (current_entry != &Console->ProcessList)
973  {
974  current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
975  current_entry = current_entry->Flink;
976 
977  ConSrvSetProcessFocus(current->Process, SetForeground);
978  }
979 
980  return STATUS_SUCCESS;
981 }
BOOLEAN NTAPI ConDrvValidateConsoleState(IN PCONSOLE Console, IN CONSOLE_STATE ExpectedState)
Definition: console.c:108
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:119
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: typedefs.h:117
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2745
struct task_struct * current
Definition: linux.c:32
VOID ConSrvSetProcessFocus(IN PCSR_PROCESS CsrProcess, IN BOOLEAN SetForeground)
Definition: console.c:944

Referenced by OnFocus().

◆ ConSrvSetProcessFocus()

VOID ConSrvSetProcessFocus ( IN PCSR_PROCESS  CsrProcess,
IN BOOLEAN  SetForeground 
)

Definition at line 944 of file console.c.

946 {
947  // FIXME: Call NtUserSetInformationProcess (currently unimplemented!)
948  // for setting Win32 foreground/background flags.
949 
950  if (SetForeground)
951  CsrSetForegroundPriority(CsrProcess);
952  else
953  CsrSetBackgroundPriority(CsrProcess);
954 }
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().