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 #define CSR_DEFAULT_CURSOR_SIZE 25
17 typedef struct _FRONTEND FRONTEND
, *PFRONTEND
;
18 /* HACK: */ typedef struct _CONSOLE_INFO
*PCONSOLE_INFO
;
19 typedef struct _FRONTEND_VTBL
21 // NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
24 * Internal interface (functions called by the console server only)
26 NTSTATUS (NTAPI
*InitFrontEnd
)(IN OUT PFRONTEND This
,
27 IN
struct _CONSOLE
* Console
);
28 VOID (NTAPI
*DeinitFrontEnd
)(IN OUT PFRONTEND This
);
30 /* Interface used for both text-mode and graphics screen buffers */
31 VOID (NTAPI
*DrawRegion
)(IN OUT PFRONTEND This
,
33 /* Interface used only for text-mode screen buffers */
34 VOID (NTAPI
*WriteStream
)(IN OUT PFRONTEND This
,
41 BOOL (NTAPI
*SetCursorInfo
)(IN OUT PFRONTEND This
,
42 PCONSOLE_SCREEN_BUFFER ScreenBuffer
);
43 BOOL (NTAPI
*SetScreenInfo
)(IN OUT PFRONTEND This
,
44 PCONSOLE_SCREEN_BUFFER ScreenBuffer
,
47 VOID (NTAPI
*ResizeTerminal
)(IN OUT PFRONTEND This
);
48 VOID (NTAPI
*SetActiveScreenBuffer
)(IN OUT PFRONTEND This
);
49 VOID (NTAPI
*ReleaseScreenBuffer
)(IN OUT PFRONTEND This
,
50 IN PCONSOLE_SCREEN_BUFFER ScreenBuffer
);
51 VOID (NTAPI
*RefreshInternalInfo
)(IN OUT PFRONTEND This
);
54 * External interface (functions corresponding to the Console API)
56 VOID (NTAPI
*ChangeTitle
)(IN OUT PFRONTEND This
);
57 BOOL (NTAPI
*ChangeIcon
)(IN OUT PFRONTEND This
,
59 HWND (NTAPI
*GetConsoleWindowHandle
)(IN OUT PFRONTEND This
);
60 VOID (NTAPI
*GetLargestConsoleWindowSize
)(IN OUT PFRONTEND This
,
62 BOOL (NTAPI
*GetSelectionInfo
)(IN OUT PFRONTEND This
,
63 PCONSOLE_SELECTION_INFO pSelectionInfo
);
64 BOOL (NTAPI
*SetPalette
)(IN OUT PFRONTEND This
,
65 HPALETTE PaletteHandle
,
67 ULONG (NTAPI
*GetDisplayMode
)(IN OUT PFRONTEND This
);
68 BOOL (NTAPI
*SetDisplayMode
)(IN OUT PFRONTEND This
,
70 INT (NTAPI
*ShowMouseCursor
)(IN OUT PFRONTEND This
,
72 BOOL (NTAPI
*SetMouseCursor
)(IN OUT PFRONTEND This
,
73 HCURSOR CursorHandle
);
74 HMENU (NTAPI
*MenuControl
)(IN OUT PFRONTEND This
,
77 BOOL (NTAPI
*SetMenuClose
)(IN OUT PFRONTEND This
,
79 } FRONTEND_VTBL
, *PFRONTEND_VTBL
;
83 PFRONTEND_VTBL Vtbl
; /* Virtual table */
84 NTSTATUS (NTAPI
*UnloadFrontEnd
)(IN OUT PFRONTEND This
);
86 struct _CONSOLE
* Console
; /* Console to which the frontend is attached to */
87 PVOID Data
; /* Private data */
88 PVOID OldData
; /* Reserved */
91 /* PauseFlags values (internal only) */
92 #define PAUSED_FROM_KEYBOARD 0x1
93 #define PAUSED_FROM_SCROLLBAR 0x2
94 #define PAUSED_FROM_SELECTION 0x4
96 typedef struct _WINSRV_CONSOLE
98 /******************************* Console Set-up *******************************/
99 /* This **MUST** be FIRST!! */
102 // 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 */
103 // CRITICAL_SECTION Lock;
104 // CONSOLE_STATE State; /* State of the console */
106 FRONTEND FrontEndIFace
; /* Frontend-specific interface */
108 /******************************* Process support ******************************/
109 LIST_ENTRY ProcessList
; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */
110 PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess
; /* Pointer to the unique process that needs to be notified when the console leader process is killed */
111 BOOLEAN NotifyLastClose
; /* TRUE if the console should send a control event when the console leader process is killed */
115 /******************************* Pausing support ******************************/
117 LIST_ENTRY ReadWaitQueue
; /* List head for the queue of unique input buffer read wait blocks */
118 LIST_ENTRY WriteWaitQueue
; /* List head for the queue of current screen-buffer write wait blocks */
120 /**************************** Aliases and Histories ***************************/
121 struct _ALIAS_HEADER
*Aliases
;
122 LIST_ENTRY HistoryBuffers
;
123 ULONG HistoryBufferSize
; /* Size for newly created history buffers */
124 ULONG NumberOfHistoryBuffers
; /* Maximum number of history buffers allowed */
125 BOOLEAN HistoryNoDup
; /* Remove old duplicate history entries */
127 } WINSRV_CONSOLE
, *PWINSRV_CONSOLE
;
130 VOID
ConioPause(PCONSOLE Console
, UINT Flags
);
131 VOID
ConioUnpause(PCONSOLE Console
, UINT Flags
);
133 PCONSOLE_PROCESS_DATA NTAPI
134 ConSrvGetConsoleLeaderProcess(IN PCONSOLE Console
);
136 ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent
,
137 IN PCONSOLE_PROCESS_DATA ProcessData
);
139 ConSrvConsoleProcessCtrlEvent(IN PCONSOLE Console
,
140 IN ULONG ProcessGroupId
,
144 VOID NTAPI
ConioProcessKey(PCONSOLE Console
, MSG
* msg
);
145 DWORD
ConioEffectiveCursorSize(PCONSOLE Console
,
149 ConioAddInputEvents(PCONSOLE Console
,
150 PINPUT_RECORD InputRecords
,
151 ULONG NumEventsToWrite
,
152 PULONG NumEventsWritten
,
153 BOOLEAN AppendToEnd
);
155 ConioProcessInputEvent(PCONSOLE Console
,
156 PINPUT_RECORD InputEvent
);
162 * "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
163 * If they are the same, the function fails, and GetLastError returns
164 * ERROR_INVALID_PARAMETER."
166 #define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \
167 ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
168 WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
170 #define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \
171 ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
172 MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
174 PCHAR_INFO
ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff
, ULONG X
, ULONG Y
);
175 VOID
ConioDrawConsole(PCONSOLE Console
);
176 NTSTATUS
ConioResizeBuffer(PCONSOLE Console
,
177 PTEXTMODE_SCREEN_BUFFER ScreenBuffer
,
179 NTSTATUS
ConioWriteConsole(PCONSOLE Console
,
180 PTEXTMODE_SCREEN_BUFFER Buff
,