ReactOS 0.4.15-dev-8092-ge0ba2f3
inbv.h File Reference
#include "bootvid/bootvid.h"
Include dependency graph for inbv.h:

Go to the source code of this file.

Functions

BOOLEAN NTAPI InbvDriverInitialize (_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ ULONG Count)
 
INBV_DISPLAY_STATE NTAPI InbvGetDisplayState (VOID)
 
VOID NTAPI InbvAcquireLock (VOID)
 
VOID NTAPI InbvReleaseLock (VOID)
 
PUCHAR NTAPI InbvGetResourceAddress (_In_ ULONG ResourceNumber)
 
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().
 
VOID NTAPI InbvPortEnableFifo (IN ULONG PortId, IN BOOLEAN Enable)
 
BOOLEAN NTAPI InbvPortPollOnly (IN ULONG PortId)
 
BOOLEAN NTAPI InbvPortGetByte (IN ULONG PortId, OUT PUCHAR Byte)
 
VOID NTAPI InbvPortPutByte (IN ULONG PortId, IN UCHAR Byte)
 
VOID NTAPI InbvPortTerminate (IN ULONG PortId)
 
BOOLEAN NTAPI InbvPortInitialize (IN ULONG BaudRate, IN ULONG PortNumber, IN PUCHAR PortAddress, OUT PULONG PortId, IN BOOLEAN IsMMIODevice)
 

Variables

BOOLEAN InbvBootDriverInstalled
 

Function Documentation

◆ InbvAcquireLock()

VOID NTAPI InbvAcquireLock ( VOID  )

Definition at line 220 of file inbv.c.

221{
223
224 /* Check if we're at dispatch level or lower */
226 if (OldIrql <= DISPATCH_LEVEL)
227 {
228 /* Loop until the lock is free */
230
231 /* Raise IRQL to dispatch level */
233 }
234
235 /* Acquire the lock */
238}
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 531 of file inbv.c.

535{
536 /* Check if we're installed and we own it */
539 {
540 /* Acquire the lock */
542
543 /* Do the blit */
544 VidBitBlt(Buffer, X, Y);
545
546 /* Release the lock */
548 }
549}
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:220
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:38
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:242
@ INBV_DISPLAY_STATE_OWNED
Definition: inbvtypes.h:33

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 553 of file inbv.c.

560{
561 /* Check if we're installed and we own it */
564 {
565 /* Do the blit */
567 }
568}
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().

◆ InbvDriverInitialize()

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

Definition at line 176 of file inbv.c.

179{
180 PCHAR CommandLine;
181 BOOLEAN ResetMode = FALSE; // By default do not reset the video mode
182 ULONG i;
183
184 /* Quit if we're already installed */
185 if (InbvBootDriverInstalled) return TRUE;
186
187 /* Initialize the lock and check the current display state */
190 {
191 /* Reset the video mode in case we do not have a custom boot logo */
192 CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
193 ResetMode = (CommandLine == NULL) || (strstr(CommandLine, "BOOTLOGO") == NULL);
194 }
195
196 /* Initialize the video */
199 {
200 /* Find bitmap resources in the kernel */
202 for (i = 1; i <= ResourceCount; i++)
203 {
204 /* Do the lookup */
205 ResourceList[i] = FindBitmapResource(LoaderBlock, i);
206 }
207
208 /* Set the progress bar ranges */
210
211 // BootAnimInitialize(LoaderBlock, Count);
212 }
213
214 /* Return install state */
216}
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 NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#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:664
static ULONG ResourceCount
Definition: inbv.c:50
static PVOID FindBitmapResource(_In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ ULONG ResourceId)
Definition: inbv.c:97
#define min(a, b)
Definition: monoChain.cc:55
int Count
Definition: noreturn.cpp:7
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
uint32_t ULONG
Definition: typedefs.h:59
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().

◆ InbvGetDisplayState()

INBV_DISPLAY_STATE NTAPI InbvGetDisplayState ( VOID  )

Definition at line 324 of file inbv.c.

