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
9 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
16 // This is ALMOST a HACK!!!!!!!
17 // Helpers for code refactoring
18 #ifdef USE_NEW_CONSOLE_WAY
20 #define _CONSRV_CONSOLE _WINSRV_CONSOLE
21 #define CONSRV_CONSOLE WINSRV_CONSOLE
22 #define PCONSRV_CONSOLE PWINSRV_CONSOLE
26 #define _CONSRV_CONSOLE _CONSOLE
27 #define CONSRV_CONSOLE CONSOLE
28 #define PCONSRV_CONSOLE PCONSOLE
32 #define CSR_DEFAULT_CURSOR_SIZE 25
34 /* VGA character cell */
35 typedef struct _CHAR_CELL
39 } CHAR_CELL
, *PCHAR_CELL
;
40 C_ASSERT(sizeof(CHAR_CELL
) == 2);
43 struct _WINSRV_CONSOLE
;
44 /* HACK: */ typedef struct _WINSRV_CONSOLE
*PWINSRV_CONSOLE
;
45 #ifdef USE_NEW_CONSOLE_WAY
49 typedef struct _FRONTEND FRONTEND
, *PFRONTEND
;
51 typedef struct _FRONTEND_VTBL
53 // NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
56 * Internal interface (functions called by the console server only)
58 NTSTATUS (NTAPI
*InitFrontEnd
)(IN OUT PFRONTEND This
,
59 IN
struct _CONSRV_CONSOLE
* Console
);
60 VOID (NTAPI
*DeinitFrontEnd
)(IN OUT PFRONTEND This
);
62 /* Interface used for both text-mode and graphics screen buffers */
63 VOID (NTAPI
*DrawRegion
)(IN OUT PFRONTEND This
,
65 /* Interface used only for text-mode screen buffers */
66 VOID (NTAPI
*WriteStream
)(IN OUT PFRONTEND This
,
73 VOID (NTAPI
*RingBell
)(IN OUT PFRONTEND This
);
74 BOOL (NTAPI
*SetCursorInfo
)(IN OUT PFRONTEND This
,
75 PCONSOLE_SCREEN_BUFFER ScreenBuffer
);
76 BOOL (NTAPI
*SetScreenInfo
)(IN OUT PFRONTEND This
,
77 PCONSOLE_SCREEN_BUFFER ScreenBuffer
,
80 VOID (NTAPI
*ResizeTerminal
)(IN OUT PFRONTEND This
);
81 VOID (NTAPI
*SetActiveScreenBuffer
)(IN OUT PFRONTEND This
);
82 VOID (NTAPI
*ReleaseScreenBuffer
)(IN OUT PFRONTEND This
,
83 IN PCONSOLE_SCREEN_BUFFER ScreenBuffer
);
84 VOID (NTAPI
*RefreshInternalInfo
)(IN OUT PFRONTEND This
);
87 * External interface (functions corresponding to the Console API)
89 VOID (NTAPI
*ChangeTitle
)(IN OUT PFRONTEND This
);
90 BOOL (NTAPI
*ChangeIcon
)(IN OUT PFRONTEND This
,
92 HDESK (NTAPI
*GetThreadConsoleDesktop
)(IN OUT PFRONTEND This
);
93 HWND (NTAPI
*GetConsoleWindowHandle
)(IN OUT PFRONTEND This
);
94 VOID (NTAPI
*GetLargestConsoleWindowSize
)(IN OUT PFRONTEND This
,
96 BOOL (NTAPI
*GetSelectionInfo
)(IN OUT PFRONTEND This
,
97 PCONSOLE_SELECTION_INFO pSelectionInfo
);
98 BOOL (NTAPI
*SetPalette
)(IN OUT PFRONTEND This
,
99 HPALETTE PaletteHandle
,
101 ULONG (NTAPI
*GetDisplayMode
)(IN OUT PFRONTEND This
);
102 BOOL (NTAPI
*SetDisplayMode
)(IN OUT PFRONTEND This
,
104 INT (NTAPI
*ShowMouseCursor
)(IN OUT PFRONTEND This
,
106 BOOL (NTAPI
*SetMouseCursor
)(IN OUT PFRONTEND This
,
107 HCURSOR CursorHandle
);
108 HMENU (NTAPI
*MenuControl
)(IN OUT PFRONTEND This
,
111 BOOL (NTAPI
*SetMenuClose
)(IN OUT PFRONTEND This
,
113 } FRONTEND_VTBL
, *PFRONTEND_VTBL
;
117 PFRONTEND_VTBL Vtbl
; /* Virtual table */
118 NTSTATUS (NTAPI
*UnloadFrontEnd
)(IN OUT PFRONTEND This
);
120 struct _CONSRV_CONSOLE
* Console
; /* Console to which the frontend is attached to */
121 PVOID Context
; /* Private context */
122 PVOID Context2
; /* Private context */
125 /* PauseFlags values (internal only) */
126 #define PAUSED_FROM_KEYBOARD 0x1
127 #define PAUSED_FROM_SCROLLBAR 0x2
128 #define PAUSED_FROM_SELECTION 0x4
130 typedef struct _WINSRV_CONSOLE
132 /******************************* Console Set-up *******************************/
133 /* This **MUST** be FIRST!! */
134 #ifdef USE_NEW_CONSOLE_WAY
137 // // PCONSOLE Console;
140 // 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 */
141 // CRITICAL_SECTION Lock;
142 // CONSOLE_STATE State; /* State of the console */
144 HANDLE InitEvents
[MAX_INIT_EVENTS
]; /* Initialization events */
146 FRONTEND FrontEndIFace
; /* Frontend-specific interface */
148 /******************************* Process support ******************************/
149 LIST_ENTRY ProcessList
; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */
150 PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess
; /* Pointer to the unique process that needs to be notified when the console leader process is killed */
151 BOOLEAN NotifyLastClose
; /* TRUE if the console should send a control event when the console leader process is killed */
152 BOOLEAN HasFocus
; /* TRUE if the console has focus (is in the foreground) */
154 /******************************* Pausing support ******************************/
156 LIST_ENTRY ReadWaitQueue
; /* List head for the queue of unique input buffer read wait blocks */
157 LIST_ENTRY WriteWaitQueue
; /* List head for the queue of current screen-buffer write wait blocks */
159 /**************************** Aliases and Histories ***************************/
160 struct _ALIAS_HEADER
*Aliases
;
161 LIST_ENTRY HistoryBuffers
;
162 ULONG HistoryBufferSize
; /* Size for newly created history buffers */
163 ULONG NumberOfHistoryBuffers
; /* Maximum number of history buffers allowed */
164 BOOLEAN HistoryNoDup
; /* Remove old duplicate history entries */
166 /**************************** Input Line Discipline ***************************/
167 PWCHAR LineBuffer
; /* Current line being input, in line buffered mode */
168 ULONG LineMaxSize
; /* Maximum size of line in characters (including CR+LF) */
169 ULONG LineSize
; /* Current size of line */
170 ULONG LinePos
; /* Current position within line */
171 BOOLEAN LineComplete
; /* User pressed enter, ready to send back to client */
172 BOOLEAN LineUpPressed
;
173 BOOLEAN LineInsertToggle
; /* Replace character over cursor instead of inserting */
174 ULONG LineWakeupMask
; /* Bitmap of which control characters will end line input */
179 /************************ Virtual DOS Machine support *************************/
180 COORD VDMBufferSize
; /* Real size of the VDM buffer, in units of ??? */
181 HANDLE VDMBufferSection
; /* Handle to the memory shared section for the VDM buffer */
182 PVOID VDMBuffer
; /* Our VDM buffer */
183 PVOID ClientVDMBuffer
; /* A copy of the client view of our VDM buffer */
184 HANDLE VDMClientProcess
; /* Handle to the client process who opened the buffer, to unmap the view */
186 HANDLE StartHardwareEvent
;
187 HANDLE EndHardwareEvent
;
188 HANDLE ErrorHardwareEvent
;
190 /****************************** Other properties ******************************/
191 LIST_ENTRY PopupWindows
; /* List of popup windows */
192 UNICODE_STRING OriginalTitle
; /* Original title of console, the one defined when the console leader is launched; it never changes. Always NULL-terminated */
193 UNICODE_STRING Title
; /* Title of console. Always NULL-terminated */
194 COLORREF Colors
[16]; /* Colour palette */
196 } WINSRV_CONSOLE
; // , *PWINSRV_CONSOLE;
199 VOID
ConioPause(PCONSRV_CONSOLE Console
, UINT Flags
);
200 VOID
ConioUnpause(PCONSRV_CONSOLE Console
, UINT Flags
);
202 PCONSOLE_PROCESS_DATA NTAPI
203 ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console
);
205 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent
,
206 IN PCONSOLE_PROCESS_DATA ProcessData
);
208 ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console
,
209 IN ULONG ProcessGroupId
,
212 ConSrvSetProcessFocus(IN PCSR_PROCESS CsrProcess
,
213 IN BOOLEAN SetForeground
);
215 ConSrvSetConsoleProcessFocus(IN PCONSRV_CONSOLE Console
,
216 IN BOOLEAN SetForeground
);
219 VOID NTAPI
ConioProcessKey(PCONSRV_CONSOLE Console
, MSG
* msg
);
220 DWORD
ConioEffectiveCursorSize(PCONSRV_CONSOLE Console
,
224 ConioProcessInputEvent(PCONSRV_CONSOLE Console
,
225 PINPUT_RECORD InputEvent
);
228 PCHAR_INFO
ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff
, ULONG X
, ULONG Y
);
229 NTSTATUS
ConioResizeBuffer(PCONSOLE
/*PCONSRV_CONSOLE*/ Console
,
230 PTEXTMODE_SCREEN_BUFFER ScreenBuffer
,
234 VOID
ConioDrawConsole(PCONSRV_CONSOLE Console
);