ReactOS  0.4.15-dev-1197-g8081ba9
conio_winsrv.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Console Server DLL
4  * FILE: win32ss/user/winsrv/consrv/include/conio_winsrv.h
5  * PURPOSE: Public Console I/O Interface - Offers wrap-up structures
6  * over the console objects exposed by the console driver.
7  * PROGRAMMERS: Gé van Geldorp
8  * Jeffrey Morlan
9  * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10  */
11 
12 #pragma once
13 
14 // #include "rect.h"
15 
16 #define CSR_DEFAULT_CURSOR_SIZE 25
17 
18 /* VGA character cell */
19 typedef struct _CHAR_CELL
20 {
21  CHAR Char;
24 C_ASSERT(sizeof(CHAR_CELL) == 2);
25 
26 // #include "conio.h"
27 
28 typedef struct _FRONTEND FRONTEND, *PFRONTEND;
29 
30 struct _CONSRV_CONSOLE;
31 
32 typedef struct _FRONTEND_VTBL
33 {
34  // NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
35 
36  /*
37  * Internal interface (functions called by the console server only)
38  */
39  NTSTATUS (NTAPI *InitFrontEnd)(IN OUT PFRONTEND This,
41  VOID (NTAPI *DeinitFrontEnd)(IN OUT PFRONTEND This);
42 
43  /* Interface used for both text-mode and graphics screen buffers */
46  /* Interface used only for text-mode screen buffers */
47  VOID (NTAPI *WriteStream)(IN OUT PFRONTEND This,
52  PWCHAR Buffer,
53  UINT Length);
54  VOID (NTAPI *RingBell)(IN OUT PFRONTEND This);
55  BOOL (NTAPI *SetCursorInfo)(IN OUT PFRONTEND This,
57  BOOL (NTAPI *SetScreenInfo)(IN OUT PFRONTEND This,
61  VOID (NTAPI *ResizeTerminal)(IN OUT PFRONTEND This);
63  VOID (NTAPI *ReleaseScreenBuffer)(IN OUT PFRONTEND This,
65  VOID (NTAPI *RefreshInternalInfo)(IN OUT PFRONTEND This);
66 
67  /*
68  * External interface (functions corresponding to the Console API)
69  */
70  VOID (NTAPI *ChangeTitle)(IN OUT PFRONTEND This);
71  BOOL (NTAPI *ChangeIcon)(IN OUT PFRONTEND This,
74  HWND (NTAPI *GetConsoleWindowHandle)(IN OUT PFRONTEND This);
77  BOOL (NTAPI *GetSelectionInfo)(IN OUT PFRONTEND This,
79  BOOL (NTAPI *SetPalette)(IN OUT PFRONTEND This,
80  HPALETTE PaletteHandle,
82  ULONG (NTAPI *GetDisplayMode)(IN OUT PFRONTEND This);
83  BOOL (NTAPI *SetDisplayMode)(IN OUT PFRONTEND This,
85  INT (NTAPI *ShowMouseCursor)(IN OUT PFRONTEND This,
87  BOOL (NTAPI *SetMouseCursor)(IN OUT PFRONTEND This,
89  HMENU (NTAPI *MenuControl)(IN OUT PFRONTEND This,
91  UINT CmdIdHigh);
92  BOOL (NTAPI *SetMenuClose)(IN OUT PFRONTEND This,
95 
96 struct _FRONTEND
97 {
98  PFRONTEND_VTBL Vtbl; /* Virtual table */
99  NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
100 
101  struct _CONSRV_CONSOLE* Console; /* Console to which the frontend is attached to */
102  PVOID Context; /* Private context */
103  PVOID Context2; /* Private context */
104 };
105 
106 /* PauseFlags values (internal only) */
107 #define PAUSED_FROM_KEYBOARD 0x1
108 #define PAUSED_FROM_SCROLLBAR 0x2
109 #define PAUSED_FROM_SELECTION 0x4
110 
111 typedef struct _CONSRV_CONSOLE
112 {
113 /******************************* Console Set-up *******************************/
114  /* This **MUST** be FIRST!! */
116  // CONSOLE Console;
117  // // PCONSOLE Console;
118 
119  // LONG ReferenceCount; /* Is incremented each time a handle to something in the console (a screen-buffer or the input buffer of this console) gets referenced */
120  // CRITICAL_SECTION Lock;
121  // CONSOLE_STATE State; /* State of the console */
122 
123  // ULONG ConsoleID; /* The ID of the console */
124  // LIST_ENTRY ListEntry; /* Entry in the list of consoles */
125 
126  HANDLE InitEvents[MAX_INIT_EVENTS]; /* Initialization events */
127 
128  FRONTEND FrontEndIFace; /* Frontend-specific interface */
129 
130 /******************************* Process support ******************************/
131  LIST_ENTRY ProcessList; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */
132  PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess; /* Pointer to the unique process that needs to be notified when the console leader process is killed */
133  BOOLEAN NotifyLastClose; /* TRUE if the console should send a control event when the console leader process is killed */
134  BOOLEAN HasFocus; /* TRUE if the console has focus (is in the foreground) */
135 
136 /******************************* Pausing support ******************************/
138  LIST_ENTRY ReadWaitQueue; /* List head for the queue of unique input buffer read wait blocks */
139  LIST_ENTRY WriteWaitQueue; /* List head for the queue of current screen-buffer write wait blocks */
140 
141 /**************************** Aliases and Histories ***************************/
144  ULONG NumberOfHistoryBuffers; /* Number of history buffers */
145  ULONG MaxNumberOfHistoryBuffers; /* Maximum number of history buffers allowed */
146  ULONG HistoryBufferSize; /* Size for newly created history buffers */
147  BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */
148 
149 /**************************** Input Line Discipline ***************************/
150  PWCHAR LineBuffer; /* Current line being input, in line buffered mode */
151  ULONG LineMaxSize; /* Maximum size of line in characters (including CR+LF) */
152  ULONG LineSize; /* Current size of line */
153  ULONG LinePos; /* Current position within line */
154  BOOLEAN LineComplete; /* User pressed enter, ready to send back to client */
156  BOOLEAN LineInsertToggle; /* Replace character over cursor instead of inserting */
157  ULONG LineWakeupMask; /* Bitmap of which control characters will end line input */
158 
161 
162 /************************ Virtual DOS Machine support *************************/
163  COORD VDMBufferSize; /* Real size of the VDM buffer, in units of ??? */
164  HANDLE VDMBufferSection; /* Handle to the memory shared section for the VDM buffer */
165  PVOID VDMBuffer; /* Our VDM buffer */
166  PVOID ClientVDMBuffer; /* A copy of the client view of our VDM buffer */
167  HANDLE VDMClientProcess; /* Handle to the client process who opened the buffer, to unmap the view */
168 
172 
173 /****************************** Other properties ******************************/
174  LIST_ENTRY PopupWindows; /* List of popup windows */
175  UNICODE_STRING OriginalTitle; /* Original title of console, the one defined when the console leader is launched; it never changes. Always NULL-terminated */
176  UNICODE_STRING Title; /* Title of console. Always NULL-terminated */
177  COLORREF Colors[16]; /* Colour palette */
178 
180 
181 /* console.c */
184 
187 NTSTATUS
189  IN PCONSOLE_PROCESS_DATA ProcessData);
190 
193  IN ULONG ProcessGroupId,
194  IN ULONG CtrlEvent);
195 VOID
197  IN BOOLEAN SetForeground);
200  IN BOOLEAN SetForeground);
201 
202 /* coninput.c */
205  DWORD Scale);
206 
207 NTSTATUS
209  PINPUT_RECORD InputEvent);
210 
211 /* conoutput.c */
213 
214 /* terminal.c */
216 
217 /* EOF */
BOOLEAN HistoryNoDup
Definition: conio_winsrv.h:147
#define IN
Definition: typedefs.h:39
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:143
static HICON
Definition: imagelist.c:84
DWORD ConioEffectiveCursorSize(PCONSRV_CONSOLE Console, DWORD Scale)
Definition: input.c:182
struct _CHAR_CELL * PCHAR_CELL
HDESK(NTAPI *GetThreadConsoleDesktop)(IN OUT PFRONTEND This)
SMALL_RECT SHORT SHORT UINT PWCHAR UINT Length
Definition: conio_winsrv.h:48
#define Y(I)
HWND(NTAPI *GetConsoleWindowHandle)(IN OUT PFRONTEND This)
struct _CONSRV_CONSOLE CONSRV_CONSOLE
NTSTATUS(NTAPI *InitFrontEnd)(IN OUT PFRONTEND This
char CHAR
Definition: xmlstorage.h:175
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LIST_ENTRY ReadWaitQueue
Definition: conio_winsrv.h:138
HMENU(NTAPI *MenuControl)(IN OUT PFRONTEND This
SMALL_RECT SHORT SHORT CursorStartY
Definition: conio_winsrv.h:48
LONG NTSTATUS
Definition: precomp.h:26
PCONSOLE_SCREEN_BUFFER ScreenBuffer
Definition: conio_winsrv.h:56
HANDLE EndHardwareEvent
Definition: conio_winsrv.h:170
HPALETTE UINT PaletteUsage
Definition: conio_winsrv.h:80
struct _CHAR_CELL CHAR_CELL
HCURSOR CursorHandle
Definition: conio_winsrv.h:88
PKPROCESS CsrProcess
Definition: videoprt.c:39
uint16_t * PWCHAR
Definition: typedefs.h:56
HICON HCURSOR
Definition: windef.h:299
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
Definition: console.c:1402
struct _FRONTEND * PFRONTEND
Definition: conio_winsrv.h:28
FRONTEND FrontEndIFace
Definition: conio_winsrv.h:128
PVOID Context2
Definition: conio_winsrv.h:103
struct _CONSRV_CONSOLE * Console
Definition: conio_winsrv.h:101
IN struct _CONSRV_CONSOLE * Console
Definition: conio_winsrv.h:40
BYTE Attributes
Definition: svga.h:393
struct _FRONTEND_VTBL FRONTEND_VTBL
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
UNICODE_STRING Title
Definition: conio_winsrv.h:176
BOOLEAN LineInsertToggle
Definition: conio_winsrv.h:156
PCONSOLE_PROCESS_DATA NTAPI ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console)
Definition: console.c:1363
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned int BOOL
Definition: ntddk_ex.h:94
short SHORT
Definition: pedump.c:59
HANDLE VDMClientProcess
Definition: conio_winsrv.h:167
HANDLE VDMBufferSection
Definition: conio_winsrv.h:164
NTSTATUS ConioProcessInputEvent(PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:201
NTSTATUS(NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This)
unsigned char BOOLEAN
PVOID Context
Definition: conio_winsrv.h:102
SMALL_RECT * Region
Definition: conio_winsrv.h:45
NTSTATUS ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
Definition: console.c:1356
C_ASSERT(sizeof(CHAR_CELL)==2)
CHAR Char
Definition: svga.h:392
LIST_ENTRY WriteWaitQueue
Definition: conio_winsrv.h:139
HANDLE StartHardwareEvent
Definition: conio_winsrv.h:169
VOID ConSrvSetProcessFocus(IN PCSR_PROCESS CsrProcess, IN BOOLEAN SetForeground)
Definition: console.c:1440
DWORD COLORREF
Definition: windef.h:300
Colors
Definition: ansiprsr.h:4
PCONSOLE_SELECTION_INFO pSelectionInfo
Definition: conio_winsrv.h:78
COORD WINAPI DECLSPEC_HOTPATCH GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
Definition: console.c:1675
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID ConioDrawConsole(PCONSRV_CONSOLE Console)
Definition: terminal.c:860
PFRONTEND_VTBL Vtbl
Definition: conio_winsrv.h:98
ULONG MaxNumberOfHistoryBuffers
Definition: conio_winsrv.h:145
BOOLEAN LineUpPressed
Definition: conio_winsrv.h:155
BOOLEAN NotifyLastClose
Definition: conio_winsrv.h:133
ULONG HistoryBufferSize
Definition: conio_winsrv.h:146
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI ConioProcessKey(PCONSRV_CONSOLE Console, MSG *msg)
Definition: input.c:60
VOID(NTAPI *DeinitFrontEnd)(IN OUT PFRONTEND This)
Definition: typedefs.h:119
BOOLEAN InsertMode
Definition: conio_winsrv.h:159
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
ULONG(NTAPI *GetDisplayMode)(IN OUT PFRONTEND This)
UNICODE_STRING OriginalTitle
Definition: conio_winsrv.h:175
Definition: bl.h:1338
unsigned char BYTE
Definition: xxhash.c:193
VOID ConioUnpause(PCONSRV_CONSOLE Console, UCHAR Flags)
Definition: console.c:866
LIST_ENTRY PopupWindows
Definition: conio_winsrv.h:174
static VOID SetActiveScreenBuffer(HANDLE ScreenBuffer)
Definition: video.c:439
ULONG NumberOfHistoryBuffers
Definition: conio_winsrv.h:144
HPALETTE PaletteHandle
Definition: conio_winsrv.h:80
UINT UINT CmdIdHigh
Definition: conio_winsrv.h:90
BOOL(NTAPI *SetCursorInfo)(IN OUT PFRONTEND This
SMALL_RECT SHORT SHORT UINT ScrolledLines
Definition: conio_winsrv.h:48
unsigned int UINT
Definition: ndis.h:50
struct _FRONTEND_VTBL * PFRONTEND_VTBL
CConsole Console
#define msg(x)
Definition: auth_time.c:54
BOOLEAN LineComplete
Definition: conio_winsrv.h:154
#define OUT
Definition: typedefs.h:40
PCONSOLE_SCREEN_BUFFER SHORT SHORT OldCursorY
Definition: conio_winsrv.h:58
IN PCONSOLE_SCREEN_BUFFER ScreenBuffer
Definition: conio_winsrv.h:64
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI ConSrvSetConsoleProcessFocus(IN PCONSRV_CONSOLE Console, IN BOOLEAN SetForeground)
Definition: console.c:1453
HANDLE InitEvents[MAX_INIT_EVENTS]
Definition: conio_winsrv.h:126
LIST_ENTRY HistoryBuffers
Definition: conio_winsrv.h:143
struct _ALIAS_HEADER * Aliases
Definition: conio_winsrv.h:142
PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess
Definition: conio_winsrv.h:132
SMALL_RECT SHORT SHORT UINT PWCHAR Buffer
Definition: conio_winsrv.h:48
PCONSOLE_SCREEN_BUFFER SHORT OldCursorX
Definition: conio_winsrv.h:58
SMALL_RECT SHORT CursorStartX
Definition: conio_winsrv.h:48
INT(NTAPI *ShowMouseCursor)(IN OUT PFRONTEND This
NTSTATUS NTAPI GetThreadConsoleDesktop(IN ULONG_PTR ThreadId, OUT HDESK *ConsoleDesktop)
Definition: frontendctl.c:265
VOID ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags)
Definition: console.c:859
LIST_ENTRY ProcessList
Definition: conio_winsrv.h:131
HANDLE ErrorHardwareEvent
Definition: conio_winsrv.h:171
static VOID DrawRegion(PGUI_CONSOLE_DATA GuiData, SMALL_RECT *Region)
Definition: guiterm.c:76