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
);
65 InbvAcquireDisplayOwnership(VOID
)
72 InbvCheckDisplayOwnership(VOID
)
80 InbvDisplayString(IN PCHAR String
)
88 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
90 return(InbvResetDisplay());
96 InbvEnableBootDriver(IN BOOLEAN Enable
)
101 Status
= InbvCheckBootVid();
102 if (!NT_SUCCESS(Status
))
109 /* Notify the hal we will acquire the display. */
110 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
112 Status
= NtDeviceIoControlFile(BootVidDevice
,
117 IOCTL_BOOTVID_INITIALIZE
,
120 &BootVidFunctionTable
,
121 sizeof(BootVidFunctionTable
));
122 if (!NT_SUCCESS(Status
))
126 BootVidDriverInstalled
= TRUE
;
131 Status
= NtDeviceIoControlFile(BootVidDevice
,
136 IOCTL_BOOTVID_CLEANUP
,
141 if (!NT_SUCCESS(Status
))
145 BootVidDriverInstalled
= FALSE
;
146 /* Notify the hal we have released the display. */
147 HalReleaseDisplayOwnership();
149 NtClose(BootVidDevice
);
150 BootVidDevice
= NULL
;
157 InbvEnableDisplayString(IN BOOLEAN Enable
)
165 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
172 InbvIsBootDriverInstalled(VOID
)
174 return(BootVidDriverInstalled
);
180 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
187 InbvResetDisplay(VOID
)
189 if (!BootVidDriverInstalled
)
193 return(BootVidFunctionTable
.ResetDisplay());
199 InbvSetScrollRegion(IN ULONG Left
,
209 InbvSetTextColor(IN ULONG Color
)
216 InbvSolidColorFill(IN ULONG Left
,
226 NtDisplayString(IN PUNICODE_STRING DisplayString
)
228 OEM_STRING OemString
;
230 RtlUnicodeStringToOemString(&OemString
, DisplayString
, TRUE
);
231 HalDisplayString(OemString
.Buffer
);
232 RtlFreeOemString(&OemString
);
234 return STATUS_SUCCESS
;