[CONSRV]: Use an optional parameter for passing things to the "line discipline" funct...
[reactos.git] / win32ss / user / winsrv / consrv / condrv / dummyterm.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: condrv/dummyterm.c
5 * PURPOSE: Dummy Terminal used when no terminal
6 * is attached to the specified console.
7 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10 /* INCLUDES *******************************************************************/
11
12 #include <consrv.h>
13
14 /* DUMMY TERMINAL INTERFACE ***************************************************/
15
16 static NTSTATUS NTAPI
17 DummyInitTerminal(IN OUT PTERMINAL This,
18 IN PCONSOLE Console)
19 {
20 return STATUS_SUCCESS;
21 }
22
23 static VOID NTAPI
24 DummyDeinitTerminal(IN OUT PTERMINAL This)
25 {
26 }
27
28
29
30 /************ Line discipline ***************/
31
32 static NTSTATUS NTAPI
33 DummyReadStream(IN OUT PTERMINAL This,
34 IN BOOLEAN Unicode,
35 /**PWCHAR Buffer,**/
36 OUT PVOID Buffer,
37 IN OUT PCONSOLE_READCONSOLE_CONTROL ReadControl,
38 IN PVOID Parameter OPTIONAL,
39 IN ULONG NumCharsToRead,
40 OUT PULONG NumCharsRead OPTIONAL)
41 {
42 /*
43 * We were called because the console was in cooked mode.
44 * There is nothing to read, wait until a real terminal
45 * is plugged into the console.
46 */
47 return STATUS_PENDING;
48 }
49
50 static NTSTATUS NTAPI
51 DummyWriteStream(IN OUT PTERMINAL This,
52 PTEXTMODE_SCREEN_BUFFER Buff,
53 PWCHAR Buffer,
54 DWORD Length,
55 BOOL Attrib)
56 {
57 /*
58 * We were called because the console was in cooked mode.
59 * There is nothing to write, wait until a real terminal
60 * is plugged into the console.
61 */
62
63 // /* Stop here if the console is paused */
64 // if (Console->UnpauseEvent != NULL) return STATUS_PENDING;
65
66 return STATUS_PENDING;
67 }
68
69 /************ Line discipline ***************/
70
71
72
73 static VOID NTAPI
74 DummyDrawRegion(IN OUT PTERMINAL This,
75 SMALL_RECT* Region)
76 {
77 }
78
79 static BOOL NTAPI
80 DummySetCursorInfo(IN OUT PTERMINAL This,
81 PCONSOLE_SCREEN_BUFFER ScreenBuffer)
82 {
83 return TRUE;
84 }
85
86 static BOOL NTAPI
87 DummySetScreenInfo(IN OUT PTERMINAL This,
88 PCONSOLE_SCREEN_BUFFER ScreenBuffer,
89 SHORT OldCursorX,
90 SHORT OldCursorY)
91 {
92 return TRUE;
93 }
94
95 static VOID NTAPI
96 DummyResizeTerminal(IN OUT PTERMINAL This)
97 {
98 }
99
100 static VOID NTAPI
101 DummySetActiveScreenBuffer(IN OUT PTERMINAL This)
102 {
103 }
104
105 static VOID NTAPI
106 DummyReleaseScreenBuffer(IN OUT PTERMINAL This,
107 IN PCONSOLE_SCREEN_BUFFER ScreenBuffer)
108 {
109 }
110
111 static VOID NTAPI
112 DummyGetLargestConsoleWindowSize(IN OUT PTERMINAL This,
113 PCOORD pSize)
114 {
115 }
116
117 static BOOL NTAPI
118 DummySetPalette(IN OUT PTERMINAL This,
119 HPALETTE PaletteHandle,
120 UINT PaletteUsage)
121 {
122 return TRUE;
123 }
124
125 static INT NTAPI
126 DummyShowMouseCursor(IN OUT PTERMINAL This,
127 BOOL Show)
128 {
129 return 0;
130 }
131
132 static TERMINAL_VTBL DummyVtbl =
133 {
134 DummyInitTerminal,
135 DummyDeinitTerminal,
136
137 DummyReadStream,
138 DummyWriteStream,
139
140 DummyDrawRegion,
141 DummySetCursorInfo,
142 DummySetScreenInfo,
143 DummyResizeTerminal,
144 DummySetActiveScreenBuffer,
145 DummyReleaseScreenBuffer,
146 DummyGetLargestConsoleWindowSize,
147 DummySetPalette,
148 DummyShowMouseCursor,
149 };
150
151 VOID
152 ResetTerminal(IN PCONSOLE Console)
153 {
154 if (!Console) return;
155
156 /* Reinitialize the terminal interface */
157 RtlZeroMemory(&Console->TermIFace, sizeof(Console->TermIFace));
158 Console->TermIFace.Vtbl = &DummyVtbl;
159 }
160
161 /* EOF */