ReactOS 0.4.16-dev-1067-ge98bba2
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 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
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:38
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:245
@ 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 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().

◆ 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 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: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
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 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().

◆ 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 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().

◆ 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().

◆ 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

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 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().

Variable Documentation

◆ InbvBootDriverInstalled