ReactOS 0.4.16-dev-981-g80eb313
inbv.c File Reference
#include <ntoskrnl.h>
#include "inbv/logo.h"
Include dependency graph for inbv.c:

Go to the source code of this file.

Classes

struct  _INBV_PROGRESS_STATE
 
struct  _BT_PROGRESS_INDICATOR
 

Macros

#define RT_BITMAP   MAKEINTRESOURCE(2)
 

Typedefs

typedef struct _INBV_PROGRESS_STATE INBV_PROGRESS_STATE
 
typedef struct _BT_PROGRESS_INDICATOR BT_PROGRESS_INDICATOR
 
typedef struct _BT_PROGRESS_INDICATORPBT_PROGRESS_INDICATOR
 

Functions

static PVOID FindBitmapResource (_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ ULONG ResourceId)
 
PUCHAR NTAPI InbvGetResourceAddress (_In_ ULONG ResourceNumber)
 
BOOLEAN NTAPI InbvDriverInitialize (_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ ULONG Count)
 
VOID NTAPI InbvAcquireLock (VOID)
 
VOID NTAPI InbvReleaseLock (VOID)
 
VOID NTAPI InbvEnableBootDriver (_In_ BOOLEAN Enable)
 
VOID NTAPI InbvAcquireDisplayOwnership (VOID)
 
VOID NTAPI InbvSetDisplayOwnership (_In_ BOOLEAN DisplayOwned)
 
BOOLEAN NTAPI InbvCheckDisplayOwnership (VOID)
 
INBV_DISPLAY_STATE NTAPI InbvGetDisplayState (VOID)
 
BOOLEAN NTAPI InbvDisplayString (_In_ PCHAR String)
 
BOOLEAN NTAPI InbvEnableDisplayString (_In_ BOOLEAN Enable)
 
VOID NTAPI InbvInstallDisplayStringFilter (_In_ INBV_DISPLAY_STRING_FILTER DisplayFilter)
 
BOOLEAN NTAPI InbvIsBootDriverInstalled (VOID)
 
VOID NTAPI InbvNotifyDisplayOwnershipLost (_In_ INBV_RESET_DISPLAY_PARAMETERS Callback)
 
BOOLEAN NTAPI InbvResetDisplay (VOID)
 
VOID NTAPI InbvSetScrollRegion (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom)
 
VOID NTAPI InbvSetTextColor (_In_ ULONG Color)
 
VOID NTAPI InbvSolidColorFill (_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ ULONG Color)
 
VOID NTAPI InbvBitBlt (_In_ PUCHAR Buffer, _In_ ULONG X, _In_ ULONG Y)
 
