3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/inbv/inbv.c
6 * PURPOSE: Boot video support
8 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
11 /* INCLUDES ******************************************************************/
14 #include <ntos/bootvid.h>
15 #include <ddk/ntbootvid.h>
17 #include <internal/debug.h>
20 /* GLOBALS *******************************************************************/
22 /* DATA **********************************************************************/
24 static HANDLE BootVidDevice
= NULL
;
25 static BOOL BootVidDriverInstalled
= FALSE
;
26 static NTBOOTVID_FUNCTION_TABLE BootVidFunctionTable
;
28 /* FUNCTIONS *****************************************************************/
32 InbvCheckBootVid(VOID
)
36 if (BootVidDevice
== NULL
)
39 OBJECT_ATTRIBUTES ObjectAttributes
;
40 UNICODE_STRING BootVidName
;
42 RtlRosInitUnicodeStringFromLiteral(&BootVidName
, L
"\\Device\\BootVid");
43 InitializeObjectAttributes(&ObjectAttributes
,
48 Status
= ZwOpenFile(&BootVidDevice
,
54 if (!NT_SUCCESS(Status
))
59 return(STATUS_SUCCESS
);
64 InbvAcquireDisplayOwnership(VOID
)
71 InbvCheckDisplayOwnership(VOID
)
79 InbvDisplayString(IN PCHAR String
)
86 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
88 return(InbvResetDisplay());
93 InbvEnableBootDriver(IN BOOLEAN Enable
)
98 Status
= InbvCheckBootVid();
99 if (!NT_SUCCESS(Status
))
106 /* Notify the hal we will acquire the display. */
107 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
109 Status
= NtDeviceIoControlFile(BootVidDevice
,
114 IOCTL_BOOTVID_INITIALIZE
,
117 &BootVidFunctionTable
,
118 sizeof(BootVidFunctionTable
));
119 if (!NT_SUCCESS(Status
))
123 BootVidDriverInstalled
= TRUE
;
128 Status
= NtDeviceIoControlFile(BootVidDevice
,
133 IOCTL_BOOTVID_CLEANUP
,
138 if (!NT_SUCCESS(Status
))
142 BootVidDriverInstalled
= FALSE
;
143 /* Notify the hal we have released the display. */
144 HalReleaseDisplayOwnership();
146 NtClose(BootVidDevice
);
147 BootVidDevice
= NULL
;
153 InbvEnableDisplayString(IN BOOLEAN Enable
)
161 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
168 InbvIsBootDriverInstalled(VOID
)
170 return(BootVidDriverInstalled
);
176 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
183 InbvResetDisplay(VOID
)
185 if (!BootVidDriverInstalled
)
189 return(BootVidFunctionTable
.ResetDisplay());
195 InbvSetScrollRegion(IN ULONG Left
,
205 InbvSetTextColor(IN ULONG Color
)
212 InbvSolidColorFill(IN ULONG Left
,
222 NtDisplayString(IN PUNICODE_STRING DisplayString
)
224 ANSI_STRING AnsiString
;
226 RtlUnicodeStringToAnsiString (&AnsiString
, DisplayString
, TRUE
);
228 HalDisplayString (AnsiString
.Buffer
);
230 RtlFreeAnsiString (&AnsiString
);
232 return(STATUS_SUCCESS
);