325{
326 /* Return the actual state */
327 return InbvDisplayState;
328}

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

◆ InbvGetResourceAddress()

PUCHAR NTAPI InbvGetResourceAddress ( _In_ ULONG  ResourceNumber)

Definition at line 163 of file inbv.c.

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

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 626 of file inbv.c.

627{
628 ULONG Percentage;
629
630 /* Increase progress */
632
633 /* Compute the new percentage - Don't go over 100% */
634 Percentage = 100 * InbvProgressIndicator.Count /
636 Percentage = min(Percentage, 99);
637
638 if (Percentage != InbvProgressIndicator.Percentage)
639 {
640 /* Percentage has changed, update the progress bar */
642 InbvUpdateProgressBar(Percentage);
643 }
644}
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:690

Referenced by IopInitializeBuiltinDriver(), and IopInitializeSystemDrivers().

◆ InbvPortEnableFifo()

VOID NTAPI InbvPortEnableFifo ( IN ULONG  PortId,
IN BOOLEAN  Enable 
)

Definition at line 56 of file inbvport.c.

58{
59 /* Set FIFO as requested */
61}
VOID NTAPI CpEnableFifo(IN PUCHAR Address, IN BOOLEAN Enable)
Definition: cport.c:51
CPPORT Port[4]
Definition: inbvport.c:16
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
static WCHAR Address[46]
Definition: ping.c:68

Referenced by HdlspEnableTerminal().

◆ InbvPortGetByte()

BOOLEAN NTAPI InbvPortGetByte ( IN ULONG  PortId,
OUT PUCHAR  Byte 
)

Definition at line 38 of file inbvport.c.

40{
41 /* Read a byte from the port */
42 return CpGetByte(&Port[PortId], Byte, TRUE, FALSE) == CP_GET_SUCCESS;
43}
#define CP_GET_SUCCESS
Definition: cportlib.h:18
USHORT NTAPI CpGetByte(IN PCPPORT Port, OUT PUCHAR Byte, IN BOOLEAN Wait, IN BOOLEAN Poll)
Definition: cport.c:253
unsigned char Byte
Definition: zlib.h:37

Referenced by HdlspDispatch().

◆ InbvPortInitialize()

BOOLEAN NTAPI InbvPortInitialize ( IN ULONG  BaudRate,
IN ULONG  PortNumber,
IN PUCHAR  PortAddress,
OUT PULONG  PortId,
IN BOOLEAN  IsMMIODevice 
)

Definition at line 73 of file inbvport.c.

78{
79 /* Not yet supported */
80 ASSERT(IsMMIODevice == FALSE);
81
82#if defined(SARCH_PC98)
83 /* Set default baud rate */
84 if (BaudRate == 0) BaudRate = 9600;
85
86 /* Check if port or address given */
87 if (PortNumber)
88 {
89 /* Pick correct address for port */
90 if (!PortAddress)
91 {
92 if (PortNumber == 1)
93 {
94 PortAddress = (PUCHAR)0x30;
95 }
96 else
97 {
98 PortAddress = (PUCHAR)0x238;
99 PortNumber = 2;
100 }
101 }
102 }
103 else
104 {
105 /* Pick correct port for address */
106 PortAddress = (PUCHAR)0x30;
107 if (CpDoesPortExist(PortAddress))
108 {
109 PortNumber = 1;
110 }
111 else
112 {
113 PortAddress = (PUCHAR)0x238;
114 if (!CpDoesPortExist(PortAddress))
115 return FALSE;
116
117 PortNumber = 2;
118 }
119 }
120#else
121 /* Set default baud rate */
122 if (BaudRate == 0) BaudRate = 19200;
123
124 /* Check if port or address given */
125 if (PortNumber)
126 {
127 /* Pick correct address for port */
128 if (!PortAddress)
129 {
130 switch (PortNumber)
131 {
132 case 1:
133 PortAddress = (PUCHAR)0x3F8;
134 break;
135
136 case 2:
137 PortAddress = (PUCHAR)0x2F8;
138 break;
139
140 case 3:
141 PortAddress = (PUCHAR)0x3E8;
142 break;
143
144 default:
145 PortNumber = 4;
146 PortAddress = (PUCHAR)0x2E8;
147 }
148 }
149 }
150 else
151 {
152 /* Pick correct port for address */
153 PortAddress = (PUCHAR)0x2F8;
154 if (CpDoesPortExist(PortAddress))
155 {
156 PortNumber = 2;
157 }
158 else
159 {
160 PortAddress = (PUCHAR)0x3F8;
161 if (!CpDoesPortExist(PortAddress)) return FALSE;
162 PortNumber = 1;
163 }
164 }
165#endif
166
167 /* Initialize the port unless it's already up, and then return it */
168 if (Port[PortNumber - 1].Address) return FALSE;
169
170 CpInitialize(&Port[PortNumber - 1], PortAddress, BaudRate);
171 *PortId = PortNumber - 1;
172
173 return TRUE;
174}
NTSTATUS NTAPI CpInitialize(IN PCPPORT Port, IN PUCHAR Address, IN ULONG BaudRate)
Definition: cport.c:85
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:224
#define ASSERT(a)
Definition: mode.c:44
ULONG PortNumber
Definition: storport.c:18
unsigned char * PUCHAR
Definition: typedefs.h:53

