ReactOS  0.4.14-dev-593-g1793dcc
inbv.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
#include "bootvid/bootvid.h"
Include dependency graph for inbv.c:

Go to the source code of this file.

Classes

struct  _INBV_PROGRESS_STATE
 
struct  _BT_PROGRESS_INDICATOR
 
struct  tagRGBQUAD
 
struct  tagBITMAPINFOHEADER
 

Macros

#define NDEBUG
 
#define MM_READONLY   1
 
#define MM_READWRITE   4
 
#define TAG_OSTR   'RTSO'
 
#define SCREEN_WIDTH   640
 
#define SCREEN_HEIGHT   480
 
#define INBV_ROTBAR_IMPLEMENTED
 
#define ROT_BAR_DEFAULT_MODE   RB_PROGRESS_BAR
 
#define PALETTE_FADE_STEPS   12
 
#define PALETTE_FADE_TIME   (15 * 1000) /* 15 ms */
 

Typedefs

typedef struct _INBV_PROGRESS_STATE INBV_PROGRESS_STATE
 
typedef struct _BT_PROGRESS_INDICATOR BT_PROGRESS_INDICATOR
 
typedef struct _BT_PROGRESS_INDICATORPBT_PROGRESS_INDICATOR
 
typedef enum _ROT_BAR_TYPE ROT_BAR_TYPE
 
typedef enum _BBLT_VERT_ALIGNMENT BBLT_VERT_ALIGNMENT
 
typedef enum _BBLT_HORZ_ALIGNMENT BBLT_HORZ_ALIGNMENT
 
typedef enum _ROT_BAR_STATUS ROT_BAR_STATUS
 
typedef struct tagRGBQUAD RGBQUAD
 
typedef struct tagRGBQUADLPRGBQUAD
 
typedef struct tagBITMAPINFOHEADER BITMAPINFOHEADER
 
typedef struct tagBITMAPINFOHEADERPBITMAPINFOHEADER
 

Enumerations

enum  _ROT_BAR_TYPE { RB_UNSPECIFIED, RB_SQUARE_CELLS, RB_PROGRESS_BAR }
 
enum  _BBLT_VERT_ALIGNMENT { AL_VERTICAL_TOP = 0, AL_VERTICAL_CENTER, AL_VERTICAL_BOTTOM }
 
enum  _BBLT_HORZ_ALIGNMENT { AL_HORIZONTAL_LEFT = 0, AL_HORIZONTAL_CENTER, AL_HORIZONTAL_RIGHT }
 
enum  _ROT_BAR_STATUS { RBS_FADEIN = 1, RBS_ANIMATE, RBS_STOP_ANIMATE, RBS_STATUS_MAX }
 

Functions

VOID NTAPI InbvAcquireLock (VOID)
 
VOID NTAPI InbvReleaseLock (VOID)
 
static VOID BootLogoFadeIn (VOID)
 
static VOID BitBltPalette (IN PVOID Image, IN BOOLEAN NoPalette, IN ULONG X, IN ULONG Y)
 
static VOID BitBltAligned (IN PVOID Image, IN BOOLEAN NoPalette, IN BBLT_HORZ_ALIGNMENT HorizontalAlignment, IN BBLT_VERT_ALIGNMENT VerticalAlignment, IN ULONG MarginLeft, IN ULONG MarginTop, IN ULONG MarginRight, IN ULONG MarginBottom)
 
INIT_FUNCTION PVOID NTAPI FindBitmapResource (IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG ResourceId)
 
INIT_FUNCTION BOOLEAN NTAPI InbvDriverInitialize (IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG Count)
 
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 Filter)
 
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)
 
INIT_FUNCTION VOID NTAPI InbvUpdateProgressBar (IN ULONG Progress)
 
