- Silence TCPIP.
[reactos.git] / reactos / ntoskrnl / inbv / inbv.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/inbv/inbv.c
6 * PURPOSE: Boot video support
7 *
8 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
9 */
10
11 /* INCLUDES ******************************************************************/
12
13 #include <ntoskrnl.h>
14 #include "../../drivers/dd/bootvid/ntbootvid.h"
15 #define NDEBUG
16 #include <internal/debug.h>
17
18 #if defined (ALLOC_PRAGMA)
19 #pragma alloc_text(INIT, InbvEnableBootDriver)
20 #endif
21
22
23 /* GLOBALS *******************************************************************/
24
25 /* DATA **********************************************************************/
26
27 static HANDLE BootVidDevice = NULL;
28 static BOOL BootVidDriverInstalled = FALSE;
29 static NTBOOTVID_FUNCTION_TABLE BootVidFunctionTable;
30
31 /* FUNCTIONS *****************************************************************/
32
33 NTSTATUS
34 STATIC
35 InbvCheckBootVid(VOID)
36 {
37 IO_STATUS_BLOCK Iosb;
38
39 if (BootVidDevice == NULL)
40 {
41 NTSTATUS Status;
42 OBJECT_ATTRIBUTES ObjectAttributes;
43 UNICODE_STRING BootVidName = RTL_CONSTANT_STRING(L"\\Device\\BootVid");
44
45 InitializeObjectAttributes(&ObjectAttributes,
46 &BootVidName,
47 0,
48 NULL,
49 NULL);
50 Status = ZwOpenFile(&BootVidDevice,
51 FILE_ALL_ACCESS,
52 &ObjectAttributes,
53 &Iosb,
54 0,
55 0);
56 if (!NT_SUCCESS(Status))
57 {
58 return(Status);
59 }
60 }
61 return(STATUS_SUCCESS);
62 }
63
64
65 VOID
66 STDCALL
67 InbvAcquireDisplayOwnership(VOID)
68 {
69 }
70
71 BOOLEAN
72 STDCALL
73 InbvCheckDisplayOwnership(VOID)
74 {
75 return FALSE;
76 }
77
78 BOOLEAN
79 STDCALL
80 InbvDisplayString(IN PCHAR String)
81 {
82 /* Call Bootvid (we don't support bootvid for now)
83 * vidDisplayString(String);
84 * so instead, we'll fall-back to HAL
85 */
86 HalDisplayString(String);
87
88 /* Call Headless (We don't support headless for now)
89 HeadlessDispatch(DISPLAY_STRING);
90 */
91
92 /* Return success */
93 return TRUE;
94 }
95
96 BOOLEAN
97 STDCALL
98 InbvResetDisplayParameters(ULONG SizeX, ULONG SizeY)
99 {
100 return(InbvResetDisplay());
101 }
102
103
104 VOID
105 STDCALL INIT_FUNCTION
106 InbvEnableBootDriver(IN BOOLEAN Enable)
107 {
108 NTSTATUS Status;
109 IO_STATUS_BLOCK Iosb;
110
111 Status = InbvCheckBootVid();
112 if (!NT_SUCCESS(Status))
113 {
114 return;
115 }
116
117 if (Enable)
118 {
119 /* Notify the hal we will acquire the display. */
120 HalAcquireDisplayOwnership(InbvResetDisplayParameters);
121
122 Status = NtDeviceIoControlFile(BootVidDevice,
123 NULL,
124 NULL,
125 NULL,
126 &Iosb,
127 IOCTL_BOOTVID_INITIALIZE,
128 NULL,
129 0,
130 &BootVidFunctionTable,
131 sizeof(BootVidFunctionTable));
132 if (!NT_SUCCESS(Status))
133 {
134 KEBUGCHECK(0);
135 }
136 BootVidDriverInstalled = TRUE;
137 CHECKPOINT;
138 }
139 else
140 {
141 Status = NtDeviceIoControlFile(BootVidDevice,
142 NULL,
143 NULL,
144 NULL,
145 &Iosb,
146 IOCTL_BOOTVID_CLEANUP,
147 NULL,
148 0,
149 NULL,
150 0);
151 if (!NT_SUCCESS(Status))
152 {
153 KEBUGCHECK(0);
154 }
155 BootVidDriverInstalled = FALSE;
156 /* Notify the hal we have released the display. */
157 HalReleaseDisplayOwnership();
158
159 NtClose(BootVidDevice);
160 BootVidDevice = NULL;
161 }
162 }
163
164
165 BOOLEAN
166 STDCALL
167 InbvEnableDisplayString(IN BOOLEAN Enable)
168 {
169 return FALSE;
170 }
171
172
173 VOID
174 STDCALL
175 InbvInstallDisplayStringFilter(IN PVOID Unknown)
176 {
177 }
178
179
180 BOOLEAN
181 STDCALL
182 InbvIsBootDriverInstalled(VOID)
183 {
184 return(BootVidDriverInstalled);
185 }
186
187
188 VOID
189 STDCALL
190 InbvNotifyDisplayOwnershipLost(IN PVOID Callback)
191 {
192 }
193
194
195 BOOLEAN
196 STDCALL
197 InbvResetDisplay(VOID)
198 {
199 if (!BootVidDriverInstalled)
200 {
201 return(FALSE);
202 }
203 return(BootVidFunctionTable.ResetDisplay());
204 }
205
206
207 VOID
208 STDCALL
209 InbvSetScrollRegion(IN ULONG Left,
210 IN ULONG Top,
211 IN ULONG Width,
212 IN ULONG Height)
213 {
214 }
215
216
217 VOID
218 STDCALL
219 InbvSetTextColor(IN ULONG Color)
220 {
221 }
222
223
224 VOID
225 STDCALL
226 InbvSolidColorFill(IN ULONG Left,
227 IN ULONG Top,
228 IN ULONG Width,
229 IN ULONG Height,
230 IN ULONG Color)
231 {
232 }
233
234 NTSTATUS
235 STDCALL
236 NtDisplayString(IN PUNICODE_STRING DisplayString)
237 {
238 OEM_STRING OemString;
239
240 RtlUnicodeStringToOemString(&OemString, DisplayString, TRUE);
241 HalDisplayString(OemString.Buffer);
242 RtlFreeOemString(&OemString);
243
244 return STATUS_SUCCESS;
245 }