VOID NTAPI InbvBufferToScreenBlt (_In_ PUCHAR Buffer, _In_ ULONG X, _In_ ULONG Y, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
 
VOID NTAPI InbvScreenToBufferBlt (_Out_ PUCHAR Buffer, _In_ ULONG X, _In_ ULONG Y, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
 
VOID NTAPI InbvSetProgressBarCoordinates (_In_ ULONG Left, _In_ ULONG Top)
 Sets the screen coordinates of the loading progress bar and enable it.
 
VOID NTAPI InbvIndicateProgress (VOID)
 Gives some progress feedback, without specifying any explicit number of progress steps or percentage. The corresponding percentage is derived from the progress indicator's current count, capped to the number of expected calls to be made to this function (default: 25, see InbvProgressIndicator.Expected).
 
VOID NTAPI InbvSetProgressBarSubset (_In_ ULONG Floor, _In_ ULONG Ceiling)
 Specifies a progress percentage sub-range. Further calls to InbvIndicateProgress() or InbvUpdateProgressBar() will update the progress percentage relative to this sub-range. In particular, the percentage provided to InbvUpdateProgressBar() is relative to this sub-range.
 
VOID NTAPI InbvUpdateProgressBar (_In_ ULONG Percentage)
 Updates the progress bar percentage, relative to the current percentage sub-range previously set by InbvSetProgressBarSubset().
 
NTSTATUS NTAPI NtDisplayString (IN PUNICODE_STRING DisplayString)
 

Variables

static KSPIN_LOCK BootDriverLock
 
static KIRQL InbvOldIrql
 
static INBV_DISPLAY_STATE InbvDisplayState = INBV_DISPLAY_STATE_DISABLED
 
BOOLEAN InbvBootDriverInstalled = FALSE
 
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL
 
static BOOLEAN InbvDisplayDebugStrings = FALSE
 
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL
 
ULONG ProgressBarLeft = 0
 
ULONG ProgressBarTop = 0
 
BOOLEAN ShowProgressBar = FALSE
 
static INBV_PROGRESS_STATE InbvProgressState
 
static BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}
 
static ULONG ResourceCount = 0
 
static PUCHAR ResourceList [1+IDB_MAX_RESOURCES]
 
static ULONG InbvTerminalTextColor = 37
 
static ULONG InbvTerminalBkgdColor = 40
 

Macro Definition Documentation

◆ RT_BITMAP

#define RT_BITMAP   MAKEINTRESOURCE(2)

Definition at line 94 of file inbv.c.

Typedef Documentation

◆ BT_PROGRESS_INDICATOR

◆ INBV_PROGRESS_STATE

◆ PBT_PROGRESS_INDICATOR

Function Documentation

◆ FindBitmapResource()

static PVOID FindBitmapResource ( _In_ PLOADER_PARAMETER_BLOCK  LoaderBlock,
_In_ ULONG  ResourceId 
)
static

Definition at line 99 of file inbv.c.

102{
103 UNICODE_STRING UpString = RTL_CONSTANT_STRING(L"ntoskrnl.exe");
104 UNICODE_STRING MpString = RTL_CONSTANT_STRING(L"ntkrnlmp.exe");
105 PLIST_ENTRY NextEntry, ListHead;
106 PLDR_DATA_TABLE_ENTRY LdrEntry;
107 PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
108 LDR_RESOURCE_INFO ResourceInfo;
110 PVOID Data = NULL;
111
112 /* Loop the driver list */
113 ListHead = &LoaderBlock->LoadOrderListHead;
114 for (NextEntry = ListHead->Flink;
115 NextEntry != ListHead;
116 NextEntry = NextEntry->Flink)
117 {
118 /* Get the entry */
119 LdrEntry = CONTAINING_RECORD(NextEntry,
121 InLoadOrderLinks);
122
123 /* Check for a match */
124 if (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE) ||
125 RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE))
126 {
127 /* Break out */
128 break;
129 }
130 }
131
132 /* Check if we found it */
133 if (NextEntry != ListHead)
134 {
135 /* Try to find the resource */
136 ResourceInfo.Type = RT_BITMAP;
137 ResourceInfo.Name = ResourceId;
139
140 Status = LdrFindResource_U(LdrEntry->DllBase,
141 &ResourceInfo,
143 &ResourceDataEntry);
144 if (NT_SUCCESS(Status))
145 {
146 /* Access the resource */
147 ULONG Size = 0;
148 Status = LdrAccessResource(LdrEntry->DllBase,
149 ResourceDataEntry,
150 &Data,
151 &Size);
152 if ((Data) && (ResourceId < 3))
153 {
155 }
156 if (!NT_SUCCESS(Status)) Data = NULL;
157 }
158 }
159
160 /* Return the pointer */
161 return Data;
162}
INT ResourceId
Definition: LoadImageGCC.c:72
LONG NTSTATUS
Definition: precomp.h:26
ULONG_PTR KiBugCheckData[5]
Definition: bug.c:31
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RtlComputeCrc32
Definition: compat.h:810
Status
Definition: gdiplustypes.h:25
#define RT_BITMAP
Definition: inbv.c:94
NTSTATUS NTAPI LdrAccessResource(_In_ PVOID BaseAddress, _In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry, _Out_opt_ PVOID *Resource, _Out_opt_ PULONG Size)
NTSTATUS NTAPI LdrFindResource_U(_In_ PVOID BaseAddress, _In_ PLDR_RESOURCE_INFO ResourceInfo, _In_ ULONG Level, _Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry)
#define RESOURCE_DATA_LEVEL
Definition: ldrtypes.h:33
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define L(x)
Definition: ntvdm.h:50
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_NEUTRAL
Definition: nls.h:167
Definition: pedump.c:458
Definition: btrfs_drv.h:1876
PVOID DllBase
Definition: btrfs_drv.h:1880
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:149
ULONG_PTR Language
Definition: ldrtypes.h:187
ULONG_PTR Name
Definition: ldrtypes.h:186
ULONG_PTR Type
Definition: ldrtypes.h:185
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by BootAnimInitialize(), and InbvDriverInitialize().