VOID NTAPI InbvBufferToScreenBlt (IN PUCHAR Buffer, IN ULONG X, IN ULONG Y, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
 
VOID NTAPI InbvBitBlt (IN PUCHAR Buffer, IN ULONG X, IN ULONG Y)
 
VOID NTAPI InbvScreenToBufferBlt (IN PUCHAR Buffer, IN ULONG X, IN ULONG Y, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
 
INIT_FUNCTION VOID NTAPI InbvSetProgressBarCoordinates (IN ULONG Left, IN ULONG Top)
 
INIT_FUNCTION VOID NTAPI InbvSetProgressBarSubset (IN ULONG Floor, IN ULONG Ceiling)
 
INIT_FUNCTION VOID NTAPI InbvIndicateProgress (VOID)
 
PUCHAR NTAPI InbvGetResourceAddress (IN ULONG ResourceNumber)
 
NTSTATUS NTAPI NtDisplayString (IN PUNICODE_STRING DisplayString)
 
static VOID NTAPI InbvRotationThread (_In_ PVOID Context)
 
INIT_FUNCTION VOID NTAPI InbvRotBarInit (VOID)
 
INIT_FUNCTION VOID NTAPI DisplayBootBitmap (IN BOOLEAN TextMode)
 
INIT_FUNCTION VOID NTAPI DisplayFilter (PCHAR *String)
 
INIT_FUNCTION VOID NTAPI FinalizeBootLogo (VOID)
 

Variables

static KSPIN_LOCK BootDriverLock
 
static KIRQL InbvOldIrql
 
static INBV_DISPLAY_STATE InbvDisplayState = INBV_DISPLAY_STATE_DISABLED
 
BOOLEAN InbvBootDriverInstalled = FALSE
 
static BOOLEAN InbvDisplayDebugStrings = FALSE
 
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL
 
static ULONG ProgressBarLeft = 0
 
static ULONG ProgressBarTop = 0
 
static BOOLEAN ShowProgressBar = FALSE
 
static INBV_PROGRESS_STATE InbvProgressState
 
static BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}
 
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL
 
static ULONG ResourceCount = 0
 
static PUCHAR ResourceList [1+IDB_MAX_RESOURCE]
 
static BOOLEAN RotBarThreadActive = FALSE
 
static ROT_BAR_TYPE RotBarSelection = RB_UNSPECIFIED
 
static ROT_BAR_STATUS PltRotBarStatus = 0
 
static UCHAR RotBarBuffer [24 *9]
 
static UCHAR RotLineBuffer [SCREEN_WIDTH *6]
 
static ULONG InbvTerminalTextColor = 37
 
static ULONG InbvTerminalBkgdColor = 40
 
static RGBQUAD MainPalette [16]
 

Macro Definition Documentation

◆ INBV_ROTBAR_IMPLEMENTED

#define INBV_ROTBAR_IMPLEMENTED

Definition at line 82 of file inbv.c.

◆ MM_READONLY

#define MM_READONLY   1

Definition at line 9 of file inbv.c.

◆ MM_READWRITE

#define MM_READWRITE   4

Definition at line 10 of file inbv.c.

◆ NDEBUG

#define NDEBUG

Definition at line 4 of file inbv.c.

◆ PALETTE_FADE_STEPS

#define PALETTE_FADE_STEPS   12

Definition at line 179 of file inbv.c.

◆ PALETTE_FADE_TIME

#define PALETTE_FADE_TIME   (15 * 1000) /* 15 ms */

Definition at line 180 of file inbv.c.

◆ ROT_BAR_DEFAULT_MODE

#define ROT_BAR_DEFAULT_MODE   RB_PROGRESS_BAR

Definition at line 102 of file inbv.c.

◆ SCREEN_HEIGHT

#define SCREEN_HEIGHT   480

Definition at line 60 of file inbv.c.

◆ SCREEN_WIDTH

#define SCREEN_WIDTH   640

Definition at line 59 of file inbv.c.

◆ TAG_OSTR

#define TAG_OSTR   'RTSO'

Definition at line 13 of file inbv.c.

Typedef Documentation

◆ BBLT_HORZ_ALIGNMENT

◆ BBLT_VERT_ALIGNMENT

◆ BITMAPINFOHEADER

From bootvid/precomp.h

◆ BT_PROGRESS_INDICATOR

◆ INBV_PROGRESS_STATE

◆ LPRGBQUAD

◆ PBITMAPINFOHEADER

◆ PBT_PROGRESS_INDICATOR

◆ RGBQUAD

◆ ROT_BAR_STATUS

◆ ROT_BAR_TYPE

Enumeration Type Documentation

◆ _BBLT_HORZ_ALIGNMENT

Enumerator
AL_HORIZONTAL_LEFT 
AL_HORIZONTAL_CENTER 
AL_HORIZONTAL_RIGHT 

Definition at line 72 of file inbv.c.

73 {
enum _BBLT_HORZ_ALIGNMENT BBLT_HORZ_ALIGNMENT

◆ _BBLT_VERT_ALIGNMENT

Enumerator
AL_VERTICAL_TOP 
AL_VERTICAL_CENTER 
AL_VERTICAL_BOTTOM 

Definition at line 65 of file inbv.c.

66 {
67  AL_VERTICAL_TOP = 0,
enum _BBLT_VERT_ALIGNMENT BBLT_VERT_ALIGNMENT

◆ _ROT_BAR_STATUS

Enumerator
RBS_FADEIN 
RBS_ANIMATE 
RBS_STOP_ANIMATE 
RBS_STATUS_MAX 

Definition at line 111 of file inbv.c.

112 {
113  RBS_FADEIN = 1,
114  RBS_ANIMATE,
enum _ROT_BAR_STATUS ROT_BAR_STATUS

◆ _ROT_BAR_TYPE

Enumerator
RB_UNSPECIFIED 
RB_SQUARE_CELLS 
RB_PROGRESS_BAR 

Definition at line 49 of file inbv.c.

50 {
54 } ROT_BAR_TYPE;
enum _ROT_BAR_TYPE ROT_BAR_TYPE

Function Documentation

◆ BitBltAligned()

static VOID BitBltAligned ( IN PVOID  Image,
IN BOOLEAN  NoPalette,
IN BBLT_HORZ_ALIGNMENT  HorizontalAlignment,
IN BBLT_VERT_ALIGNMENT  VerticalAlignment,
IN ULONG  MarginLeft,
IN ULONG  MarginTop,
IN ULONG  MarginRight,
IN ULONG  MarginBottom 
)
static

Definition at line 294 of file inbv.c.

303 {
304  PBITMAPINFOHEADER BitmapInfoHeader = Image;
305  ULONG X, Y;
306 
307  /* Calculate X */
308  switch (HorizontalAlignment)
309  {
310  case AL_HORIZONTAL_LEFT:
311  X = MarginLeft - MarginRight;
312  break;
313 
315  X = MarginLeft - MarginRight + (SCREEN_WIDTH - BitmapInfoHeader->biWidth + 1) / 2;
316  break;
317 
318  case AL_HORIZONTAL_RIGHT:
319  X = MarginLeft - MarginRight + SCREEN_WIDTH - BitmapInfoHeader->biWidth;
320  break;
321 
322  default:
323  /* Unknown */
324  return;
325  }
326 
327  /* Calculate Y */
328  switch (VerticalAlignment)
329  {
330  case AL_VERTICAL_TOP:
331  Y = MarginTop - MarginBottom;
332  break;
333 
334  case AL_VERTICAL_CENTER:
335  Y = MarginTop - MarginBottom + (SCREEN_HEIGHT - BitmapInfoHeader->biHeight + 1) / 2;
336  break;
337 
338  case AL_VERTICAL_BOTTOM:
339  Y = MarginTop - MarginBottom + SCREEN_HEIGHT - BitmapInfoHeader->biHeight;
340  break;
341 
342  default:
343  /* Unknown */
344  return;
345  }
346 
347  /* Finally draw the image */
348  BitBltPalette(Image, NoPalette, X, Y);
349 }
#define Y(I)
static PWSTR Image
Definition: pageheap.c:13
#define SCREEN_HEIGHT
Definition: inbv.c:60
#define SCREEN_WIDTH
Definition: inbv.c:59
unsigned int ULONG
Definition: retypes.h:1
#define X(b, s)
static VOID BitBltPalette(IN PVOID Image, IN BOOLEAN NoPalette, IN ULONG X, IN ULONG Y)
Definition: inbv.c:262

Referenced by DisplayBootBitmap().

◆ BitBltPalette()

static VOID BitBltPalette ( IN PVOID  Image,
IN BOOLEAN  NoPalette,
IN ULONG  X,
IN ULONG  Y 
)
static

Definition at line 262 of file inbv.c.

267 {
268  LPRGBQUAD Palette;
269  RGBQUAD OrigPalette[RTL_NUMBER_OF(MainPalette)];
270 
271  /* If requested, remove the palette from the image */
272  if (NoPalette)
273  {
274  /* Get bitmap header and palette */
275  PBITMAPINFOHEADER BitmapInfoHeader = Image;
276  Palette = (LPRGBQUAD)((PUCHAR)Image + BitmapInfoHeader->biSize);
277 
278  /* Save the image original palette and remove palette information */
279  RtlCopyMemory(OrigPalette, Palette, sizeof(OrigPalette));
280  RtlZeroMemory(Palette, sizeof(OrigPalette));
281  }
282 
283  /* Draw the image */
284  InbvBitBlt(Image, X, Y);
285 
286  /* Restore the image original palette */
287  if (NoPalette)
288  {
289  RtlCopyMemory(Palette, OrigPalette, sizeof(OrigPalette));
290  }
291 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define Y(I)
unsigned char * PUCHAR
Definition: retypes.h:3
static PWSTR Image
Definition: pageheap.c:13
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
VOID NTAPI InbvBitBlt(IN PUCHAR Buffer, IN ULONG X, IN ULONG Y)
Definition: inbv.c:813
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static RGBQUAD MainPalette[16]
Definition: inbv.c:177
struct tagRGBQUAD * LPRGBQUAD

Referenced by BitBltAligned(), and DisplayBootBitmap().

◆ BootLogoFadeIn()

static VOID BootLogoFadeIn ( VOID  )
static

Definition at line 209 of file inbv.c.

210 {
211  UCHAR PaletteBitmapBuffer[sizeof(BITMAPINFOHEADER) + sizeof(MainPalette)];
212  PBITMAPINFOHEADER PaletteBitmap = (PBITMAPINFOHEADER)PaletteBitmapBuffer;
213  LPRGBQUAD Palette = (LPRGBQUAD)(PaletteBitmapBuffer + sizeof(BITMAPINFOHEADER));
214  ULONG Iteration, Index, ClrUsed;
215 
216  LARGE_INTEGER Delay;
217  Delay.QuadPart = -(PALETTE_FADE_TIME * 10);
218 
219  /* Check if we are installed and we own the display */
222  {
223  return;
224  }
225 
226  /*
227  * Build a bitmap containing the fade-in palette. The palette entries
228  * are then processed in a loop and set using VidBitBlt function.
229  */
230  ClrUsed = RTL_NUMBER_OF(MainPalette);
231  RtlZeroMemory(PaletteBitmap, sizeof(BITMAPINFOHEADER));
232  PaletteBitmap->biSize = sizeof(BITMAPINFOHEADER);
233  PaletteBitmap->biBitCount = 4;
234  PaletteBitmap->biClrUsed = ClrUsed;
235 
236  /*
237  * Main animation loop.
238  */
239  for (Iteration = 0; Iteration <= PALETTE_FADE_STEPS; ++Iteration)
240  {
241  for (Index = 0; Index < ClrUsed; Index++)
242  {
243  Palette[Index].rgbRed = (UCHAR)
244  (MainPalette[Index].rgbRed * Iteration / PALETTE_FADE_STEPS);
245  Palette[Index].rgbGreen = (UCHAR)
246  (MainPalette[Index].rgbGreen * Iteration / PALETTE_FADE_STEPS);
247  Palette[Index].rgbBlue = (UCHAR)
248  (MainPalette[Index].rgbBlue * Iteration / PALETTE_FADE_STEPS);
249  }
250 
251  /* Do the animation */
252  InbvAcquireLock();
253  VidBitBlt(PaletteBitmapBuffer, 0, 0);
254  InbvReleaseLock();
255 
256  /* Wait for a bit */
258  }
259 }
struct tagBITMAPINFOHEADER * PBITMAPINFOHEADER
USHORT biBitCount
Definition: precomp.h:24
#define PALETTE_FADE_STEPS
Definition: inbv.c:179
#define PALETTE_FADE_TIME
Definition: inbv.c:180
UCHAR rgbBlue
Definition: inbv.c:170
UCHAR rgbGreen
Definition: inbv.c:171
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
UCHAR rgbRed
Definition: inbv.c:172
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI VidBitBlt(IN PUCHAR Buffer, IN ULONG Left, IN ULONG Top)
Definition: bootvid.c:509
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87
static RGBQUAD MainPalette[16]
Definition: inbv.c:177
LONGLONG QuadPart
Definition: typedefs.h:112
struct tagRGBQUAD * LPRGBQUAD

Referenced by DisplayBootBitmap().

◆ DisplayBootBitmap()

INIT_FUNCTION VOID NTAPI DisplayBootBitmap ( IN BOOLEAN  TextMode)

Definition at line 1085 of file inbv.c.

1086 {
1087  PVOID BootCopy = NULL, BootProgress = NULL, BootLogo = NULL, Header = NULL, Footer = NULL;
1088 
1089 #ifdef INBV_ROTBAR_IMPLEMENTED
1090  UCHAR Buffer[24 * 9];
1091  PVOID Bar = NULL, LineBmp = NULL;
1092  ROT_BAR_TYPE TempRotBarSelection = RB_UNSPECIFIED;
1093  NTSTATUS Status;
1094  HANDLE ThreadHandle = NULL;
1095 #endif
1096 
1097 #ifdef REACTOS_SKUS
1098  PVOID Text = NULL;
1099 #endif
1100 
1101 #ifdef INBV_ROTBAR_IMPLEMENTED
1102  /* Check if the animation thread has already been created */
1103  if (RotBarThreadActive)
1104  {
1105  /* Yes, just reset the progress bar but keep the thread alive */
1106  InbvAcquireLock();
1108  InbvReleaseLock();
1109  }
1110 #endif
1111 
1113 
1114  /* Check if this is text mode */
1115  if (TextMode)
1116  {
1117  /*
1118  * Make the kernel resource section temporarily writable,
1119  * as we are going to change the bitmaps' palette in place.
1120  */
1122 
1123  /* Check the type of the OS: workstation or server */
1124  if (SharedUserData->NtProductType == NtProductWinNt)
1125  {
1126  /* Workstation; set colors */
1127  InbvSetTextColor(15);
1130 
1131  /* Get resources */
1134  }
1135  else
1136  {
1137  /* Server; set colors */
1138  InbvSetTextColor(14);
1141 
1142  /* Get resources */
1145  }
1146 
1147  /* Set the scrolling region */
1148  InbvSetScrollRegion(32, 80, 631, 400);
1149 
1150  /* Make sure we have resources */
1151  if (Header && Footer)
1152  {
1153  /* BitBlt them on the screen */
1154  BitBltAligned(Footer,
1155  TRUE,
1158  0, 0, 0, 59);
1160  FALSE,
1163  0, 0, 0, 0);
1164  }
1165 
1166  /* Restore the kernel resource section protection to be read-only */
1168  }
1169  else
1170  {
1171  /* Is the boot driver installed? */
1172  if (!InbvBootDriverInstalled) return;
1173 
1174  /*
1175  * Make the kernel resource section temporarily writable,
1176  * as we are going to change the bitmaps' palette in place.
1177  */
1179 
1180  /* Load boot screen logo */
1182 
1183 #ifdef REACTOS_SKUS
1184  Text = NULL;
1185  if (SharedUserData->NtProductType == NtProductWinNt)
1186  {
1187 #ifdef INBV_ROTBAR_IMPLEMENTED
1188  /* Workstation product, use appropriate status bar color */
1190 #endif
1191  }
1192  else
1193  {
1194  /* Display correct branding based on server suite */
1196  {
1197  /* Storage Server Edition */
1199  }
1200  else if (ExVerifySuite(ComputeServer))
1201  {
1202  /* Compute Cluster Edition */
1204  }
1205  else
1206  {
1207  /* Normal edition */
1209  }
1210 
1211 #ifdef INBV_ROTBAR_IMPLEMENTED
1212  /* Server product, use appropriate status bar color */
1214 #endif
1215  }
1216 #else
1217  /* Use default status bar */
1219 #endif
1220 
1221  /* Make sure we have a logo */
1222  if (BootLogo)
1223  {
1224  /* Save the main image palette for implementing the fade-in effect */
1225  PBITMAPINFOHEADER BitmapInfoHeader = BootLogo;
1226  LPRGBQUAD Palette = (LPRGBQUAD)((PUCHAR)BootLogo + BitmapInfoHeader->biSize);
1227  RtlCopyMemory(MainPalette, Palette, sizeof(MainPalette));
1228 
1229  /* Draw the logo at the center of the screen */
1230  BitBltAligned(BootLogo,
1231  TRUE,
1234  0, 0, 0, 34);
1235 
1236 #ifdef INBV_ROTBAR_IMPLEMENTED
1237  /* Choose progress bar */
1238  TempRotBarSelection = ROT_BAR_DEFAULT_MODE;
1239 #endif
1240 
1241  /* Set progress bar coordinates and display it */
1243 
1244 #ifdef REACTOS_SKUS
1245  /* Check for non-workstation products */
1246  if (SharedUserData->NtProductType != NtProductWinNt)
1247  {
1248  /* Overwrite part of the logo for a server product */
1249  InbvScreenToBufferBlt(Buffer, 413, 237, 7, 7, 8);
1250  InbvSolidColorFill(418, 230, 454, 256, 0);
1251  InbvBufferToScreenBlt(Buffer, 413, 237, 7, 7, 8);
1252 
1253  /* In setup mode, you haven't selected a SKU yet */
1254  if (ExpInTextModeSetup) Text = NULL;
1255  }
1256 #endif
1257  }
1258 
1259  /* Load and draw progress bar bitmap */
1260  BootProgress = InbvGetResourceAddress(IDB_PROGRESS_BAR);
1261  BitBltAligned(BootProgress,
1262  TRUE,
1265  0, 118, 0, 0);
1266 
1267  /* Load and draw copyright text bitmap */
1269  BitBltAligned(BootCopy,
1270  TRUE,
1273  22, 0, 0, 20);
1274 
1275 #ifdef REACTOS_SKUS
1276  /* Draw the SKU text if it exits */
1277  if (Text) BitBltPalette(Text, TRUE, 180, 121);
1278 #endif
1279 
1280 #ifdef INBV_ROTBAR_IMPLEMENTED
1281  if (Bar)
1282  {
1283  /* Save previous screen pixels to buffer */
1284  InbvScreenToBufferBlt(Buffer, 0, 0, 22, 9, 24);
1285  /* Draw the progress bar bit */
1286  InbvBitBlt(Bar, 0, 0);
1287  /* Store it in global buffer */
1288  InbvScreenToBufferBlt(RotBarBuffer, 0, 0, 22, 9, 24);
1289  /* Restore screen pixels */
1290  InbvBufferToScreenBlt(Buffer, 0, 0, 22, 9, 24);
1291  }
1292 
1293  /*
1294  * Add a rotating bottom horizontal bar when using a progress bar,
1295  * to show that ReactOS can be still alive when the bar does not
1296  * appear to progress.
1297  */
1298  if (TempRotBarSelection == RB_PROGRESS_BAR)
1299  {
1301  if (LineBmp)
1302  {
1303  /* Draw the line and store it in global buffer */
1304  BitBltPalette(LineBmp, TRUE, 0, SCREEN_HEIGHT-6);
1306  }
1307  }
1308  else
1309  {
1310  /* Hide the simple progress bar if not used */
1312  }
1313 #endif
1314 
1315  /* Restore the kernel resource section protection to be read-only */
1317 
1318  /* Display the boot logo and fade it in */
1319  BootLogoFadeIn();
1320 
1321 #ifdef INBV_ROTBAR_IMPLEMENTED
1322  if (!RotBarThreadActive && TempRotBarSelection != RB_UNSPECIFIED)
1323  {
1324  /* Start the animation thread */
1325  Status = PsCreateSystemThread(&ThreadHandle,
1326  0,
1327  NULL,
1328  NULL,
1329  NULL,
1331  NULL);
1332  if (NT_SUCCESS(Status))
1333  {
1334  /* The thread has started, close the handle as we don't need it */
1336  ObCloseHandle(ThreadHandle, KernelMode);
1337  }
1338  }
1339 #endif
1340 
1341  /* Set filter which will draw text display if needed */
1343  }
1344 
1345 #ifdef INBV_ROTBAR_IMPLEMENTED
1346  /* Do we have the animation thread? */
1347  if (RotBarThreadActive)
1348  {
1349  /* We do, initialize the progress bar */
1350  InbvAcquireLock();
1351  RotBarSelection = TempRotBarSelection;
1352  InbvRotBarInit();
1353  InbvReleaseLock();
1354  }
1355 #endif
1356 }
#define IDB_SERVER_FOOTER
Definition: resource.h:25
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static VOID BootLogoFadeIn(VOID)
Definition: inbv.c:209
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI InbvBufferToScreenBlt(IN PUCHAR Buffer, IN ULONG X, IN ULONG Y, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
Definition: inbv.c:795
VOID NTAPI InbvSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN ULONG Color)
Definition: inbv.c:719
BOOLEAN NTAPI ExVerifySuite(SUITE_TYPE SuiteType)
Definition: sysinfo.c:377
enum _ROT_BAR_TYPE ROT_BAR_TYPE
static UCHAR RotBarBuffer[24 *9]
Definition: inbv.c:122
#define SCREEN_HEIGHT
Definition: inbv.c:60
static UCHAR RotLineBuffer[SCREEN_WIDTH *6]
Definition: inbv.c:123
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
#define SCREEN_WIDTH
Definition: inbv.c:59
Definition: Header.h:8
#define IDB_PROGRESS_BAR
Definition: resource.h:43
#define IDB_SERVER_LOGO
Definition: resource.h:23
BOOLEAN NTAPI MmChangeKernelResourceSectionProtection(IN ULONG_PTR ProtectionMask)
Definition: sysldr.c:2286
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
Definition: bufpool.h:45
#define IDB_COPYRIGHT
Definition: resource.h:44
#define IDB_LOGO_DEFAULT
Definition: resource.h:15
VOID NTAPI InbvSetTextColor(IN ULONG Color)
Definition: inbv.c:695
#define IDB_STORAGE_SERVER
Definition: resource.h:37
INIT_FUNCTION VOID NTAPI InbvRotBarInit(VOID)
Definition: inbv.c:1075
#define MM_READONLY
Definition: inbv.c:9
#define IDB_BAR_DEFAULT
Definition: resource.h:14
static VOID NTAPI InbvRotationThread(_In_ PVOID Context)
Definition: inbv.c:983
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ROT_BAR_DEFAULT_MODE
Definition: inbv.c:102
INIT_FUNCTION VOID NTAPI DisplayFilter(PCHAR *String)
Definition: inbv.c:1361
#define SharedUserData
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
#define MM_READWRITE
Definition: inbv.c:10
static ROT_BAR_TYPE RotBarSelection
Definition: inbv.c:120
Status
Definition: gdiplustypes.h:24
INIT_FUNCTION VOID NTAPI InbvSetProgressBarCoordinates(IN ULONG Left, IN ULONG Top)
Definition: inbv.c:853
BOOLEAN ExpInTextModeSetup
Definition: init.c:66
static VOID BitBltAligned(IN PVOID Image, IN BOOLEAN NoPalette, IN BBLT_HORZ_ALIGNMENT HorizontalAlignment, IN BBLT_VERT_ALIGNMENT VerticalAlignment, IN ULONG MarginLeft, IN ULONG MarginTop, IN ULONG MarginRight, IN ULONG MarginBottom)
Definition: inbv.c:294
#define IDB_WKSTA_FOOTER
Definition: resource.h:18
static BOOLEAN RotBarThreadActive
Definition: inbv.c:119
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
VOID NTAPI InbvBitBlt(IN PUCHAR Buffer, IN ULONG X, IN ULONG Y)
Definition: inbv.c:813
VOID NTAPI InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
Definition: inbv.c:625
VOID NTAPI InbvScreenToBufferBlt(IN PUCHAR Buffer, IN ULONG X, IN ULONG Y, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
Definition: inbv.c:834
#define IDB_ROTATING_LINE
Definition: resource.h:42
#define IDB_BAR_WKSTA
Definition: resource.h:20
PUCHAR NTAPI InbvGetResourceAddress(IN ULONG ResourceNumber)
Definition: inbv.c:904
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87
VOID NTAPI InbvSetScrollRegion(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom)
Definition: inbv.c:684
static RGBQUAD MainPalette[16]
Definition: inbv.c:177
#define IDB_CLUSTER_SERVER
Definition: resource.h:38
static BOOLEAN ShowProgressBar
Definition: inbv.c:91
#define IDB_WKSTA_HEADER
Definition: resource.h:17
char * Text
Definition: combotst.c:136
#define IDB_SERVER_HEADER
Definition: resource.h:24
static VOID BitBltPalette(IN PVOID Image, IN BOOLEAN NoPalette, IN ULONG X, IN ULONG Y)
Definition: inbv.c:262
struct tagRGBQUAD * LPRGBQUAD

Referenced by DisplayFilter(), and Phase1InitializationDiscard().

◆ DisplayFilter()

INIT_FUNCTION VOID NTAPI DisplayFilter ( PCHAR String)

Definition at line 1361 of file inbv.c.

1362 {
1363  /* Windows hack to skip first dots */
1364  static BOOLEAN DotHack = TRUE;
1365 
1366  /* If "." is given set *String to empty string */
1367  if (DotHack && strcmp(*String, ".") == 0)
1368  *String = "";
1369 
1370  if (**String)
1371  {
1372  /* Remove the filter */
1374 
1375  DotHack = FALSE;
1376 
1377  /* Draw text screen */
1379  }
1380 }
#define TRUE
Definition: types.h:120
static WCHAR String[]
Definition: stringtable.c:55
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
Definition: inbv.c:625
INIT_FUNCTION VOID NTAPI DisplayBootBitmap(IN BOOLEAN TextMode)
Definition: inbv.c:1085
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by DisplayBootBitmap().

◆ FinalizeBootLogo()

INIT_FUNCTION VOID NTAPI FinalizeBootLogo ( VOID  )

Definition at line 1385 of file inbv.c.

1386 {
1387  /* Acquire lock and check the display state */
1388  InbvAcquireLock();
1390  {
1391  /* Clear the screen */
1393  }
1394 
1395  /* Reset progress bar and lock */
1396 #ifdef INBV_ROTBAR_IMPLEMENTED
1399 #endif
1400  InbvReleaseLock();
1401 }
INBV_DISPLAY_STATE NTAPI InbvGetDisplayState(VOID)
Definition: inbv.c:564
#define SCREEN_HEIGHT
Definition: inbv.c:60
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
#define SCREEN_WIDTH
Definition: inbv.c:59
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static ROT_BAR_STATUS PltRotBarStatus
Definition: inbv.c:121
VOID NTAPI VidSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN UCHAR Color)
Definition: bootvid.c:538
static BOOLEAN RotBarThreadActive
Definition: inbv.c:119

Referenced by Phase1InitializationDiscard().

◆ FindBitmapResource()

INIT_FUNCTION PVOID NTAPI FindBitmapResource ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN ULONG  ResourceId 
)

Definition at line 356 of file inbv.c.

358 {
359  UNICODE_STRING UpString = RTL_CONSTANT_STRING(L"ntoskrnl.exe");
360  UNICODE_STRING MpString = RTL_CONSTANT_STRING(L"ntkrnlmp.exe");
361  PLIST_ENTRY NextEntry, ListHead;
362  PLDR_DATA_TABLE_ENTRY LdrEntry;
363  PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
364  LDR_RESOURCE_INFO ResourceInfo;
366  PVOID Data = NULL;
367 
368  /* Loop the driver list */
369  ListHead = &LoaderBlock->LoadOrderListHead;
370  NextEntry = ListHead->Flink;
371  while (NextEntry != ListHead)
372  {
373  /* Get the entry */
374  LdrEntry = CONTAINING_RECORD(NextEntry,
376  InLoadOrderLinks);
377 
378  /* Check for a match */
379  if (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE) ||
380  RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE))
381  {
382  /* Break out */
383  break;
384  }
385  }
386 
387  /* Check if we found it */
388  if (NextEntry != ListHead)
389  {
390  /* Try to find the resource */
391  ResourceInfo.Type = 2; // RT_BITMAP;
392  ResourceInfo.Name = ResourceId;
393  ResourceInfo.Language = 0;
394  Status = LdrFindResource_U(LdrEntry->DllBase,
395  &ResourceInfo,
397  &ResourceDataEntry);
398  if (NT_SUCCESS(Status))
399  {
400  /* Access the resource */
401  ULONG Size = 0;
402  Status = LdrAccessResource(LdrEntry->DllBase,
403  ResourceDataEntry,
404  &Data,
405  &Size);
406  if ((Data) && (ResourceId < 3))
407  {
409  }
410  if (!NT_SUCCESS(Status)) Data = NULL;
411  }
412  }
413 
414  /* Return the pointer */
415  return Data;
416 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
ULONG_PTR Type
Definition: ldrtypes.h:181
PVOID DllBase
Definition: btrfs_drv.h:1857
ULONG_PTR Name
Definition: ldrtypes.h:182
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
Definition: pedump.c:457
NTSTATUS NTAPI LdrFindResource_U(_In_ PVOID BaseAddress, _In_ PLDR_RESOURCE_INFO ResourceInfo, _In_ ULONG Level, _Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
NTSTATUS NTAPI LdrAccessResource(_In_ PVOID BaseAddress, _In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry, _Out_opt_ PVOID *Resource, _Out_opt_ PULONG Size)
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG_PTR KiBugCheckData[5]
Definition: bug.c:30
static const WCHAR L[]
Definition: oid.c:1250
Definition: btrfs_drv.h:1853
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define RESOURCE_DATA_LEVEL
Definition: ldrtypes.h:33
NTSYSAPI ULONG NTAPI RtlComputeCrc32(_In_ ULONG InitialCrc, _In_ PUCHAR Buffer, _In_ ULONG Length)
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
ULONG_PTR Language
Definition: ldrtypes.h:183
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by InbvDriverInitialize().

◆ InbvAcquireDisplayOwnership()

VOID NTAPI InbvAcquireDisplayOwnership ( VOID  )

Definition at line 531 of file inbv.c.

532 {
533  /* Check if we have a callback and we're just acquiring it now */
536  {
537  /* Call the callback */
539  }
540 
541  /* Acquire the display */
543 }
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters
Definition: inbv.c:94
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86

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

◆ InbvAcquireLock()

VOID NTAPI InbvAcquireLock ( VOID  )

Definition at line 462 of file inbv.c.

463 {
464  KIRQL OldIrql;
465 
466  /* Check if we're at dispatch level or lower */
468  if (OldIrql <= DISPATCH_LEVEL)
469  {
470  /* Loop until the lock is free */
471  while (!KeTestSpinLock(&BootDriverLock));
472 
473  /* Raise IRQL to dispatch level */
475  }
476 
477  /* Acquire the lock */
480 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
UCHAR KIRQL
Definition: env_spec_w32.h:591
BOOLEAN FASTCALL KeTestSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:442
static KIRQL InbvOldIrql
Definition: inbv.c:85
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID FASTCALL KiAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:32
static KSPIN_LOCK BootDriverLock
Definition: inbv.c:84

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

◆ InbvBitBlt()

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

Definition at line 813 of file inbv.c.

816 {
817  /* Check if we're installed and we own it */
820  {
821  /* Acquire the lock */
822  InbvAcquireLock();
823 
824  /* Do the blit */
825  VidBitBlt(Buffer, X, Y);
826 
827  /* Release the lock */
828  InbvReleaseLock();
829  }
830 }
#define Y(I)
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
Definition: bufpool.h:45
VOID NTAPI VidBitBlt(IN PUCHAR Buffer, IN ULONG Left, IN ULONG Top)
Definition: bootvid.c:509
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

Referenced by BitBltPalette(), DisplayBootBitmap(), and PopShutdownHandler().

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

801 {
802  /* Check if we're installed and we own it */
805  {
806  /* Do the blit */
807  VidBufferToScreenBlt(Buffer, X, Y, Width, Height, Delta);
808  }
809 }
#define Y(I)
Definition: bufpool.h:45
static ULONG Delta
Definition: xboxvideo.c:32
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
VOID NTAPI VidBufferToScreenBlt(IN PUCHAR Buffer, IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
Definition: bootvid.c:409
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

Referenced by DisplayBootBitmap().

◆ InbvCheckDisplayOwnership()

BOOLEAN NTAPI InbvCheckDisplayOwnership ( VOID  )

Definition at line 556 of file inbv.c.

557 {
558  /* Return if we own it or not */
560 }
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86

Referenced by InbvMonitorThread(), KdpScreenRelease(), PopShutdownHandler(), ScrCreate(), ScrIoControl(), and ScrWrite().

◆ InbvDisplayString()

BOOLEAN NTAPI InbvDisplayString ( IN PCHAR  String)

Definition at line 572 of file inbv.c.

573 {
574  /* Make sure we own the display */
576  {
577  /* If we're not allowed, return success anyway */
578  if (!InbvDisplayDebugStrings) return TRUE;
579 
580  /* Check if a filter is installed */
582 
583  /* Acquire the lock */
584  InbvAcquireLock();
585 
586  /* Make sure we're installed and display the string */
588 
589  /* Print the string on the EMS port */
591  String,
592  strlen(String) + sizeof(ANSI_NULL),
593  NULL,
594  NULL);
595 
596  /* Release the lock */
597  InbvReleaseLock();
598 
599  /* All done */
600  return TRUE;
601  }
602 
603  /* We don't own it, fail */
604  return FALSE;
605 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned char * PUCHAR
Definition: retypes.h:3
static WCHAR String[]
Definition: stringtable.c:55
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
#define ANSI_NULL
VOID NTAPI VidDisplayString(IN PUCHAR String)
Definition: bootvid.c:425
smooth NULL
Definition: ftsmooth.c:416
static BOOLEAN InbvDisplayDebugStrings
Definition: inbv.c:88
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter
Definition: inbv.c:89
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

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

◆ InbvDriverInitialize()

INIT_FUNCTION BOOLEAN NTAPI InbvDriverInitialize ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN ULONG  Count 
)

Definition at line 421 of file inbv.c.

423 {
424  PCHAR CommandLine;
425  BOOLEAN ResetMode = FALSE; // By default do not reset the video mode
426  ULONG i;
427 
428  /* Quit if we're already installed */
429  if (InbvBootDriverInstalled) return TRUE;
430 
431  /* Initialize the lock and check the current display state */
434  {
435  /* Reset the video mode in case we do not have a custom boot logo */
436  CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
437  ResetMode = (CommandLine == NULL) || (strstr(CommandLine, "BOOTLOGO") == NULL);
438  }
439 
440  /* Initialize the video */
443  {
444  /* Find bitmap resources in the kernel */
446  for (i = 1; i <= ResourceCount; i++)
447  {
448  /* Do the lookup */
449  ResourceList[i] = FindBitmapResource(LoaderBlock, i);
450  }
451 
452  /* Set the progress bar ranges */
453  InbvSetProgressBarSubset(0, 100);
454  }
455 
456  /* Return install state */
458 }
signed char * PCHAR
Definition: retypes.h:7
#define TRUE
Definition: types.h:120
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
BOOLEAN NTAPI VidInitialize(IN BOOLEAN SetMode)
Definition: bootvid.c:278
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
static PUCHAR ResourceList[1+IDB_MAX_RESOURCE]
Definition: inbv.c:96
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
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
INIT_FUNCTION PVOID NTAPI FindBitmapResource(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG ResourceId)
Definition: inbv.c:356
static ULONG ResourceCount
Definition: inbv.c:95
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define min(a, b)
Definition: monoChain.cc:55
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
unsigned int ULONG
Definition: retypes.h:1
static KSPIN_LOCK BootDriverLock
Definition: inbv.c:84
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87
INIT_FUNCTION VOID NTAPI InbvSetProgressBarSubset(IN ULONG Floor, IN ULONG Ceiling)
Definition: inbv.c:867

Referenced by Phase1InitializationDiscard().

◆ InbvEnableBootDriver()

VOID NTAPI InbvEnableBootDriver ( IN BOOLEAN  Enable)

Definition at line 500 of file inbv.c.

501 {
502  /* Check if we're installed */
504  {
505  /* Check for lost state */
507 
508  /* Acquire the lock */
509  InbvAcquireLock();
510 
511  /* Cleanup the screen if we own it */
513 
514  /* Set the new display state */
517 
518  /* Release the lock */
519  InbvReleaseLock();
520  }
521  else
522  {
523  /* Set the new display state */
526  }
527 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:398
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

Referenced by Phase1InitializationDiscard().

◆ InbvEnableDisplayString()

BOOLEAN NTAPI InbvEnableDisplayString ( IN BOOLEAN  Enable)

Definition at line 609 of file inbv.c.

610 {
611  BOOLEAN OldSetting;
612 
613  /* Get the old setting */
614  OldSetting = InbvDisplayDebugStrings;
615 
616  /* Update it */
618 
619  /* Return the old setting */
620  return OldSetting;
621 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
unsigned char BOOLEAN
static BOOLEAN InbvDisplayDebugStrings
Definition: inbv.c:88

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

◆ InbvGetDisplayState()

INBV_DISPLAY_STATE NTAPI InbvGetDisplayState ( VOID  )

Definition at line 564 of file inbv.c.

565 {
566  /* Return the actual state */
567  return InbvDisplayState;
568 }
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86

Referenced by FinalizeBootLogo().

◆ InbvGetResourceAddress()

PUCHAR NTAPI InbvGetResourceAddress ( IN ULONG  ResourceNumber)

Definition at line 904 of file inbv.c.

905 {
906  /* Validate the resource number */
907  if (ResourceNumber > ResourceCount) return NULL;
908 
909  /* Return the address */
910  return ResourceList[ResourceNumber];
911 }
static PUCHAR ResourceList[1+IDB_MAX_RESOURCE]
Definition: inbv.c:96
smooth NULL
Definition: ftsmooth.c:416
static ULONG ResourceCount
Definition: inbv.c:95

Referenced by DisplayBootBitmap(), and PopShutdownHandler().

◆ InbvIndicateProgress()

INIT_FUNCTION VOID NTAPI InbvIndicateProgress ( VOID  )

Definition at line 883 of file inbv.c.

884 {
885  ULONG Percentage;
886 
887  /* Increase progress */
889 
890  /* Compute new percentage */
891  Percentage = min(100 * InbvProgressIndicator.Count /
893  99);
894  if (Percentage != InbvProgressIndicator.Percentage)
895  {
896  /* Percentage has moved, update the progress bar */
897  InbvProgressIndicator.Percentage = Percentage;
898  InbvUpdateProgressBar(Percentage);
899  }
900 }
static BT_PROGRESS_INDICATOR InbvProgressIndicator
Definition: inbv.c:93
INIT_FUNCTION VOID NTAPI InbvUpdateProgressBar(IN ULONG Progress)
Definition: inbv.c:765
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1

Referenced by IopInitializeBuiltinDriver(), and IopInitializeSystemDrivers().

◆ InbvInstallDisplayStringFilter()

VOID NTAPI InbvInstallDisplayStringFilter ( IN INBV_DISPLAY_STRING_FILTER  Filter)

Definition at line 625 of file inbv.c.

626 {
627  /* Save the filter */
629 }
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter
Definition: inbv.c:89

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

◆ InbvIsBootDriverInstalled()

BOOLEAN NTAPI InbvIsBootDriverInstalled ( VOID  )

Definition at line 633 of file inbv.c.

634 {
635  /* Return driver state */
637 }
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

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

◆ InbvNotifyDisplayOwnershipLost()

VOID NTAPI InbvNotifyDisplayOwnershipLost ( IN INBV_RESET_DISPLAY_PARAMETERS  Callback)

Definition at line 641 of file inbv.c.

642 {
643  /* Check if we're installed */
645  {
646  /* Acquire the lock and cleanup if we own the screen */
647  InbvAcquireLock();
649 
650  /* Set the reset callback and display state */
653 
654  /* Release the lock */
655  InbvReleaseLock();
656  }
657  else
658  {
659  /* Set the reset callback and display state */
662  }
663 }
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters
Definition: inbv.c:94
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:398
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87
LPFNPSPCALLBACK Callback
Definition: desk.c:111

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

◆ InbvReleaseLock()

VOID NTAPI InbvReleaseLock ( VOID  )

Definition at line 484 of file inbv.c.

485 {
486  KIRQL OldIrql;
487 
488  /* Capture the old IRQL */
490 
491  /* Release the driver lock */
493 
494  /* If we were at dispatch level or lower, restore the old IRQL */
496 }
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: ntoskrnl.c:39
static KIRQL InbvOldIrql
Definition: inbv.c:85
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
static KSPIN_LOCK BootDriverLock
Definition: inbv.c:84

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

◆ InbvResetDisplay()

BOOLEAN NTAPI InbvResetDisplay ( VOID  )

Definition at line 667 of file inbv.c.

668 {
669  /* Check if we're installed and we own it */
672  {
673  /* Do the reset */
675  return TRUE;
676  }
677 
678  /* Nothing to reset */
679  return FALSE;
680 }
#define TRUE
Definition: types.h:120
VOID NTAPI VidResetDisplay(IN BOOLEAN HalReset)
Definition: bootvid.c:313
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

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

◆ InbvRotationThread()

static VOID NTAPI InbvRotationThread ( _In_ PVOID  Context)
static

Definition at line 983 of file inbv.c.

985 {
986  ULONG X, Y, Index, Total;
987  LARGE_INTEGER Delay = {{0}};
988 
989  InbvAcquireLock();
991  {
992  Index = 0;
993  }
994  else
995  {
996  Index = 32;
997  }
998  X = ProgressBarLeft + 2;
999  Y = ProgressBarTop + 2;
1000  InbvReleaseLock();
1001 
1003  {
1004  /* Wait for a bit */
1006 
1007  InbvAcquireLock();
1008 
1009  /* Unknown unexpected command */
1011 
1013  {
1014  /* Stop the thread */
1015  InbvReleaseLock();
1016  break;
1017  }
1018 
1020  {
1021  Delay.QuadPart = -800000; // 80 ms
1022  Total = 18;
1023  Index %= Total;
1024 
1025  if (Index >= 3)
1026  {
1027  /* Fill previous bar position */
1028  VidSolidColorFill(X + ((Index - 3) * 8), Y, (X + ((Index - 3) * 8)) + 8 - 1, Y + 9 - 1, 0);
1029  }
1030  if (Index < Total - 1)
1031  {
1032  /* Draw the progress bar bit */
1033  if (Index < 2)
1034  {
1035  /* Appearing from the left */
1036  VidBufferToScreenBlt(RotBarBuffer + 8 * (2 - Index) / 2, X, Y, 22 - 8 * (2 - Index), 9, 24);
1037  }
1038  else if (Index >= Total - 3)
1039  {
1040  /* Hiding to the right */
1041  VidBufferToScreenBlt(RotBarBuffer, X + ((Index - 2) * 8), Y, 22 - 8 * (4 - (Total - Index)), 9, 24);
1042  }
1043  else
1044  {
1045  VidBufferToScreenBlt(RotBarBuffer, X + ((Index - 2) * 8), Y, 22, 9, 24);
1046  }
1047  }
1048  Index++;
1049  }
1050  else if (RotBarSelection == RB_PROGRESS_BAR)
1051  {
1052  Delay.QuadPart = -600000; // 60 ms
1053  Total = SCREEN_WIDTH;
1054  Index %= Total;
1055 
1056  /* Right part */
1058  if (Index > 0)
1059  {
1060  /* Left part */
1062  }
1063  Index += 32;
1064  }
1065 
1066  InbvReleaseLock();
1067  }
1068 
1070 }
#define Y(I)
static UCHAR RotBarBuffer[24 *9]
Definition: inbv.c:122
#define SCREEN_HEIGHT
Definition: inbv.c:60
static UCHAR RotLineBuffer[SCREEN_WIDTH *6]
Definition: inbv.c:123
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
#define SCREEN_WIDTH
Definition: inbv.c:59
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static ROT_BAR_STATUS PltRotBarStatus
Definition: inbv.c:121
static ULONG ProgressBarLeft
Definition: inbv.c:90
static const UCHAR Index[8]
Definition: usbohci.c:18
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static ROT_BAR_TYPE RotBarSelection
Definition: inbv.c:120
VOID NTAPI VidSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN UCHAR Color)
Definition: bootvid.c:538
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1144
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
VOID NTAPI VidBufferToScreenBlt(IN PUCHAR Buffer, IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
Definition: bootvid.c:409
unsigned int ULONG
Definition: retypes.h:1
static ULONG ProgressBarTop
Definition: inbv.c:90
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define X(b, s)
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by DisplayBootBitmap().

◆ InbvRotBarInit()

INIT_FUNCTION VOID NTAPI InbvRotBarInit ( VOID  )

Definition at line 1075 of file inbv.c.

1076 {
1078  /* Perform other initialization if needed */
1079 }
static ROT_BAR_STATUS PltRotBarStatus
Definition: inbv.c:121

Referenced by DisplayBootBitmap().

◆ InbvScreenToBufferBlt()

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

Definition at line 834 of file inbv.c.

840 {
841  /* Check if we're installed and we own it */
844  {
845  /* Do the blit */
846  VidScreenToBufferBlt(Buffer, X, Y, Width, Height, Delta);
847  }
848 }
#define Y(I)
Definition: bufpool.h:45
VOID NTAPI VidScreenToBufferBlt(IN PUCHAR Buffer, IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
Definition: bootvid.c:522
static ULONG Delta
Definition: xboxvideo.c:32
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87

Referenced by DisplayBootBitmap().

◆ InbvSetDisplayOwnership()

VOID NTAPI InbvSetDisplayOwnership ( IN BOOLEAN  DisplayOwned)

Definition at line 547 of file inbv.c.

548 {
549  /* Set the new display state */
550  InbvDisplayState = DisplayOwned ? INBV_DISPLAY_STATE_OWNED :
552 }
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86

◆ InbvSetProgressBarCoordinates()

INIT_FUNCTION VOID NTAPI InbvSetProgressBarCoordinates ( IN ULONG  Left,
IN ULONG  Top 
)

Definition at line 853 of file inbv.c.

855 {
856  /* Update the coordinates */
857  ProgressBarLeft = Left;
859 
860  /* Enable the progress bar */
862 }
#define TRUE
Definition: types.h:120
static ULONG ProgressBarLeft
Definition: inbv.c:90
static ULONG ProgressBarTop
Definition: inbv.c:90
static LPHIST_ENTRY Top
Definition: history.c:53
static BOOLEAN ShowProgressBar
Definition: inbv.c:91

Referenced by DisplayBootBitmap().

◆ InbvSetProgressBarSubset()

INIT_FUNCTION VOID NTAPI InbvSetProgressBarSubset ( IN ULONG  Floor,
IN ULONG  Ceiling 
)

Definition at line 867 of file inbv.c.

869 {
870  /* Sanity checks */
871  ASSERT(Floor < Ceiling);
872  ASSERT(Ceiling <= 100);
873 
874  /* Update the progress bar state */
875  InbvProgressState.Floor = Floor * 100;
876  InbvProgressState.Ceiling = Ceiling * 100;
877  InbvProgressState.Bias = (Ceiling * 100) - Floor;
878 }
static INBV_PROGRESS_STATE InbvProgressState
Definition: inbv.c:92
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by InbvDriverInitialize(), and Phase1InitializationDiscard().

◆ InbvSetScrollRegion()

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

Definition at line 684 of file inbv.c.

688 {
689  /* Just call bootvid */
690  VidSetScrollRegion(Left, Top, Right, Bottom);
691 }
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
VOID NTAPI VidSetScrollRegion(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom)
Definition: bootvid.c:373

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

◆ InbvSetTextColor()

VOID NTAPI InbvSetTextColor ( IN ULONG  Color)

Definition at line 695 of file inbv.c.

696 {
697  HEADLESS_CMD_SET_COLOR HeadlessSetColor;
698 
699  /* Set color for EMS port */
700 #ifdef INBV_HEADLESS_COLORS
701  InbvTerminalTextColor = 30 + CGA_TO_ANSI_COLOR(Color);
702 #else
704 #endif
705  HeadlessSetColor.TextColor = InbvTerminalTextColor;
706  HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
708  &HeadlessSetColor,
709  sizeof(HeadlessSetColor),
710  NULL,
711  NULL);
712 
713  /* Update the text color */
715 }
static ULONG InbvTerminalTextColor
Definition: inbv.c:161
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
smooth NULL
Definition: ftsmooth.c:416
ULONG NTAPI VidSetTextColor(IN ULONG Color)
Definition: bootvid.c:338
static ULONG InbvTerminalBkgdColor
Definition: inbv.c:162

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

724 {
725  HEADLESS_CMD_SET_COLOR HeadlessSetColor;
726 
727  /* Make sure we own it */
729  {
730  /* Acquire the lock */
731  InbvAcquireLock();
732 
733  /* Check if we're installed */
735  {
736  /* Call bootvid */
737  VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
738  }
739 
740  /* Set color for EMS port and clear display */
741 #ifdef INBV_HEADLESS_COLORS
742  InbvTerminalBkgdColor = 40 + CGA_TO_ANSI_COLOR(Color);
743 #else
745 #endif
746  HeadlessSetColor.TextColor = InbvTerminalTextColor;
747  HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
749  &HeadlessSetColor,
750  sizeof(HeadlessSetColor),
751  NULL,
752  NULL);
754  NULL, 0,
755  NULL, NULL);
756 
757  /* Release the lock */
758  InbvReleaseLock();
759  }
760 }
static ULONG InbvTerminalTextColor
Definition: inbv.c:161
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI VidSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN UCHAR Color)
Definition: bootvid.c:538
static LPHIST_ENTRY Bottom
Definition: history.c:54
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
static ULONG InbvTerminalBkgdColor
Definition: inbv.c:162
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87
static LPHIST_ENTRY Top
Definition: history.c:53

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

◆ InbvUpdateProgressBar()

INIT_FUNCTION VOID NTAPI InbvUpdateProgressBar ( IN ULONG  Progress)

Definition at line 765 of file inbv.c.

766 {
767  ULONG FillCount, BoundedProgress;
768 
769  /* Make sure the progress bar is enabled, that we own and are installed */
770  if (ShowProgressBar &&
773  {
774  /* Compute fill count */
775  BoundedProgress = (InbvProgressState.Floor / 100) + Progress;
776  FillCount = 121 * (InbvProgressState.Bias * BoundedProgress) / 1000000;
777 
778  /* Acquire the lock */
779  InbvAcquireLock();
780 
781  /* Fill the progress bar */
784  ProgressBarLeft + FillCount,
785  ProgressBarTop + 12,
786  15);
787 
788  /* Release the lock */
789  InbvReleaseLock();
790  }
791 }
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:484
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:462
static ULONG ProgressBarLeft
Definition: inbv.c:90
static INBV_PROGRESS_STATE InbvProgressState
Definition: inbv.c:92
VOID NTAPI VidSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN UCHAR Color)
Definition: bootvid.c:538
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:86
unsigned int ULONG
Definition: retypes.h:1
static ULONG ProgressBarTop
Definition: inbv.c:90
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:87
static BOOLEAN ShowProgressBar
Definition: inbv.c:91

Referenced by InbvIndicateProgress(), and Phase1InitializationDiscard().

◆ NtDisplayString()

NTSTATUS NTAPI NtDisplayString ( IN PUNICODE_STRING  DisplayString)

Definition at line 915 of file inbv.c.

916 {
918  UNICODE_STRING CapturedString;
920  ULONG OemLength;
922 
923  PAGED_CODE();
924 
926 
927  /* We require the TCB privilege */
930 
931  /* Capture the string */
933  if (!NT_SUCCESS(Status))
934  return Status;
935 
936  /* Do not display the string if it is empty */
937  if (CapturedString.Length == 0 || CapturedString.Buffer == NULL)
938  {
940  goto Quit;
941  }
942 
943  /*
944  * Convert the string since INBV understands only ANSI/OEM. Allocate the
945  * string buffer in non-paged pool because INBV passes it down to BOOTVID.
946  * We cannot perform the allocation using RtlUnicodeStringToOemString()
947  * since its allocator uses PagedPool.
948  */
949  OemLength = RtlUnicodeStringToOemSize(&CapturedString);
950  if (OemLength > MAXUSHORT)
951  {
953  goto Quit;
954  }
955  RtlInitEmptyAnsiString((PANSI_STRING)&OemString, NULL, (USHORT)OemLength);
957  if (OemString.Buffer == NULL)
958  {
960  goto Quit;
961  }
962  RtlUnicodeStringToOemString(&OemString, &CapturedString, FALSE);
963 
964  /* Display the string */
966 
967  /* Free the string buffer */
969 
971 
972 Quit:
973  /* Free the captured string */
974  ReleaseCapturedUnicodeString(&CapturedString, PreviousMode);
975 
976  return Status;
977 }
static __inline NTSTATUS ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, IN KPROCESSOR_MODE CurrentMode, IN const UNICODE_STRING *UnsafeSrc)
Definition: probe.h:142
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1561
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
BOOLEAN NTAPI InbvDisplayString(IN PCHAR String)
Definition: inbv.c:572
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:524
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
#define TAG_OSTR
Definition: inbv.c:13
STRING OEM_STRING
Definition: umtypes.h:203
NTSYSAPI DWORD WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING *)
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:228
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
VOID DisplayString(LPWSTR Msg)
Definition: misc.c:211
Status
Definition: gdiplustypes.h:24
const LUID SeTcbPrivilege
Definition: priv.c:28
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define MAXUSHORT
Definition: typedefs.h:81
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2938

