1 /* $Id: inbv.c,v 1.5 2003/12/30 18:52:03 fireball Exp $
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>
17 #include <rosrtl/string.h>
20 #include <internal/debug.h>
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
;
45 RtlRosInitUnicodeStringFromLiteral(&BootVidName
, L
"\\Device\\BootVid");
46 InitializeObjectAttributes(&ObjectAttributes
,
51 Status
= ZwOpenFile(&BootVidDevice
,
57 if (!NT_SUCCESS(Status
))
62 return(STATUS_SUCCESS
);
67 InbvAcquireDisplayOwnership(VOID
)
74 InbvCheckDisplayOwnership(VOID
)
82 InbvDisplayString(IN PCHAR String
)
89 InbvResetDisplayParameters(ULONG SizeX
, ULONG SizeY
)
91 return(InbvResetDisplay());
96 InbvEnableBootDriver(IN BOOLEAN Enable
)
101 Status
= InbvCheckBootVid();
102 if (!NT_SUCCESS(Status
))
109 Status
= NtDeviceIoControlFile(BootVidDevice
,
114 IOCTL_BOOTVID_INITIALIZE
,
117 &BootVidFunctionTable
,
118 sizeof(BootVidFunctionTable
));
119 if (!NT_SUCCESS(Status
))
123 BootVidDriverInstalled
= TRUE
;
124 /* Notify the hal we have acquired the display. */
126 HalAcquireDisplayOwnership(InbvResetDisplayParameters
);
130 Status
= NtDeviceIoControlFile(BootVidDevice
,
135 IOCTL_BOOTVID_CLEANUP
,
140 if (!NT_SUCCESS(Status
))
144 BootVidDriverInstalled
= FALSE
;
145 /* Notify the hal we have released the display. */
146 HalReleaseDisplayOwnership();
148 NtClose(BootVidDevice
);
149 BootVidDevice
= NULL
;
155 InbvEnableDisplayString(IN BOOLEAN Enable
)
163 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
170 InbvIsBootDriverInstalled(VOID
)
172 return(BootVidDriverInstalled
);
178 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
185 InbvResetDisplay(VOID
)
187 if (!BootVidDriverInstalled
)
191 return(BootVidFunctionTable
.ResetDisplay());
197 InbvSetScrollRegion(IN ULONG Left
,
207 InbvSetTextColor(IN ULONG Color
)
214 InbvSolidColorFill(IN ULONG Left
,