[CONSRV]
[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 PUNICODE_STRING ExeName /**/OPTIONAL/**/,/**/
35 IN BOOLEAN Unicode,
36 /**PWCHAR Buffer,**/
37 OUT PVOID Buffer,
38 IN OUT PCONSOLE_READCONSOLE_CONTROL ReadControl,
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 DummyChangeTitle(IN OUT PTERMINAL This)
113 {
114 }
115
116 static VOID NTAPI
117 DummyGetLargestConsoleWindowSize(IN OUT PTERMINAL This,
118 PCOORD pSize)
119 {
120 }
121
122 static BOOL NTAPI
123 DummySetPalette(IN OUT PTERMINAL This,
124 HPALETTE PaletteHandle,
125 UINT PaletteUsage)
126 {
127 return TRUE;
128 }
129
130 static INT NTAPI
131 DummyShowMouseCursor(IN OUT PTERMINAL This,
132 BOOL Show)
133 {
134 return 0;
135 }
136
137 static TERMINAL_VTBL DummyVtbl =
138 {
139 DummyInitTerminal,
140 DummyDeinitTerminal,
141
142 DummyReadStream,
143 DummyWriteStream,
144
145 DummyDrawRegion,
146 DummySetCursorInfo,
147 DummySetScreenInfo,
148 DummyResizeTerminal,
149 DummySetActiveScreenBuffer,
150 DummyReleaseScreenBuffer,
151 DummyChangeTitle,
152 DummyGetLargestConsoleWindowSize,
153 DummySetPalette,
154 DummyShowMouseCursor,
155 };
156
157 VOID
158 ResetTerminal(IN PCONSOLE Console)
159 {
160 if (!Console) return;
161
162 /* Reinitialize the terminal interface */
163 RtlZeroMemory(&Console->TermIFace, sizeof(Console->TermIFace));
164 Console->TermIFace.Vtbl = &DummyVtbl;
165 }
166
167 /* EOF */