◆ InbvAcquireDisplayOwnership()

VOID NTAPI InbvAcquireDisplayOwnership ( VOID  )

Definition at line 293 of file inbv.c.

294{
295 /* Check if we have a callback and we're just acquiring it now */
298 {
299 /* Call the callback */
301 }
302
303 /* Acquire the display */
305}
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:38
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters
Definition: inbv.c:40
@ INBV_DISPLAY_STATE_OWNED
Definition: inbvtypes.h:33
@ INBV_DISPLAY_STATE_LOST
Definition: inbvtypes.h:35

Referenced by HalHandleNMI(), HalReturnToFirmware(), KdpScreenAcquire(), KiDisplayBlueScreen(), and PopShutdownHandler().

◆ InbvAcquireLock()

VOID NTAPI InbvAcquireLock ( VOID  )

Definition at line 223 of file inbv.c.

224{
226
227 /* Check if we're at dispatch level or lower */
229 if (OldIrql <= DISPATCH_LEVEL)
230 {
231 /* Loop until the lock is free */
233
234 /* Raise IRQL to dispatch level */
236 }
237
238 /* Acquire the lock */
241}
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
static KIRQL InbvOldIrql
Definition: inbv.c:37
static KSPIN_LOCK BootDriverLock
Definition: inbv.c:36
BOOLEAN FASTCALL KeTestSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:475
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:287
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by BootAnimTickProgressBar(), BootLogoFadeIn(), DisplayBootBitmap(), FinalizeBootLogo(), InbvBitBlt(), InbvDisplayString(), InbvEnableBootDriver(), InbvNotifyDisplayOwnershipLost(), InbvRotationThread(), and InbvSolidColorFill().

◆ InbvBitBlt()

VOID NTAPI InbvBitBlt ( _In_ PUCHAR  Buffer,
_In_ ULONG  X,
_In_ ULONG  Y 
)

Definition at line 534 of file inbv.c.

538{
539 /* Check if we're installed and we own it */
542 {
543 /* Acquire the lock */
545
546 /* Do the blit */
547 VidBitBlt(Buffer, X, Y);
548
549 /* Release the lock */
551 }
552}
Definition: bufpool.h:45
#define Y(I)
VOID NTAPI VidBitBlt(_In_ PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top)
Definition: common.c:471
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:39
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:223
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:245

Referenced by BitBltPalette(), and DisplayShutdownBitmap().

◆ InbvBufferToScreenBlt()

VOID NTAPI InbvBufferToScreenBlt ( _In_ PUCHAR  Buffer,
_In_ ULONG  X,
_In_ ULONG  Y,
_In_ ULONG  Width,
_In_ ULONG  Height,
_In_ ULONG  Delta 
)

Definition at line 556 of file inbv.c.

563{
564 /* Check if we're installed and we own it */
567 {
568 /* Do the blit */
570 }
571}
VOID NTAPI VidBufferToScreenBlt(_In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
Definition: common.c:453
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
static ULONG Delta
Definition: xboxvideo.c:33

Referenced by DisplayBootBitmap().

◆ InbvCheckDisplayOwnership()

BOOLEAN NTAPI InbvCheckDisplayOwnership ( VOID  )

Definition at line 319 of file inbv.c.

320{
321 /* Return if we own it or not */
323}

Referenced by InbvMonitorThread(), KdpScreenRelease(), and PopShutdownHandler().

◆ InbvDisplayString()

BOOLEAN NTAPI InbvDisplayString ( _In_ PCHAR  String)

Definition at line 335 of file inbv.c.

337{
338 /* Make sure we own the display */
340 {
341 /* If we're not allowed, return success anyway */
342 if (!InbvDisplayDebugStrings) return TRUE;
343
344 /* Check if a filter is installed */
346
347 /* Acquire the lock */
349
350 /* Make sure we're installed and display the string */
352
353 /* Print the string on the EMS port */
355 String,
356 strlen(String) + sizeof(ANSI_NULL),
357 NULL,
358 NULL);
359
360 /* Release the lock */
362
363 /* All done */
364 return TRUE;
365 }
366
367 /* We don't own it, fail */
368 return FALSE;
369}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FALSE
Definition: types.h:117
VOID NTAPI VidDisplayString(_In_z_ PUCHAR String)
Definition: common.c:375
@ HeadlessCmdPutString
Definition: hdl.h:131
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:580
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter
Definition: inbv.c:43
static BOOLEAN InbvDisplayDebugStrings
Definition: inbv.c:42
#define ANSI_NULL
unsigned char * PUCHAR
Definition: typedefs.h:53
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