Variable Documentation

◆ BootDriverLock

KSPIN_LOCK BootDriverLock
static

Definition at line 84 of file inbv.c.

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

◆ InbvBootDriverInstalled

◆ InbvDisplayDebugStrings

BOOLEAN InbvDisplayDebugStrings = FALSE
static

Definition at line 88 of file inbv.c.

Referenced by InbvDisplayString(), and InbvEnableDisplayString().

◆ InbvDisplayFilter

INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL
static

Definition at line 89 of file inbv.c.

Referenced by InbvDisplayString(), and InbvInstallDisplayStringFilter().

◆ InbvDisplayState

◆ InbvOldIrql

KIRQL InbvOldIrql
static

Definition at line 85 of file inbv.c.

Referenced by InbvAcquireLock(), and InbvReleaseLock().

◆ InbvProgressIndicator

BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}
static

Definition at line 93 of file inbv.c.

Referenced by InbvIndicateProgress().

◆ InbvProgressState

INBV_PROGRESS_STATE InbvProgressState
static

Definition at line 92 of file inbv.c.

Referenced by InbvSetProgressBarSubset(), and InbvUpdateProgressBar().

◆ InbvResetDisplayParameters

INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL
static

Definition at line 94 of file inbv.c.

Referenced by InbvAcquireDisplayOwnership(), and InbvNotifyDisplayOwnershipLost().

