ReactOS 0.4.15-dev-5858-g16decc6
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 */
19typedef struct _CHAR_CELL
20{
21 CHAR Char;
24C_ASSERT(sizeof(CHAR_CELL) == 2);
25
26// #include "conio.h"
27
28typedef struct _FRONTEND FRONTEND, *PFRONTEND;
29
30struct _CONSRV_CONSOLE;
31
32typedef 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,
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,
94 BOOL (NTAPI *SetMenuClose)(IN OUT PFRONTEND This,
97
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
113typedef 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
191 IN PCONSOLE_PROCESS_DATA ProcessData);
192
195 IN ULONG ProcessGroupId,
196 IN ULONG CtrlEvent);
197VOID
199 IN BOOLEAN SetForeground);
202 IN BOOLEAN SetForeground);
203
204/* coninput.c */
207 DWORD Scale);
208
211 PINPUT_RECORD InputEvent);
212
213/* conoutput.c */
215
216/* terminal.c */
218
219/* EOF */
unsigned char BOOLEAN
CConsole Console
Colors
Definition: ansiprsr.h:4
#define msg(x)
Definition: auth_time.c:54
LONG NTSTATUS
Definition: precomp.h:26
VOID ConioUnpause(PCONSRV_CONSOLE Console, UCHAR Flags)
Definition: console.c:866
struct _CONSRV_CONSOLE * PCONSRV_CONSOLE
NTSTATUS NTAPI ConSrvSetConsoleProcessFocus(IN PCONSRV_CONSOLE Console, IN BOOLEAN SetForeground)
Definition: console.c:1453
struct _FRONTEND_VTBL * PFRONTEND_VTBL
VOID ConSrvSetProcessFocus(IN PCSR_PROCESS CsrProcess, IN BOOLEAN SetForeground)
Definition: console.c:1440
struct _CONSRV_CONSOLE CONSRV_CONSOLE
NTSTATUS ConioProcessInputEvent(PCONSRV_CONSOLE Console, PINPUT_RECORD InputEvent)
Definition: coninput.c:201
VOID ConioDrawConsole(PCONSRV_CONSOLE Console)
Definition: terminal.c:860
PCONSOLE_PROCESS_DATA NTAPI ConSrvGetConsoleLeaderProcess(IN PCONSRV_CONSOLE Console)
Definition: console.c:1363
VOID NTAPI ConioProcessKey(PCONSRV_CONSOLE Console, MSG *msg)
Definition: input.c:60
struct _FRONTEND_VTBL FRONTEND_VTBL
DWORD ConioEffectiveCursorSize(PCONSRV_CONSOLE Console, DWORD Scale)
Definition: input.c:182
NTSTATUS NTAPI ConSrvConsoleProcessCtrlEvent(IN PCONSRV_CONSOLE Console, IN ULONG ProcessGroupId, IN ULONG CtrlEvent)
Definition: console.c:1402
VOID ConioPause(PCONSRV_CONSOLE Console, UCHAR Flags)
Definition: console.c:859
NTSTATUS ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent, IN PCONSOLE_PROCESS_DATA ProcessData)
Definition: console.c:1356
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y)
Definition: text.c:143
struct _CHAR_CELL CHAR_CELL
struct _CHAR_CELL * PCHAR_CELL
struct _FRONTEND * PFRONTEND
Definition: conio_winsrv.h:28
@ MAX_INIT_EVENTS
Definition: conmsg.h:165
#define Y(I)
COORD WINAPI DECLSPEC_HOTPATCH GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
Definition: console.c:1673
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID DrawRegion(PGUI_CONSOLE_DATA GuiData, SMALL_RECT *Region)
Definition: guiterm.c:76
#define C_ASSERT(e)
Definition: intsafe.h:73
static HICON
Definition: imagelist.c:84
unsigned int UINT
Definition: ndis.h:50
short SHORT
Definition: pedump.c:59
BYTE Attributes
Definition: svga.h:393
CHAR Char
Definition: svga.h:392
BOOLEAN NotifyLastClose
Definition: conio_winsrv.h:135
BOOLEAN HistoryNoDup
Definition: conio_winsrv.h:149
ULONG MaxNumberOfHistoryBuffers
Definition: conio_winsrv.h:147
LIST_ENTRY HistoryBuffers
Definition: conio_winsrv.h:145
HANDLE EndHardwareEvent
Definition: conio_winsrv.h:172
BOOLEAN LineComplete
Definition: conio_winsrv.h:156
HANDLE InitEvents[MAX_INIT_EVENTS]
Definition: conio_winsrv.h:128
struct _ALIAS_HEADER * Aliases
Definition: conio_winsrv.h:144
UNICODE_STRING Title
Definition: conio_winsrv.h:178
HANDLE ErrorHardwareEvent
Definition: conio_winsrv.h:173
UNICODE_STRING OriginalTitle
Definition: conio_winsrv.h:177
HANDLE VDMBufferSection
Definition: conio_winsrv.h:166
FRONTEND FrontEndIFace
Definition: conio_winsrv.h:130
BOOLEAN LineUpPressed
Definition: conio_winsrv.h:157
LIST_ENTRY ReadWaitQueue
Definition: conio_winsrv.h:140
BOOLEAN InsertMode
Definition: conio_winsrv.h:161
ULONG NumberOfHistoryBuffers
Definition: conio_winsrv.h:146
LIST_ENTRY WriteWaitQueue
Definition: conio_winsrv.h:141
ULONG HistoryBufferSize
Definition: conio_winsrv.h:148
HANDLE StartHardwareEvent
Definition: conio_winsrv.h:171
HANDLE VDMClientProcess
Definition: conio_winsrv.h:169
BOOLEAN LineInsertToggle
Definition: conio_winsrv.h:158
PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess
Definition: conio_winsrv.h:134
LIST_ENTRY PopupWindows
Definition: conio_winsrv.h:176
LIST_ENTRY ProcessList
Definition: conio_winsrv.h:133
Definition: bl.h:1338
VOID(NTAPI *RefreshInternalInfo)(IN OUT PFRONTEND This)
VOID(NTAPI *RingBell)(IN OUT PFRONTEND This)
PCONSOLE_SCREEN_BUFFER SHORT OldCursorX
Definition: conio_winsrv.h:59
PCONSOLE_SCREEN_BUFFER ScreenBuffer
Definition: conio_winsrv.h:56
HDESK(NTAPI *GetThreadConsoleDesktop)(IN OUT PFRONTEND This)
VOID(NTAPI *DeinitFrontEnd)(IN OUT PFRONTEND This)
PCONSOLE_SCREEN_BUFFER SHORT SHORT OldCursorY
Definition: conio_winsrv.h:60
VOID(NTAPI *ResizeTerminal)(IN OUT PFRONTEND This)
ULONG(NTAPI *GetDisplayMode)(IN OUT PFRONTEND This)
BOOL(NTAPI *SetDisplayMode)(IN OUT PFRONTEND This
BOOL(NTAPI *SetCodePage)(IN OUT PFRONTEND This
SMALL_RECT SHORT SHORT UINT PWCHAR UINT Length
Definition: conio_winsrv.h:53
BOOL(NTAPI *SetScreenInfo)(IN OUT PFRONTEND This
SMALL_RECT SHORT SHORT UINT ScrolledLines
Definition: conio_winsrv.h:51
VOID(NTAPI *ChangeTitle)(IN OUT PFRONTEND This)
BOOL(NTAPI *SetMenuClose)(IN OUT PFRONTEND This
SMALL_RECT * Region
Definition: conio_winsrv.h:45
HMENU(NTAPI *MenuControl)(IN OUT PFRONTEND This
HPALETTE PaletteHandle
Definition: conio_winsrv.h:80
VOID(NTAPI *WriteStream)(IN OUT PFRONTEND This
BOOL(NTAPI *SetMouseCursor)(IN OUT PFRONTEND This
IN PCONSOLE_SCREEN_BUFFER ScreenBuffer
Definition: conio_winsrv.h:64
UINT UINT CmdIdHigh
Definition: conio_winsrv.h:93
IN struct _CONSRV_CONSOLE * Console
Definition: conio_winsrv.h:40
VOID(NTAPI *GetLargestConsoleWindowSize)(IN OUT PFRONTEND This
VOID(NTAPI *ReleaseScreenBuffer)(IN OUT PFRONTEND This
VOID(NTAPI *DrawRegion)(IN OUT PFRONTEND This
SMALL_RECT SHORT SHORT CursorStartY
Definition: conio_winsrv.h:50
BOOL(NTAPI *GetSelectionInfo)(IN OUT PFRONTEND This
VOID(NTAPI *SetActiveScreenBuffer)(IN OUT PFRONTEND This)
INT(NTAPI *ShowMouseCursor)(IN OUT PFRONTEND This
BOOL(NTAPI *ChangeIcon)(IN OUT PFRONTEND This
SMALL_RECT SHORT SHORT UINT PWCHAR Buffer
Definition: conio_winsrv.h:52
BOOL(NTAPI *SetCursorInfo)(IN OUT PFRONTEND This
NTSTATUS(NTAPI *InitFrontEnd)(IN OUT PFRONTEND This
HCURSOR CursorHandle
Definition: conio_winsrv.h:90
BOOL(NTAPI *SetPalette)(IN OUT PFRONTEND This
HPALETTE UINT PaletteUsage
Definition: conio_winsrv.h:81
HWND(NTAPI *GetConsoleWindowHandle)(IN OUT PFRONTEND This)
SMALL_RECT SHORT CursorStartX
Definition: conio_winsrv.h:49
PCONSOLE_SELECTION_INFO pSelectionInfo
Definition: conio_winsrv.h:78
PFRONTEND_VTBL Vtbl
Definition: conio_winsrv.h:100
struct _CONSRV_CONSOLE * Console
Definition: conio_winsrv.h:103
PVOID Context2
Definition: conio_winsrv.h:105
PVOID Context
Definition: conio_winsrv.h:104
NTSTATUS(NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This)
Definition: typedefs.h:120
static VOID SetActiveScreenBuffer(HANDLE ScreenBuffer)
Definition: video.c:439
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
PKPROCESS CsrProcess
Definition: videoprt.c:39
NTSTATUS NTAPI GetThreadConsoleDesktop(IN ULONG_PTR ThreadId, OUT HDESK *ConsoleDesktop)
Definition: frontendctl.c:265
DWORD COLORREF
Definition: windef.h:300
HICON HCURSOR
Definition: windef.h:299
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193