Referenced by DisplayShutdownBitmap(), DisplayShutdownText(), HalDisplayString(), HalHandleNMI(), KeBugCheckWithTf(), KeGetBugMessageText(), KiDisplayBlueScreen(), KiDumpParameterImages(), NtDisplayString(), and Phase1InitializationDiscard().

◆ InbvDriverInitialize()

BOOLEAN NTAPI InbvDriverInitialize ( _In_ PLOADER_PARAMETER_BLOCK  LoaderBlock,
_In_ ULONG  Count 
)

Definition at line 179 of file inbv.c.

182{
183 PCHAR CommandLine;
184 BOOLEAN ResetMode = FALSE; // By default do not reset the video mode
185 ULONG i;
186
187 /* Quit if we're already installed */
188 if (InbvBootDriverInstalled) return TRUE;
189
190 /* Initialize the lock and check the current display state */
193 {
194 /* Reset the video mode in case we do not have a custom boot logo */
195 CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
196 ResetMode = (CommandLine == NULL) || (strstr(CommandLine, "BOOTLOGO") == NULL);
197 }
198
199 /* Initialize the video */
202 {
203 /* Find bitmap resources in the kernel */
205 for (i = 1; i <= ResourceCount; i++)
206 {
207 /* Do the lookup */
208 ResourceList[i] = FindBitmapResource(LoaderBlock, i);
209 }
210
211 /* Set the progress bar ranges */
213
214 // BootAnimInitialize(LoaderBlock, Count);
215 }
216
217 /* Return install state */
219}
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
BOOLEAN NTAPI VidInitialize(_In_ BOOLEAN SetMode)
Definition: bootvid.c:183
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID NTAPI InbvSetProgressBarSubset(_In_ ULONG Floor, _In_ ULONG Ceiling)
Specifies a progress percentage sub-range. Further calls to InbvIndicateProgress() or InbvUpdateProgr...
Definition: inbv.c:667
static ULONG ResourceCount
Definition: inbv.c:50
static PVOID FindBitmapResource(_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ ULONG ResourceId)
Definition: inbv.c:99
#define min(a, b)
Definition: monoChain.cc:55
int Count
Definition: noreturn.cpp:7
_strupr
Definition: string.h:453
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by Phase1InitializationDiscard().

◆ InbvEnableBootDriver()

VOID NTAPI InbvEnableBootDriver ( _In_ BOOLEAN  Enable)

Definition at line 261 of file inbv.c.

263{
264 /* Check if we're installed */
266 {
267 /* Check for lost state */
269
270 /* Acquire the lock */
272
273 /* Cleanup the screen if we own it */
275
276 /* Set the new display state */
279
280 /* Release the lock */
282 }
283 else
284 {
285 /* Set the new display state */
288 }
289}
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:239
@ INBV_DISPLAY_STATE_DISABLED
Definition: inbvtypes.h:34
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142

Referenced by Phase1InitializationDiscard().

◆ InbvEnableDisplayString()

BOOLEAN NTAPI InbvEnableDisplayString ( _In_ BOOLEAN  Enable)

Definition at line 373 of file inbv.c.

375{
376 BOOLEAN OldSetting;
377
378 /* Get the old setting */
379 OldSetting = InbvDisplayDebugStrings;
380
381 /* Update it */
383
384 /* Return the old setting */
385 return OldSetting;
386}

Referenced by DisplayShutdownBitmap(), HalHandleNMI(), KdpScreenAcquire(), KiDisplayBlueScreen(), and Phase1InitializationDiscard().

◆ InbvGetDisplayState()

