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 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
9 * 12-07-2003 CSH Created
12 /* INCLUDES ******************************************************************/
15 #include <ntos/bootvid.h>
16 #include <ddk/ntbootvid.h>
18 #include <internal/debug.h>
21 /* GLOBALS *******************************************************************/
23 /* DATA **********************************************************************/
25 static HANDLE BootVidDevice
= NULL
;
26 static BOOL BootVidDriverInstalled
= FALSE
;
27 static NTBOOTVID_FUNCTION_TABLE BootVidFunctionTable
;
29 /* FUNCTIONS *****************************************************************/
33 InbvCheckBootVid(VOID
)
37 if (BootVidDevice
== NULL
)
40 OBJECT_ATTRIBUTES ObjectAttributes
;
41 UNICODE_STRING BootVidName
;
43 RtlRosInitUnicodeStringFromLiteral(&BootVidName
, L
"\\Device\\BootVid");
44 InitializeObjectAttributes(&ObjectAttributes
,
49 Status
= ZwOpenFile(&BootVidDevice
,
55 if (!NT_SUCCESS(Status
))
60 return(STATUS_SUCCESS
);
65 InbvAcquireDisplayOwnership(VOID
)
72 InbvCheckDisplayOwnership(VOID
)
80 InbvDisplayString(IN PCHAR String
)
87 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
89 return(InbvResetDisplay());
94 InbvEnableBootDriver(IN BOOLEAN Enable
)
99 Status
= InbvCheckBootVid();
100 if (!NT_SUCCESS(Status
))
107 /* Notify the hal we will acquire the display. */
108 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
110 Status
= NtDeviceIoControlFile(BootVidDevice
,
115 IOCTL_BOOTVID_INITIALIZE
,
118 &BootVidFunctionTable
,
119 sizeof(BootVidFunctionTable
));
120 if (!NT_SUCCESS(Status
))
124 BootVidDriverInstalled
= TRUE
;
129 Status
= NtDeviceIoControlFile(BootVidDevice
,
134 IOCTL_BOOTVID_CLEANUP
,
139 if (!NT_SUCCESS(Status
))
143 BootVidDriverInstalled
= FALSE
;
144 /* Notify the hal we have released the display. */
145 HalReleaseDisplayOwnership();
147 NtClose(BootVidDevice
);
148 BootVidDevice
= NULL
;
154 InbvEnableDisplayString(IN BOOLEAN Enable
)
162 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
169 InbvIsBootDriverInstalled(VOID
)
171 return(BootVidDriverInstalled
);
177 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
184 InbvResetDisplay(VOID
)
186 if (!BootVidDriverInstalled
)
190 return(BootVidFunctionTable
.ResetDisplay());
196 InbvSetScrollRegion(IN ULONG Left
,
206 InbvSetTextColor(IN ULONG Color
)
213 InbvSolidColorFill(IN ULONG Left
,
223 NtDisplayString(IN PUNICODE_STRING DisplayString
)
225 ANSI_STRING AnsiString
;
227 RtlUnicodeStringToAnsiString (&AnsiString
, DisplayString
, TRUE
);
229 HalDisplayString (AnsiString
.Buffer
);
231 RtlFreeAnsiString (&AnsiString
);
233 return(STATUS_SUCCESS
);