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 "../../drivers/base/bootvid/ntbootvid.h"
16 #include <internal/debug.h>
18 #if defined (ALLOC_PRAGMA)
19 #pragma alloc_text(INIT, InbvEnableBootDriver)
22 /* ROS Internal. Please deprecate */
26 HalReleaseDisplayOwnership(
30 /* GLOBALS *******************************************************************/
32 /* DATA **********************************************************************/
34 static HANDLE BootVidDevice
= NULL
;
35 static BOOL BootVidDriverInstalled
= FALSE
;
36 static NTBOOTVID_FUNCTION_TABLE BootVidFunctionTable
;
38 /* FUNCTIONS *****************************************************************/
42 InbvCheckBootVid(VOID
)
46 if (BootVidDevice
== NULL
)
49 OBJECT_ATTRIBUTES ObjectAttributes
;
50 UNICODE_STRING BootVidName
= RTL_CONSTANT_STRING(L
"\\Device\\BootVid");
52 InitializeObjectAttributes(&ObjectAttributes
,
57 Status
= ZwOpenFile(&BootVidDevice
,
63 if (!NT_SUCCESS(Status
))
68 return(STATUS_SUCCESS
);
74 InbvAcquireDisplayOwnership(VOID
)
80 InbvCheckDisplayOwnership(VOID
)
87 InbvDisplayString(IN PCHAR String
)
89 /* Call Bootvid (we don't support bootvid for now)
90 * vidDisplayString(String);
91 * so instead, we'll fall-back to HAL
93 HalDisplayString(String
);
95 /* Call Headless (We don't support headless for now)
96 HeadlessDispatch(DISPLAY_STRING);
105 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
107 return(InbvResetDisplay());
112 STDCALL INIT_FUNCTION
113 InbvEnableBootDriver(IN BOOLEAN Enable
)
116 IO_STATUS_BLOCK Iosb
;
118 Status
= InbvCheckBootVid();
119 if (!NT_SUCCESS(Status
))
126 /* Notify the hal we will acquire the display. */
127 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
129 Status
= ZwDeviceIoControlFile(BootVidDevice
,
134 IOCTL_BOOTVID_INITIALIZE
,
137 &BootVidFunctionTable
,
138 sizeof(BootVidFunctionTable
));
139 if (!NT_SUCCESS(Status
))
143 BootVidDriverInstalled
= TRUE
;
148 Status
= ZwDeviceIoControlFile(BootVidDevice
,
153 IOCTL_BOOTVID_CLEANUP
,
158 if (!NT_SUCCESS(Status
))
162 BootVidDriverInstalled
= FALSE
;
163 /* Notify the hal we have released the display. */
164 HalReleaseDisplayOwnership();
167 ZwClose(BootVidDevice
);
168 BootVidDevice
= NULL
;
174 InbvEnableDisplayString(IN BOOLEAN Enable
)
182 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
189 InbvIsBootDriverInstalled(VOID
)
191 return(BootVidDriverInstalled
);
197 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
204 InbvResetDisplay(VOID
)
206 if (!BootVidDriverInstalled
)
210 return(BootVidFunctionTable
.ResetDisplay());
216 InbvSetScrollRegion(IN ULONG Left
,
226 InbvSetTextColor(IN ULONG Color
)
233 InbvSolidColorFill(IN ULONG Left
,
243 NtDisplayString(IN PUNICODE_STRING DisplayString
)
245 OEM_STRING OemString
;
247 RtlUnicodeStringToOemString(&OemString
, DisplayString
, TRUE
);
248 HalDisplayString(OemString
.Buffer
);
249 RtlFreeOemString(&OemString
);
251 return STATUS_SUCCESS
;