INBV_DISPLAY_STATE NTAPI InbvGetDisplayState ( VOID  )

Definition at line 327 of file inbv.c.

328{
329 /* Return the actual state */
330 return InbvDisplayState;
331}

Referenced by BootAnimTickProgressBar(), BootLogoFadeIn(), FinalizeBootLogo(), and InbvRotationThread().

◆ InbvGetResourceAddress()

PUCHAR NTAPI InbvGetResourceAddress ( _In_ ULONG  ResourceNumber)

Definition at line 166 of file inbv.c.

168{
169 /* Validate the resource number */
170 if (ResourceNumber > ResourceCount) return NULL;
171
172 /* Return the address */
173 return ResourceList[ResourceNumber];
174}

Referenced by DisplayBootBitmap(), and DisplayShutdownBitmap().

◆ InbvIndicateProgress()

VOID NTAPI InbvIndicateProgress ( VOID  )

Gives some progress feedback, without specifying any explicit number of progress steps or percentage. The corresponding percentage is derived from the progress indicator's current count, capped to the number of expected calls to be made to this function (default: 25, see InbvProgressIndicator.Expected).

Returns
None.

Definition at line 629 of file inbv.c.

630{
631 ULONG Percentage;
632
633 /* Increase progress */
635
636 /* Compute the new percentage - Don't go over 100% */
637 Percentage = 100 * InbvProgressIndicator.Count /
639 Percentage = min(Percentage, 99);
640
641 if (Percentage != InbvProgressIndicator.Percentage)
642 {
643 /* Percentage has changed, update the progress bar */
645 InbvUpdateProgressBar(Percentage);
646 }
647}
static BT_PROGRESS_INDICATOR InbvProgressIndicator
Definition: inbv.c:48
VOID NTAPI InbvUpdateProgressBar(_In_ ULONG Percentage)
Updates the progress bar percentage, relative to the current percentage sub-range previously set by I...
Definition: inbv.c:693

Referenced by IopInitializeBuiltinDriver(), and IopInitializeSystemDrivers().

◆ InbvInstallDisplayStringFilter()

VOID NTAPI InbvInstallDisplayStringFilter ( _In_ INBV_DISPLAY_STRING_FILTER  DisplayFilter)

Definition at line 390 of file inbv.c.

392{
393 /* Save the filter */
395}
static VOID NTAPI DisplayFilter(_Inout_ PCHAR *String)
Definition: bootanim.c:454

Referenced by DisplayBootBitmap(), DisplayFilter(), DisplayShutdownBitmap(), HalHandleNMI(), KdpScreenAcquire(), and KiDisplayBlueScreen().

◆ InbvIsBootDriverInstalled()

BOOLEAN NTAPI InbvIsBootDriverInstalled ( VOID  )

Definition at line 399 of file inbv.c.

400{
401 /* Return driver state */
403}

Referenced by HalHandleNMI(), KdpScreenAcquire(), KdpScreenRelease(), KiDisplayBlueScreen(), and PopShutdownHandler().

◆ InbvNotifyDisplayOwnershipLost()

VOID NTAPI InbvNotifyDisplayOwnershipLost ( _In_ INBV_RESET_DISPLAY_PARAMETERS  Callback)

Definition at line 407 of file inbv.c.

409{
410 /* Check if we're installed */
412 {
413 /* Acquire the lock and cleanup if we own the screen */
416
417 /* Set the reset callback and display state */
420
421 /* Release the lock */
423 }
424 else
425 {
426 /* Set the reset callback and display state */
429 }
430}
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458

Referenced by InbvMonitorThread(), IntVideoPortInbvCleanup(), IntVideoPortInbvInitialize(), KdpScreenRelease(), Phase1InitializationDiscard(), ScrInbvCleanup(), and ScrInbvInitialize().

◆ InbvReleaseLock()

VOID NTAPI InbvReleaseLock ( VOID  )

Definition at line 245 of file inbv.c.

246{
248
249 /* Capture the old IRQL */
251
252 /* Release the driver lock */
254
255 /* If we were at dispatch level or lower, restore the old IRQL */
257}
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:298

