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>
19 /* GLOBALS *******************************************************************/
21 /* DATA **********************************************************************/
23 static HANDLE BootVidDevice
= NULL
;
24 static BOOL BootVidDriverInstalled
= FALSE
;
25 static NTBOOTVID_FUNCTION_TABLE BootVidFunctionTable
;
27 /* FUNCTIONS *****************************************************************/
31 InbvCheckBootVid(VOID
)
35 if (BootVidDevice
== NULL
)
38 OBJECT_ATTRIBUTES ObjectAttributes
;
39 UNICODE_STRING BootVidName
= RTL_CONSTANT_STRING(L
"\\Device\\BootVid");
41 InitializeObjectAttributes(&ObjectAttributes
,
46 Status
= ZwOpenFile(&BootVidDevice
,
52 if (!NT_SUCCESS(Status
))
57 return(STATUS_SUCCESS
);
63 InbvAcquireDisplayOwnership(VOID
)
69 InbvCheckDisplayOwnership(VOID
)
76 InbvDisplayString(IN PCHAR String
)
78 /* Call Bootvid (we don't support bootvid for now)
79 * vidDisplayString(String);
80 * so instead, we'll fall-back to HAL
82 HalDisplayString(String
);
84 /* Call Headless (We don't support headless for now)
85 HeadlessDispatch(DISPLAY_STRING);
94 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
96 return(InbvResetDisplay());
101 STDCALL INIT_FUNCTION
102 InbvEnableBootDriver(IN BOOLEAN Enable
)
105 IO_STATUS_BLOCK Iosb
;
107 Status
= InbvCheckBootVid();
108 if (!NT_SUCCESS(Status
))
115 /* Notify the hal we will acquire the display. */
116 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
118 Status
= NtDeviceIoControlFile(BootVidDevice
,
123 IOCTL_BOOTVID_INITIALIZE
,
126 &BootVidFunctionTable
,
127 sizeof(BootVidFunctionTable
));
128 if (!NT_SUCCESS(Status
))
132 BootVidDriverInstalled
= TRUE
;
137 Status
= NtDeviceIoControlFile(BootVidDevice
,
142 IOCTL_BOOTVID_CLEANUP
,
147 if (!NT_SUCCESS(Status
))
151 BootVidDriverInstalled
= FALSE
;
152 /* Notify the hal we have released the display. */
153 HalReleaseDisplayOwnership();
155 NtClose(BootVidDevice
);
156 BootVidDevice
= NULL
;
163 InbvEnableDisplayString(IN BOOLEAN Enable
)
171 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
178 InbvIsBootDriverInstalled(VOID
)
180 return(BootVidDriverInstalled
);
186 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
193 InbvResetDisplay(VOID
)
195 if (!BootVidDriverInstalled
)
199 return(BootVidFunctionTable
.ResetDisplay());
205 InbvSetScrollRegion(IN ULONG Left
,
215 InbvSetTextColor(IN ULONG Color
)
222 InbvSolidColorFill(IN ULONG Left
,
232 NtDisplayString(IN PUNICODE_STRING DisplayString
)
234 OEM_STRING OemString
;
236 RtlUnicodeStringToOemString(&OemString
, DisplayString
, TRUE
);
237 HalDisplayString(OemString
.Buffer
);
238 RtlFreeOemString(&OemString
);
240 return STATUS_SUCCESS
;