◆ InbvTerminalBkgdColor

ULONG InbvTerminalBkgdColor = 40
static

Definition at line 162 of file inbv.c.

Referenced by InbvSetTextColor(), and InbvSolidColorFill().

◆ InbvTerminalTextColor

ULONG InbvTerminalTextColor = 37
static

Definition at line 161 of file inbv.c.

Referenced by InbvSetTextColor(), and InbvSolidColorFill().

◆ MainPalette

RGBQUAD MainPalette[16]
static

Definition at line 177 of file inbv.c.

Referenced by BitBltPalette(), BootLogoFadeIn(), and DisplayBootBitmap().

◆ PltRotBarStatus

ROT_BAR_STATUS PltRotBarStatus = 0
static

Definition at line 121 of file inbv.c.

Referenced by FinalizeBootLogo(), InbvRotationThread(), and InbvRotBarInit().

◆ ProgressBarLeft

ULONG ProgressBarLeft = 0
static

Definition at line 90 of file inbv.c.

Referenced by InbvRotationThread(), InbvSetProgressBarCoordinates(), and InbvUpdateProgressBar().

◆ ProgressBarTop

ULONG ProgressBarTop = 0
static

Definition at line 90 of file inbv.c.

Referenced by InbvRotationThread(), InbvSetProgressBarCoordinates(), and InbvUpdateProgressBar().

