ReactOS  0.4.15-dev-4914-g2220e56
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  BOOL (NTAPI *SetCodePage)(IN OUT PFRONTEND This,
84  ULONG (NTAPI *GetDisplayMode)(IN OUT PFRONTEND This);
85  BOOL (NTAPI *SetDisplayMode)(IN OUT PFRONTEND This,
87  INT (NTAPI *ShowMouseCursor)(IN OUT PFRONTEND This,
89  BOOL (NTAPI *SetMouseCursor)(IN OUT PFRONTEND This,
91  HMENU (NTAPI *MenuControl)(IN OUT PFRONTEND This,
93  UINT CmdIdHigh);
94  BOOL (NTAPI *SetMenuClose)(IN OUT PFRONTEND This,
97 
98 struct _FRONTEND
99 {
100  PFRONTEND_VTBL Vtbl; /* Virtual table */
101  NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
102 
103  struct _CONSRV_CONSOLE* Console; /* Console to which the frontend is attached to */
104  PVOID Context; /* Private context */
105  PVOID Context2; /* Private context */
106 };
107 
108 /* PauseFlags values (internal only) */
109 #define PAUSED_FROM_KEYBOARD 0x1
110 #define PAUSED_FROM_SCROLLBAR 0x2
111 #define PAUSED_FROM_SELECTION 0x4
112 
113 typedef struct _CONSRV_CONSOLE
114 {
115 /******************************* Console Set-up *******************************/
116  /* This **MUST** be FIRST!! */
118  // CONSOLE Console;
119  // // PCONSOLE Console;
120 
121  // 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 */
122  // CRITICAL_SECTION Lock;
123  // CONSOLE_STATE State; /* State of the console */
124 
125  // ULONG ConsoleID; /* The ID of the console */
126  // LIST_ENTRY ListEntry; /* Entry in the list of consoles */
127 
128  HANDLE InitEvents[MAX_INIT_EVENTS]; /* Initialization events */
129 
130  FRONTEND FrontEndIFace; /* Frontend-specific interface */
131 
132 /******************************* Process support ******************************/
133  LIST_ENTRY ProcessList; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */
134  PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess; /* Pointer to the unique process that needs to be notified when the console leader process is killed */
135  BOOLEAN NotifyLastClose; /* TRUE if the console should send a control event when the console leader process is killed */
136  BOOLEAN HasFocus; /* TRUE if the console has focus (is in the foreground) */
137 
138 /******************************* Pausing support ******************************/
140  LIST_ENTRY ReadWaitQueue; /* List head for the queue of unique input buffer read wait blocks */
141  LIST_ENTRY WriteWaitQueue; /* List head for the queue of current screen-buffer write wait blocks */
142 
143 /**************************** Aliases and Histories ***************************/
146  ULONG NumberOfHistoryBuffers; /* Number of history buffers */
147  ULONG MaxNumberOfHistoryBuffers; /* Maximum number of history buffers allowed */
148  ULONG HistoryBufferSize; /* Size for newly created history buffers */
149  BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */
150 
151 /**************************** Input Line Discipline ***************************/
152  PWCHAR LineBuffer; /* Current line being input, in line buffered mode */
153  ULONG LineMaxSize; /* Maximum size of line in characters (including CR+LF) */
154  ULONG LineSize; /* Current size of line */
155  ULONG LinePos; /* Current position within line */
156  BOOLEAN LineComplete; /* User pressed enter, ready to send back to client */
158  BOOLEAN LineInsertToggle; /* Replace character over cursor instead of inserting */
159  ULONG LineWakeupMask; /* Bitmap of which control characters will end line input */
160 
163 
164 /************************ Virtual DOS Machine support *************************/
165  COORD VDMBufferSize; /* Real size of the VDM buffer, in units of ??? */
166  HANDLE VDMBufferSection; /* Handle to the memory shared section for the VDM buffer */
167  PVOID VDMBuffer; /* Our VDM buffer */
168  PVOID ClientVDMBuffer; /* A copy of the client view of our VDM buffer */
169  HANDLE VDMClientProcess; /* Handle to the client process who opened the buffer, to unmap the view */
170 
174 
175 /****************************** Other properties ******************************/
176  LIST_ENTRY PopupWindows; /* List of popup windows */
177  UNICODE_STRING OriginalTitle; /* Original title of console, the one defined when the console leader is launched; it never changes. Always NULL-terminated */
178  UNICODE_STRING Title; /* Title of console. Always NULL-terminated */
179  COLORREF Colors[16]; /* Colour palette */
180 
182 
183 /* console.c */
186 
189 NTSTATUS
191  IN PCONSOLE_PROCESS_DATA ProcessData);
192 
195  IN ULONG ProcessGroupId,
196  IN ULONG CtrlEvent);
197 VOID
199  IN BOOLEAN SetForeground);
202  IN BOOLEAN SetForeground);
203 
204 /* coninput.c */
207  DWORD Scale);
208 
209 NTSTATUS
211  PINPUT_RECORD InputEvent);
212 
213 /* conoutput.c */
215 
216 /* terminal.c */
218 
219 /* EOF */
BOOLEAN HistoryNoDup
Definition: conio_winsrv.h:149
#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:140
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:172
HPALETTE UINT PaletteUsage
Definition: conio_winsrv.h:80
struct _CHAR_CELL CHAR_CELL
HCURSOR CursorHandle
Definition: conio_winsrv.h:90
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:130
PVOID Context2
Definition: conio_winsrv.h:105
struct _CONSRV_CONSOLE * Console
Definition: conio_winsrv.h:103
IN struct _CONSRV_CONSOLE * Console
Definition: conio_winsrv.h:40
BYTE Attributes
Definition: svga.h:393
struct _FRONTEND_VTBL FRONTEND_VTBL
UNICODE_STRING Title
Definition: conio_winsrv.h:178
BOOLEAN LineInsertToggle
Definition: conio_winsrv.h:158
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:169
HANDLE VDMBufferSection
Definition: conio_winsrv.h:166
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:104
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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LIST_ENTRY WriteWaitQueue
Definition: conio_winsrv.h:141
HANDLE StartHardwareEvent
Definition: conio_winsrv.h:171
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:1673
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID ConioDrawConsole(PCONSRV_CONSOLE Console)
Definition: terminal.c:860
PFRONTEND_VTBL Vtbl
Definition: conio_winsrv.h:100
ULONG MaxNumberOfHistoryBuffers
Definition: conio_winsrv.h:147
BOOLEAN LineUpPressed
Definition: conio_winsrv.h:157
BOOLEAN NotifyLastClose
Definition: conio_winsrv.h:135
ULONG HistoryBufferSize
Definition: conio_winsrv.h:148
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:161
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
ULONG(NTAPI *GetDisplayMode)(IN OUT PFRONTEND This)
UNICODE_STRING OriginalTitle
Definition: conio_winsrv.h:177
Definition: bl.h:1337
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:176
static VOID SetActiveScreenBuffer(HANDLE ScreenBuffer)
Definition: video.c:439
ULONG NumberOfHistoryBuffers
Definition: conio_winsrv.h:146
HPALETTE PaletteHandle
Definition: conio_winsrv.h:80
UINT UINT CmdIdHigh
Definition: conio_winsrv.h:92
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:156
#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:128
LIST_ENTRY HistoryBuffers
Definition: conio_winsrv.h:145
struct _ALIAS_HEADER * Aliases
Definition: conio_winsrv.h:144
PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess
Definition: conio_winsrv.h:134
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:133
HANDLE ErrorHardwareEvent
Definition: conio_winsrv.h:173
static VOID DrawRegion(PGUI_CONSOLE_DATA GuiData, SMALL_RECT *Region)
Definition: guiterm.c:76