Referenced by BootAnimTickProgressBar(), BootLogoFadeIn(), DisplayBootBitmap(), FinalizeBootLogo(), InbvBitBlt(), InbvDisplayString(), InbvEnableBootDriver(), InbvNotifyDisplayOwnershipLost(), InbvRotationThread(), and InbvSolidColorFill().

◆ InbvResetDisplay()

BOOLEAN NTAPI InbvResetDisplay ( VOID  )

Definition at line 434 of file inbv.c.

435{
436 /* Check if we're installed and we own it */
439 {
440 /* Do the reset */
442 return TRUE;
443 }
444
445 /* Nothing to reset */
446 return FALSE;
447}
VOID NTAPI VidResetDisplay(_In_ BOOLEAN HalReset)
Definition: bootvid.c:216

Referenced by HalHandleNMI(), KdpScreenAcquire(), KiDisplayBlueScreen(), and PopShutdownHandler().

◆ InbvScreenToBufferBlt()

VOID NTAPI InbvScreenToBufferBlt ( _Out_ PUCHAR  Buffer,
_In_ ULONG  X,
_In_ ULONG  Y,
_In_ ULONG  Width,
_In_ ULONG  Height,
_In_ ULONG  Delta 
)

Definition at line 575 of file inbv.c.

582{
583 /* Check if we're installed and we own it */
586 {
587 /* Do the blit */
589 }
590}
VOID NTAPI VidScreenToBufferBlt(_Out_writes_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
Definition: bootvid.c:247

Referenced by DisplayBootBitmap().

◆ InbvSetDisplayOwnership()

VOID NTAPI InbvSetDisplayOwnership ( _In_ BOOLEAN  DisplayOwned)

Definition at line 309 of file inbv.c.

311{
312 /* Set the new display state */
315}

◆ InbvSetProgressBarCoordinates()

VOID NTAPI InbvSetProgressBarCoordinates ( _In_ ULONG  Left,
_In_ ULONG  Top 
)

Sets the screen coordinates of the loading progress bar and enable it.

Parameters
[in]Left
[in]TopThe left/top coordinates.
Returns
None.

Definition at line 604 of file inbv.c.

607{
608 /* Update the coordinates */
609 ProgressBarLeft = Left;
611
612 /* Enable the progress bar */
614}
static LPHIST_ENTRY Top
Definition: history.c:53
ULONG ProgressBarTop
Definition: inbv.c:45
ULONG ProgressBarLeft
Definition: inbv.c:45
BOOLEAN ShowProgressBar
Definition: inbv.c:46

Referenced by DisplayBootBitmap().

◆ InbvSetProgressBarSubset()

VOID NTAPI InbvSetProgressBarSubset ( _In_ ULONG  Floor,
_In_ ULONG  Ceiling 
)

Specifies a progress percentage sub-range. Further calls to InbvIndicateProgress() or InbvUpdateProgressBar() will update the progress percentage relative to this sub-range. In particular, the percentage provided to InbvUpdateProgressBar() is relative to this sub-range.

Parameters
[in]FloorThe lower bound percentage of the sub-range (default: 0).
[in]CeilingThe upper bound percentage of the sub-range (default: 100).
Returns
None.

Definition at line 667 of file inbv.c.

670{
671 /* Sanity checks */
672 ASSERT(Floor < Ceiling);
673 ASSERT(Ceiling <= 100);
674
675 /* Update the progress bar state */
676 InbvProgressState.Floor = Floor * 100;
677 InbvProgressState.Ceiling = Ceiling * 100;
678 InbvProgressState.Bias = Ceiling - Floor;
679}
static INBV_PROGRESS_STATE InbvProgressState
Definition: inbv.c:47
#define ASSERT(a)
Definition: mode.c:44

Referenced by BootAnimInitialize(), InbvDriverInitialize(), and Phase1InitializationDiscard().

◆ InbvSetScrollRegion()

VOID NTAPI InbvSetScrollRegion ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom 
)

Definition at line 451 of file inbv.c.

456{
457 /* Just call bootvid */
458 VidSetScrollRegion(Left, Top, Right, Bottom);
459}
static LPHIST_ENTRY Bottom
Definition: history.c:54
VOID NTAPI VidSetScrollRegion(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom)
Definition: common.c:352

