1 /* $Id: inbv.c,v 1.6 2004/01/20 21:08:40 navaraf 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 /* 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
;
156 InbvEnableDisplayString(IN BOOLEAN Enable
)
164 InbvInstallDisplayStringFilter(IN PVOID Unknown
)
171 InbvIsBootDriverInstalled(VOID
)
173 return(BootVidDriverInstalled
);
179 InbvNotifyDisplayOwnershipLost(IN PVOID Callback
)
186 InbvResetDisplay(VOID
)
188 if (!BootVidDriverInstalled
)
192 return(BootVidFunctionTable
.ResetDisplay());
198 InbvSetScrollRegion(IN ULONG Left
,
208 InbvSetTextColor(IN ULONG Color
)
215 InbvSolidColorFill(IN ULONG Left
,