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/dd/bootvid/ntbootvid.h"
16 #include <internal/debug.h>
18 #if defined (ALLOC_PRAGMA)
19 #pragma alloc_text(INIT, InbvEnableBootDriver)
23 /* GLOBALS *******************************************************************/
25 /* DATA **********************************************************************/
27 static HANDLE BootVidDevice
= NULL
;
28 static BOOL BootVidDriverInstalled
= FALSE
;
29 static NTBOOTVID_FUNCTION_TABLE BootVidFunctionTable
;
31 /* FUNCTIONS *****************************************************************/
35 InbvCheckBootVid(VOID
)
39 if (BootVidDevice
== NULL
)
42 OBJECT_ATTRIBUTES ObjectAttributes
;
43 UNICODE_STRING BootVidName
= RTL_CONSTANT_STRING(L
"\\Device\\BootVid");
45 InitializeObjectAttributes(&ObjectAttributes
,
50 Status
= ZwOpenFile(&BootVidDevice
,
56 if (!NT_SUCCESS(Status
))
61 return(STATUS_SUCCESS
);
67 InbvAcquireDisplayOwnership(VOID
)
73 InbvCheckDisplayOwnership(VOID
)
80 InbvDisplayString(IN PCHAR String
)
82 /* Call Bootvid (we don't support bootvid for now)
83 * vidDisplayString(String);
84 * so instead, we'll fall-back to HAL
86 HalDisplayString(String
);
88 /* Call Headless (We don't support headless for now)
89 HeadlessDispatch(DISPLAY_STRING);
98 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
100 return(InbvResetDisplay());
105 STDCALL INIT_FUNCTION
106 InbvEnableBootDriver(IN BOOLEAN Enable
)
109 IO_STATUS_BLOCK Iosb
;
111 Status
= InbvCheckBootVid();
112 if (!NT_SUCCESS(Status
))
119 /* Notify the hal we will acquire the display. */
120 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
122 Status
= ZwDeviceIoControlFile(BootVidDevice
,
127 IOCTL_BOOTVID_INITIALIZE
,
130 &BootVidFunctionTable
,
131 sizeof(BootVidFunctionTable
));
132 if (!NT_SUCCESS(Status
))
136 BootVidDriverInstalled
= TRUE
;
141 Status
= ZwDeviceIoControlFile(BootVidDevice
,
146 IOCTL_BOOTVID_CLEANUP
,
151 if (!NT_SUCCESS(Status
))
155 BootVidDriverInstalled
= FALSE
;
156 /* Notify the hal we have released the display. */
157 HalReleaseDisplayOwnership();
160 ZwClose(BootVidDevice
);
161 BootVidDevice
= NULL
;
167 InbvEnableDisplayString(IN BOOLEAN Enable
)
175 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
182 InbvIsBootDriverInstalled(VOID
)
184 return(BootVidDriverInstalled
);
190 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
197 InbvResetDisplay(VOID
)
199 if (!BootVidDriverInstalled
)
203 return(BootVidFunctionTable
.ResetDisplay());
209 InbvSetScrollRegion(IN ULONG Left
,
219 InbvSetTextColor(IN ULONG Color
)
226 InbvSolidColorFill(IN ULONG Left
,
236 NtDisplayString(IN PUNICODE_STRING DisplayString
)
238 OEM_STRING OemString
;
240 RtlUnicodeStringToOemString(&OemString
, DisplayString
, TRUE
);
241 HalDisplayString(OemString
.Buffer
);
242 RtlFreeOemString(&OemString
);
244 return STATUS_SUCCESS
;