Referenced by DisplayBootBitmap(), DisplayShutdownBitmap(), HalHandleNMI(), KdpScreenAcquire(), and KiDisplayBlueScreen().

◆ InbvSetTextColor()

VOID NTAPI InbvSetTextColor ( _In_ ULONG  Color)

Definition at line 463 of file inbv.c.

465{
466 HEADLESS_CMD_SET_COLOR HeadlessSetColor;
467
468 /* Set color for EMS port */
469#ifdef INBV_HEADLESS_COLORS
470 InbvTerminalTextColor = 30 + CGA_TO_ANSI_COLOR(Color);
471#else
473#endif
474 HeadlessSetColor.TextColor = InbvTerminalTextColor;
475 HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
477 &HeadlessSetColor,
478 sizeof(HeadlessSetColor),
479 NULL,
480 NULL);
481
482 /* Update the text color */
484}
ULONG NTAPI VidSetTextColor(_In_ ULONG Color)
Definition: common.c:315
@ HeadlessCmdSetColor
Definition: hdl.h:137
static ULONG InbvTerminalBkgdColor
Definition: inbv.c:89
static ULONG InbvTerminalTextColor
Definition: inbv.c:88

Referenced by DisplayBootBitmap(), HalHandleNMI(), KdpScreenAcquire(), and KiDisplayBlueScreen().

◆ InbvSolidColorFill()

VOID NTAPI InbvSolidColorFill ( _In_ ULONG  Left,
_In_ ULONG  Top,
_In_ ULONG  Right,
_In_ ULONG  Bottom,
_In_ ULONG  Color 
)

Definition at line 488 of file inbv.c.

494{
495 HEADLESS_CMD_SET_COLOR HeadlessSetColor;
496
497 /* Make sure we own it */
499 {
500 /* Acquire the lock */
502
503 /* Check if we're installed */
505 {
506 /* Call bootvid */
507 VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
508 }
509
510 /* Set color for EMS port and clear display */
511#ifdef INBV_HEADLESS_COLORS
512 InbvTerminalBkgdColor = 40 + CGA_TO_ANSI_COLOR(Color);
513#else
515#endif
516 HeadlessSetColor.TextColor = InbvTerminalTextColor;
517 HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
519 &HeadlessSetColor,
520 sizeof(HeadlessSetColor),
521 NULL,
522 NULL);
524 NULL, 0,
525 NULL, NULL);
526
527 /* Release the lock */
529 }
530}
VOID NTAPI VidSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
Definition: bootvid.c:261
@ HeadlessCmdClearDisplay
Definition: hdl.h:132
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DisplayBootBitmap(), DisplayShutdownBitmap(), HalHandleNMI(), KdpScreenAcquire(), and KiDisplayBlueScreen().

◆ InbvUpdateProgressBar()

VOID NTAPI InbvUpdateProgressBar ( _In_ ULONG  Percentage)

Updates the progress bar percentage, relative to the current percentage sub-range previously set by InbvSetProgressBarSubset().

Parameters
[in]PercentageThe progress percentage, relative to the current sub-range.
Returns
None.

Definition at line 693 of file inbv.c.

