2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: consrv/include/conio_winsrv.h
5 * PURPOSE: Public Console I/O Interface
6 * PROGRAMMERS: Gé van Geldorp
8 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
15 // This is ALMOST a HACK!!!!!!!
16 // Helpers for code refactoring
17 #ifdef USE_NEW_CONSOLE_WAY
19 #define _CONSRV_CONSOLE _WINSRV_CONSOLE
20 #define CONSRV_CONSOLE WINSRV_CONSOLE
21 #define PCONSRV_CONSOLE PWINSRV_CONSOLE
25 #define _CONSRV_CONSOLE _CONSOLE
26 #define CONSRV_CONSOLE CONSOLE
27 #define PCONSRV_CONSOLE PCONSOLE
31 #define CSR_DEFAULT_CURSOR_SIZE 25
33 /* VGA character cell */
34 typedef struct _CHAR_CELL
38 } CHAR_CELL
, *PCHAR_CELL
;
39 C_ASSERT(sizeof(CHAR_CELL
) == 2);
42 struct _WINSRV_CONSOLE
;
43 /* HACK: */ typedef struct _WINSRV_CONSOLE
*PWINSRV_CONSOLE
;
44 #ifdef USE_NEW_CONSOLE_WAY
48 typedef struct _FRONTEND FRONTEND
, *PFRONTEND
;
49 /* HACK: */ typedef struct _CONSOLE_INFO
*PCONSOLE_INFO
;
50 typedef struct _FRONTEND_VTBL
52 // NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
55 * Internal interface (functions called by the console server only)
57 NTSTATUS (NTAPI
*InitFrontEnd
)(IN OUT PFRONTEND This
,
58 IN
struct _CONSRV_CONSOLE
* Console
);
59 VOID (NTAPI
*DeinitFrontEnd
)(IN OUT PFRONTEND This
);
61 /* Interface used for both text-mode and graphics screen buffers */
62 VOID (NTAPI
*DrawRegion
)(IN OUT PFRONTEND This
,
64 /* Interface used only for text-mode screen buffers */
65 VOID (NTAPI
*WriteStream
)(IN OUT PFRONTEND This
,
72 VOID (NTAPI
*RingBell
)(IN OUT PFRONTEND This
);
73 BOOL (NTAPI
*SetCursorInfo
)(IN OUT PFRONTEND This
,
74 PCONSOLE_SCREEN_BUFFER ScreenBuffer
);
75 BOOL (NTAPI
*SetScreenInfo
)(IN OUT PFRONTEND This
,
76 PCONSOLE_SCREEN_BUFFER ScreenBuffer
,
79 VOID (NTAPI
*ResizeTerminal
)(IN OUT PFRONTEND This
);
80 VOID (NTAPI
*SetActiveScreenBuffer
)(IN OUT PFRONTEND This
);
81 VOID (NTAPI
*ReleaseScreenBuffer
)(IN OUT PFRONTEND This
,
82 IN PCONSOLE_SCREEN_BUFFER ScreenBuffer
);
83 VOID (NTAPI
*RefreshInternalInfo
)(IN OUT PFRONTEND This
);
86 * External interface (functions corresponding to the Console API)
88 VOID (NTAPI
*ChangeTitle
)(IN OUT PFRONTEND This
);
89 BOOL (NTAPI
*ChangeIcon
)(IN OUT PFRONTEND This
,
91 HWND (NTAPI
*GetConsoleWindowHandle
)(IN OUT PFRONTEND This
);
92 VOID (NTAPI
*GetLargestConsoleWindowSize
)(IN OUT PFRONTEND This
,
94 BOOL (NTAPI
*GetSelectionInfo
)(IN OUT PFRONTEND This
,
95 PCONSOLE_SELECTION_INFO pSelectionInfo
);
96 BOOL (NTAPI
*SetPalette
)(IN OUT PFRONTEND This
,
97 HPALETTE PaletteHandle
,
99 ULONG (NTAPI
*GetDisplayMode
)(IN OUT PFRONTEND This
);
100 BOOL (NTAPI
*SetDisplayMode
)(IN OUT PFRONTEND This
,
102 INT (NTAPI
*ShowMouseCursor
)(IN OUT PFRONTEND This
,
104 BOOL (NTAPI
*SetMouseCursor
)(IN OUT PFRONTEND This
,
105 HCURSOR CursorHandle
);
106 HMENU (NTAPI
*MenuControl
)(IN OUT PFRONTEND This
,
109 BOOL (NTAPI
*SetMenuClose
)(IN OUT PFRONTEND This
,
111 } FRONTEND_VTBL
, *PFRONTEND_VTBL
;
115 PFRONTEND_VTBL Vtbl
; /* Virtual table */
116 NTSTATUS (NTAPI
*UnloadFrontEnd
)(IN OUT PFRONTEND This
);
118 struct _CONSRV_CONSOLE
* Console
; /* Console to which the frontend is attached to */
119 PVOID Data
; /* Private data */
120 PVOID OldData
; /* Reserved */
123 /* PauseFlags values (internal only) */
124 #define PAUSED_FROM_KEYBOARD 0x1
125 #define PAUSED_FROM_SCROLLBAR 0x2
126 #define PAUSED_FROM_SELECTION 0x4
128 typedef struct _WINSRV_CONSOLE
130 /******************************* Console Set-up *******************************/
131 /* This **MUST** be FIRST!! */
132 #ifdef USE_NEW_CONSOLE_WAY
135 // // PCONSOLE Console;
138 // 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 */
139 // CRITICAL_SECTION Lock;
140 // CONSOLE_STATE State; /* State of the console */
142 FRONTEND FrontEndIFace
; /* Frontend-specific interface */
144 /******************************* Process support ******************************/
145 LIST_ENTRY ProcessList
; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */
146 PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess
; /* Pointer to the unique process that needs to be notified when the console leader process is killed */
147 BOOLEAN NotifyLastClose
; /* TRUE if the console should send a control event when the console leader process is killed */
149 /******************************* Pausing support ******************************/
151 LIST_ENTRY ReadWaitQueue
; /* List head for the queue of unique input buffer read wait blocks */
152 LIST_ENTRY WriteWaitQueue
; /* List head for the queue of current screen-buffer write wait blocks */
154 /**************************** Aliases and Histories ***************************/
155 struct _ALIAS_HEADER
*Aliases
;
156 LIST_ENTRY HistoryBuffers
;
157 ULONG HistoryBufferSize
; /* Size for newly created history buffers */
158 ULONG NumberOfHistoryBuffers
; /* Maximum number of history buffers allowed */
159 BOOLEAN HistoryNoDup
; /* Remove old duplicate history entries */
161 /**************************** Input Line Discipline ***************************/
162 PWCHAR LineBuffer
; /* Current line being input, in line buffered mode */
163 ULONG LineMaxSize
; /* Maximum size of line in characters (including CR+LF) */
164 ULONG LineSize
; /* Current size of line */
165 ULONG LinePos
; /* Current position within line */
166 BOOLEAN LineComplete
; /* User pressed enter, ready to send back to client */
167 BOOLEAN LineUpPressed
;
168 BOOLEAN LineInsertToggle
; /* Replace character over cursor instead of inserting */
169 ULONG LineWakeupMask
; /* Bitmap of which control characters will end line input */
174 /************************ Virtual DOS Machine support *************************/
175 COORD VDMBufferSize
; /* Real size of the VDM buffer, in units of ??? */
176 HANDLE VDMBufferSection
; /* Handle to the memory shared section for the VDM buffer */
177 PVOID VDMBuffer
; /* Our VDM buffer */
178 PVOID ClientVDMBuffer
; /* A copy of the client view of our VDM buffer */
179 HANDLE VDMClientProcess
; /* Handle to the client process who opened the buffer, to unmap the view */
181 HANDLE StartHardwareEvent
;
182 HANDLE EndHardwareEvent
;
183 HANDLE ErrorHardwareEvent
;
185 /****************************** Other properties ******************************/
186 LIST_ENTRY PopupWindows
; /*List of popup windows */
187 COLORREF Colors
[16]; /* Colour palette */
189 } WINSRV_CONSOLE
; // , *PWINSRV_CONSOLE;
192 VOID
ConioPause(PCONSRV_CONSOLE Console
, UINT Flags
);
193 VOID
ConioUnpause(PCONSRV_CONSOLE Console
, UINT Flags
);
195 PCONSOLE_PROCESS_DATA NTAPI
196 ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console
);
198 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent
,
199 IN PCONSOLE_PROCESS_DATA ProcessData
);
201 ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console
,
202 IN ULONG ProcessGroupId
,
206 VOID NTAPI
ConioProcessKey(PCONSRV_CONSOLE Console
, MSG
* msg
);
207 DWORD
ConioEffectiveCursorSize(PCONSRV_CONSOLE Console
,
211 ConioProcessInputEvent(PCONSRV_CONSOLE Console
,
212 PINPUT_RECORD InputEvent
);
215 PCHAR_INFO
ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff
, ULONG X
, ULONG Y
);
216 VOID
ConioDrawConsole(PCONSOLE
/*PCONSRV_CONSOLE*/ Console
);
217 NTSTATUS
ConioResizeBuffer(PCONSOLE
/*PCONSRV_CONSOLE*/ Console
,
218 PTEXTMODE_SCREEN_BUFFER ScreenBuffer
,