◆ ResourceCount

◆ ResourceList

PUCHAR ResourceList[1+IDB_MAX_RESOURCE]
static

Definition at line 96 of file inbv.c.

Referenced by InbvDriverInitialize(), and InbvGetResourceAddress().

◆ RotBarBuffer

UCHAR RotBarBuffer[24 *9]
static

Definition at line 122 of file inbv.c.

Referenced by DisplayBootBitmap(), and InbvRotationThread().

◆ RotBarSelection

ROT_BAR_TYPE RotBarSelection = RB_UNSPECIFIED
static

Definition at line 120 of file inbv.c.

Referenced by DisplayBootBitmap(), and InbvRotationThread().

◆ RotBarThreadActive

BOOLEAN RotBarThreadActive = FALSE
static

Definition at line 119 of file inbv.c.

Referenced by DisplayBootBitmap(), and FinalizeBootLogo().

◆ RotLineBuffer

UCHAR RotLineBuffer[SCREEN_WIDTH *6]
static

Definition at line 123 of file inbv.c.

Referenced by DisplayBootBitmap(), and InbvRotationThread().

◆ ShowProgressBar

BOOLEAN ShowProgressBar = FALSE
static

Definition at line 91 of file inbv.c.

Referenced by DisplayBootBitmap(), InbvSetProgressBarCoordinates(), and InbvUpdateProgressBar().