695{
696 ULONG TotalProgress;
697
698 /* Make sure the progress bar is enabled, that we own and are installed */
699 if (ShowProgressBar &&
702 {
703 /* Compute the total progress and tick the progress bar */
704 TotalProgress = InbvProgressState.Floor + (Percentage * InbvProgressState.Bias);
705 // TotalProgress /= (100 * 100);
706
707 BootAnimTickProgressBar(TotalProgress);
708 }
709}
VOID NTAPI BootAnimTickProgressBar(_In_ ULONG SubPercentTimes100)
Ticks the progress bar. Used by InbvUpdateProgressBar() and related.
Definition: bootanim.c:318

Referenced by InbvIndicateProgress(), and Phase1InitializationDiscard().

◆ NtDisplayString()

NTSTATUS NTAPI NtDisplayString ( IN PUNICODE_STRING  DisplayString)

Definition at line 713 of file inbv.c.

714{
716 UNICODE_STRING CapturedString;
720
721 PAGED_CODE();
722
724
725 /* We require the TCB privilege */
728
729 /* Capture the string */
731 if (!NT_SUCCESS(Status))
732 return Status;
733
734 /* Do not display the string if it is empty */
735 if (CapturedString.Length == 0 || CapturedString.Buffer == NULL)
736 {
738 goto Quit;
739 }
740
741 /*
742 * Convert the string since INBV understands only ANSI/OEM. Allocate the
743 * string buffer in non-paged pool because INBV passes it down to BOOTVID.
744 * We cannot perform the allocation using RtlUnicodeStringToOemString()
745 * since its allocator uses PagedPool.
746 */
747 OemLength = RtlUnicodeStringToOemSize(&CapturedString);
748 if (OemLength > MAXUSHORT)
749 {
751 goto Quit;
752 }
753 RtlInitEmptyAnsiString((PANSI_STRING)&OemString, NULL, (USHORT)OemLength);
755 if (OemString.Buffer == NULL)
756 {
758 goto Quit;
759 }
761 if (!NT_SUCCESS(Status))
762 {
764 goto Quit;
765 }
766
767 /* Display the string */
769
770 /* Free the string buffer */
772
774
775Quit:
776 /* Free the captured string */
778
779 return Status;
780}
#define PAGED_CODE()
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG _In_ KPROCESSOR_MODE PreviousMode
VOID DisplayString(LPWSTR Msg)
Definition: misc.c:211
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
#define ExGetPreviousMode
Definition: ex.h:143
BOOLEAN NTAPI InbvDisplayString(_In_ PCHAR String)
Definition: inbv.c:335
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
const LUID SeTcbPrivilege
Definition: priv.c:26
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
unsigned short USHORT
Definition: pedump.c:61
static __inline NTSTATUS ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, IN KPROCESSOR_MODE CurrentMode, IN const UNICODE_STRING *UnsafeSrc)
Definition: probe.h:142
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:239
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define TAG_OSTR
Definition: tag.h:146
#define MAXUSHORT
Definition: typedefs.h:83
STRING OEM_STRING
Definition: umtypes.h:203
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define RtlUnicodeStringToOemSize(STRING)
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1577

Variable Documentation

◆ BootDriverLock

KSPIN_LOCK BootDriverLock
static

Definition at line 36 of file inbv.c.

Referenced by InbvAcquireLock(), InbvDriverInitialize(), and InbvReleaseLock().

◆ InbvBootDriverInstalled

◆ InbvDisplayDebugStrings

BOOLEAN InbvDisplayDebugStrings = FALSE
static

Definition at line 42 of file inbv.c.

Referenced by InbvDisplayString(), and InbvEnableDisplayString().

◆ InbvDisplayFilter

INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL
static

Definition at line 43 of file inbv.c.

Referenced by InbvDisplayString(), and InbvInstallDisplayStringFilter().

◆ InbvDisplayState

◆ InbvOldIrql

KIRQL InbvOldIrql
static

Definition at line 37 of file inbv.c.

Referenced by InbvAcquireLock(), and InbvReleaseLock().

◆ InbvProgressIndicator

BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}
static

Definition at line 48 of file inbv.c.

Referenced by InbvIndicateProgress().

◆ InbvProgressState

INBV_PROGRESS_STATE InbvProgressState
static

Definition at line 47 of file inbv.c.

Referenced by InbvSetProgressBarSubset(), and InbvUpdateProgressBar().

◆ InbvResetDisplayParameters

INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL
static

Definition at line 40 of file inbv.c.

Referenced by InbvAcquireDisplayOwnership(), and InbvNotifyDisplayOwnershipLost().

◆ InbvTerminalBkgdColor

ULONG InbvTerminalBkgdColor = 40
static

Definition at line 89 of file inbv.c.

Referenced by InbvSetTextColor(), and InbvSolidColorFill().

◆ InbvTerminalTextColor

ULONG InbvTerminalTextColor = 37
static

Definition at line 88 of file inbv.c.

Referenced by InbvSetTextColor(), and InbvSolidColorFill().

◆ ProgressBarLeft

ULONG ProgressBarLeft = 0

◆ ProgressBarTop

ULONG ProgressBarTop = 0

Definition at line 45 of file inbv.c.

Referenced by InbvSetProgressBarCoordinates().

◆ ResourceCount

◆ ResourceList

Definition at line 51 of file inbv.c.

◆ ShowProgressBar