Referenced by HdlspEnableTerminal().

◆ InbvPortPollOnly()

BOOLEAN NTAPI InbvPortPollOnly ( IN ULONG  PortId)

Definition at line 28 of file inbvport.c.

29{
30 UCHAR Dummy;
31
32 /* Poll a byte from the port */
33 return CpGetByte(&Port[PortId], &Dummy, FALSE, TRUE) == CP_GET_SUCCESS;
34}
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by HdlspDispatch().

◆ InbvPortPutByte()

VOID NTAPI InbvPortPutByte ( IN ULONG  PortId,
IN UCHAR  Byte 
)

Definition at line 47 of file inbvport.c.

49{
50 /* Send the byte */
51 CpPutByte(&Port[PortId], Byte);
52}
VOID NTAPI CpPutByte(IN PCPPORT Port, IN UCHAR Byte)
Definition: cport.c:303

Referenced by HdlspPutData(), and HdlspSendStringAtBaud().

◆ InbvPortTerminate()

VOID NTAPI InbvPortTerminate ( IN ULONG  PortId)

Definition at line 65 of file inbvport.c.

66{
67 /* The port is now available */
68 Port[PortId].Address = NULL;
69}
PUCHAR Address
Definition: cportlib.h:29

Referenced by HdlspEnableTerminal().

◆ InbvReleaseLock()

VOID NTAPI InbvReleaseLock ( VOID  )

Definition at line 242 of file inbv.c.

243{
245
246 /* Capture the old IRQL */
248
249 /* Release the driver lock */
251
252 /* If we were at dispatch level or lower, restore the old IRQL */
254}
#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().

◆ 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 572 of file inbv.c.

579{
580 /* Check if we're installed and we own it */
583 {
584 /* Do the blit */
586 }
587}
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().

◆ 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 601 of file inbv.c.

604{
605 /* Update the coordinates */
606 ProgressBarLeft = Left;
608
609 /* Enable the progress bar */
611}
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 664 of file inbv.c.

667{
668 /* Sanity checks */
669 ASSERT(Floor < Ceiling);
670 ASSERT(Ceiling <= 100);
671
672 /* Update the progress bar state */
673 InbvProgressState.Floor = Floor * 100;
674 InbvProgressState.Ceiling = Ceiling * 100;
675 InbvProgressState.Bias = Ceiling - Floor;
676}
static INBV_PROGRESS_STATE InbvProgressState
Definition: inbv.c:47

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

◆ 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 690 of file inbv.c.

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

Referenced by InbvIndicateProgress(), and Phase1InitializationDiscard().

Variable Documentation

◆ InbvBootDriverInstalled