ReactOS  0.4.12-dev-43-g63b00d8
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  tagRGBQUAD
 
struct  tagBITMAPINFOHEADER
 

Macros

#define NDEBUG
 
#define INBV_ROTBAR_IMPLEMENTED
 
#define ROT_BAR_DEFAULT_MODE   RB_PROGRESS_BAR
 
#define PALETTE_FADE_STEPS   15
 
#define PALETTE_FADE_TIME   (20 * 1000) /* 20 ms */
 

Typedefs

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_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)
 
PVOID NTAPI INIT_FUNCTION FindBitmapResource (IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG ResourceId)
 
BOOLEAN NTAPI INIT_FUNCTION InbvDriverInitialize (IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG Count)
 
VOID NTAPI INIT_FUNCTION 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)
 
VOID NTAPI INIT_FUNCTION 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)
 
VOID NTAPI InbvSetProgressBarCoordinates (IN ULONG Left, IN ULONG Top)
 
VOID NTAPI InbvSetProgressBarSubset (IN ULONG Floor, IN ULONG Ceiling)
 
VOID NTAPI INIT_FUNCTION InbvIndicateProgress (VOID)
 
PUCHAR NTAPI InbvGetResourceAddress (IN ULONG ResourceNumber)
 
NTSTATUS NTAPI NtDisplayString (IN PUNICODE_STRING DisplayString)
 
static VOID NTAPI InbvRotationThread (_In_ PVOID Context)
 
VOID NTAPI INIT_FUNCTION InbvRotBarInit (VOID)
 
VOID NTAPI INIT_FUNCTION DisplayBootBitmap (IN BOOLEAN TextMode)
 
VOID NTAPI INIT_FUNCTION DisplayFilter (PCHAR *String)
 
VOID NTAPI INIT_FUNCTION 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 [640 *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 30 of file inbv.c.

◆ NDEBUG

#define NDEBUG

Definition at line 4 of file inbv.c.

◆ PALETTE_FADE_STEPS

#define PALETTE_FADE_STEPS   15

Definition at line 127 of file inbv.c.

Referenced by BootLogoFadeIn().

◆ PALETTE_FADE_TIME

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

Definition at line 128 of file inbv.c.

Referenced by BootLogoFadeIn().

◆ ROT_BAR_DEFAULT_MODE

#define ROT_BAR_DEFAULT_MODE   RB_PROGRESS_BAR

Definition at line 50 of file inbv.c.

Referenced by DisplayBootBitmap().

Typedef Documentation

◆ BITMAPINFOHEADER

From bootvid/precomp.h

◆ LPRGBQUAD

◆ PBITMAPINFOHEADER

◆ RGBQUAD

◆ ROT_BAR_STATUS

Enumeration Type Documentation

◆ _ROT_BAR_STATUS

Enumerator
RBS_FADEIN 
RBS_ANIMATE 
RBS_STOP_ANIMATE 
RBS_STATUS_MAX 

Definition at line 59 of file inbv.c.

60 {
61  RBS_FADEIN = 1,
enum _ROT_BAR_STATUS ROT_BAR_STATUS

Function Documentation

◆ BootLogoFadeIn()

static VOID BootLogoFadeIn ( VOID  )
static

Definition at line 157 of file inbv.c.

Referenced by DisplayBootBitmap().

158 {
159  UCHAR PaletteBitmapBuffer[sizeof(BITMAPINFOHEADER) + sizeof(MainPalette)];
160  PBITMAPINFOHEADER PaletteBitmap = (PBITMAPINFOHEADER)PaletteBitmapBuffer;
161  LPRGBQUAD Palette = (LPRGBQUAD)(PaletteBitmapBuffer + sizeof(BITMAPINFOHEADER));
162  ULONG Iteration, Index, ClrUsed;
163 
164  LARGE_INTEGER Delay;
165  Delay.QuadPart = - (PALETTE_FADE_TIME * 10);
166 
167  /* Check if we are installed and we own the display */
170  {
171  return;
172  }
173 
174  /*
175  * Build a bitmap containing the fade-in palette. The palette entries
176  * are then processed in a loop and set using VidBitBlt function.
177  */
178  ClrUsed = RTL_NUMBER_OF(MainPalette);
179  RtlZeroMemory(PaletteBitmap, sizeof(BITMAPINFOHEADER));
180  PaletteBitmap->biSize = sizeof(BITMAPINFOHEADER);
181  PaletteBitmap->biBitCount = 4;
182  PaletteBitmap->biClrUsed = ClrUsed;
183 
184  /*
185  * Main animation loop.
186  */
187  for (Iteration = 0; Iteration <= PALETTE_FADE_STEPS; ++Iteration)
188  {
189  for (Index = 0; Index < ClrUsed; Index++)
190  {
191  Palette[Index].rgbRed = (UCHAR)
192  (MainPalette[Index].rgbRed * Iteration / PALETTE_FADE_STEPS);
193  Palette[Index].rgbGreen = (UCHAR)
194  (MainPalette[Index].rgbGreen * Iteration / PALETTE_FADE_STEPS);
195  Palette[Index].rgbBlue = (UCHAR)
196  (MainPalette[Index].rgbBlue * Iteration / PALETTE_FADE_STEPS);
197  }
198 
199  /* Do the animation */
200  InbvAcquireLock();
201  VidBitBlt(PaletteBitmapBuffer, 0, 0);
202  InbvReleaseLock();
203 
204  /* Wait for a bit */
206  }
207 }
struct tagBITMAPINFOHEADER * PBITMAPINFOHEADER
USHORT biBitCount
Definition: precomp.h:25
#define PALETTE_FADE_STEPS
Definition: inbv.c:127
#define PALETTE_FADE_TIME
Definition: inbv.c:128
UCHAR rgbBlue
Definition: inbv.c:118
UCHAR rgbGreen
Definition: inbv.c:119
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
UCHAR rgbRed
Definition: inbv.c:120
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:320
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:34
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35
static RGBQUAD MainPalette[16]
Definition: inbv.c:125
LONGLONG QuadPart
Definition: typedefs.h:112
struct tagRGBQUAD * LPRGBQUAD

◆ DisplayBootBitmap()

VOID NTAPI INIT_FUNCTION DisplayBootBitmap ( IN BOOLEAN  TextMode)

Definition at line 891 of file inbv.c.

Referenced by DisplayFilter(), and Phase1InitializationDiscard().

892 {
893  PVOID Header = NULL, Footer = NULL, Screen = NULL;
894 
895 #ifdef INBV_ROTBAR_IMPLEMENTED
896  UCHAR Buffer[24 * 9];
897  PVOID Bar = NULL, LineBmp = NULL;
898  ROT_BAR_TYPE TempRotBarSelection = RB_UNSPECIFIED;
900  HANDLE ThreadHandle = NULL;
901 #endif
902 
903 #ifdef REACTOS_SKUS
904  PVOID Text = NULL;
905 #endif
906 
907 #ifdef INBV_ROTBAR_IMPLEMENTED
908  /* Check if the animation thread has already been created */
909  if (RotBarThreadActive)
910  {
911  /* Yes, just reset the progress bar but keep the thread alive */
912  InbvAcquireLock();
914  InbvReleaseLock();
915  }
916 #endif
917 
919 
920  /* Check if this is text mode */
921  if (TextMode)
922  {
923  /* Check the type of the OS: workstation or server */
924  if (SharedUserData->NtProductType == NtProductWinNt)
925  {
926  /* Workstation; set colors */
927  InbvSetTextColor(15);
928  InbvSolidColorFill(0, 0, 639, 479, 7);
929  InbvSolidColorFill(0, 421, 639, 479, 1);
930 
931  /* Get resources */
934  }
935  else
936  {
937  /* Server; set colors */
938  InbvSetTextColor(14);
939  InbvSolidColorFill(0, 0, 639, 479, 6);
940  InbvSolidColorFill(0, 421, 639, 479, 1);
941 
942  /* Get resources */
945  }
946 
947  /* Set the scrolling region */
948  InbvSetScrollRegion(32, 80, 631, 400);
949 
950  /* Make sure we have resources */
951  if (Header && Footer)
952  {
953  /* BitBlt them on the screen */
954  InbvBitBlt(Footer, 0, 419);
955  InbvBitBlt(Header, 0, 0);
956  }
957  }
958  else
959  {
960  /* Is the boot driver installed? */
961  if (!InbvBootDriverInstalled) return;
962 
963  /* Load the standard boot screen */
965 
966 #ifdef REACTOS_SKUS
967  Text = NULL;
968  if (SharedUserData->NtProductType == NtProductWinNt)
969  {
970 #ifdef INBV_ROTBAR_IMPLEMENTED
971  /* Workstation product, use appropriate status bar color */
973 #endif
974  }
975  else
976  {
977  /* Display correct branding based on server suite */
979  {
980  /* Storage Server Edition */
982  }
983  else if (ExVerifySuite(ComputeServer))
984  {
985  /* Compute Cluster Edition */
987  }
988  else
989  {
990  /* Normal edition */
992  }
993 
994 #ifdef INBV_ROTBAR_IMPLEMENTED
995  /* Server product, use appropriate status bar color */
997 #endif
998  }
999 #else
1000  /* Use default status bar */
1002 #endif
1003 
1004  /* Make sure we have a logo */
1005  if (Screen)
1006  {
1007  PBITMAPINFOHEADER BitmapInfoHeader;
1008  LPRGBQUAD Palette;
1009 
1010  /*
1011  * Save the main image palette and replace it with black palette,
1012  * so that we can do fade-in effect later.
1013  */
1014  BitmapInfoHeader = (PBITMAPINFOHEADER)Screen;
1015  Palette = (LPRGBQUAD)((PUCHAR)Screen + BitmapInfoHeader->biSize);
1016  RtlCopyMemory(MainPalette, Palette, sizeof(MainPalette));
1017  RtlZeroMemory(Palette, sizeof(MainPalette));
1018 
1019  /* Blit the background */
1020  InbvBitBlt(Screen, 0, 0);
1021 
1022 #ifdef INBV_ROTBAR_IMPLEMENTED
1023  /* Choose progress bar */
1024  TempRotBarSelection = ROT_BAR_DEFAULT_MODE;
1025 #endif
1026 
1027  /* Set progress bar coordinates and display it */
1029 
1030 #ifdef REACTOS_SKUS
1031  /* Check for non-workstation products */
1032  if (SharedUserData->NtProductType != NtProductWinNt)
1033  {
1034  /* Overwrite part of the logo for a server product */
1035  InbvScreenToBufferBlt(Buffer, 413, 237, 7, 7, 8);
1036  InbvSolidColorFill(418, 230, 454, 256, 0);
1037  InbvBufferToScreenBlt(Buffer, 413, 237, 7, 7, 8);
1038 
1039  /* In setup mode, you haven't selected a SKU yet */
1040  if (ExpInTextModeSetup) Text = NULL;
1041  }
1042 #endif
1043  }
1044 
1045 #ifdef REACTOS_SKUS
1046  /* Draw the SKU text if it exits */
1047  if (Text) InbvBitBlt(Text, 180, 121);
1048 #endif
1049 
1050 #ifdef INBV_ROTBAR_IMPLEMENTED
1051  if (Bar)
1052  {
1053  /* Save previous screen pixels to buffer */
1054  InbvScreenToBufferBlt(Buffer, 0, 0, 22, 9, 24);
1055  /* Draw the progress bar bit */
1056  InbvBitBlt(Bar, 0, 0);
1057  /* Store it in global buffer */
1058  InbvScreenToBufferBlt(RotBarBuffer, 0, 0, 22, 9, 24);
1059  /* Restore screen pixels */
1060  InbvBufferToScreenBlt(Buffer, 0, 0, 22, 9, 24);
1061  }
1062 
1063  /*
1064  * Add a rotating bottom horizontal bar when using a progress bar,
1065  * to show that ReactOS can be still alive when the bar does not
1066  * appear to progress.
1067  */
1068  if (TempRotBarSelection == RB_PROGRESS_BAR)
1069  {
1071  if (LineBmp)
1072  {
1073  /* Draw the line and store it in global buffer */
1074  InbvBitBlt(LineBmp, 0, 474);
1075  InbvScreenToBufferBlt(RotLineBuffer, 0, 474, 640, 6, 640);
1076  }
1077  }
1078  else
1079  {
1080  /* Hide the simple progress bar if not used */
1082  }
1083 #endif
1084 
1085  /* Display the boot logo and fade it in */
1086  BootLogoFadeIn();
1087 
1088 #ifdef INBV_ROTBAR_IMPLEMENTED
1089  if (!RotBarThreadActive && TempRotBarSelection != RB_UNSPECIFIED)
1090  {
1091  /* Start the animation thread */
1092  Status = PsCreateSystemThread(&ThreadHandle,
1093  0,
1094  NULL,
1095  NULL,
1096  NULL,
1098  NULL);
1099  if (NT_SUCCESS(Status))
1100  {
1101  /* The thread has started, close the handle as we don't need it */
1103  ObCloseHandle(ThreadHandle, KernelMode);
1104  }
1105  }
1106 #endif
1107 
1108  /* Set filter which will draw text display if needed */
1110  }
1111 
1112 #ifdef INBV_ROTBAR_IMPLEMENTED
1113  /* Do we have the animation thread? */
1114  if (RotBarThreadActive)
1115  {
1116  /* We do, initialize the progress bar */
1117  InbvAcquireLock();
1118  RotBarSelection = TempRotBarSelection;
1119  InbvRotBarInit();
1120  InbvReleaseLock();
1121 
1122  // FIXME: This was added to allow animation start before the processor hangs
1123  if (TempRotBarSelection != RB_UNSPECIFIED)
1124  {
1125  LARGE_INTEGER Delay;
1126  Delay.QuadPart = -3000000; // 300 ms
1128  }
1129  }
1130 #endif
1131 }
VOID NTAPI InbvSetProgressBarCoordinates(IN ULONG Left, IN ULONG Top)
Definition: inbv.c:711
#define IDB_SERVER_FOOTER
Definition: resource.h:22
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct tagBITMAPINFOHEADER * PBITMAPINFOHEADER
static VOID BootLogoFadeIn(VOID)
Definition: inbv.c:157
#define IDB_BAR_SERVER
Definition: resource.h:10
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:654
VOID NTAPI InbvSolidColorFill(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom, IN ULONG Color)
Definition: inbv.c:578
enum _ROT_BAR_TYPE ROT_BAR_TYPE
VOID NTAPI INIT_FUNCTION DisplayFilter(PCHAR *String)
Definition: inbv.c:1136
BOOLEAN NTAPI ExVerifySuite(SUITE_TYPE SuiteType)
Definition: sysinfo.c:377
static UCHAR RotBarBuffer[24 *9]
Definition: inbv.c:70
#define IDB_BOOT_SCREEN
Definition: resource.h:3
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
Definition: Header.h:8
static UCHAR RotLineBuffer[640 *6]
Definition: inbv.c:71
#define IDB_SERVER_LOGO
Definition: resource.h:20
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
Definition: bufpool.h:45
VOID NTAPI InbvSetTextColor(IN ULONG Color)
Definition: inbv.c:554
#define IDB_STORAGE_SERVER
Definition: resource.h:23
static VOID NTAPI InbvRotationThread(_In_ PVOID Context)
Definition: inbv.c:789
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#define ROT_BAR_DEFAULT_MODE
Definition: inbv.c:50
#define SharedUserData
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3370
static ROT_BAR_TYPE RotBarSelection
Definition: inbv.c:68
Status
Definition: gdiplustypes.h:24
BOOLEAN ExpInTextModeSetup
Definition: init.c:66
VOID NTAPI INIT_FUNCTION InbvRotBarInit(VOID)
Definition: inbv.c:881
#define IDB_WKSTA_FOOTER
Definition: resource.h:8
static BOOLEAN RotBarThreadActive
Definition: inbv.c:67
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:672
VOID NTAPI InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
Definition: inbv.c:484
VOID NTAPI InbvScreenToBufferBlt(IN PUCHAR Buffer, IN ULONG X, IN ULONG Y, IN ULONG Width, IN ULONG Height, IN ULONG Delta)
Definition: inbv.c:693
#define IDB_ROTATING_LINE
Definition: resource.h:13
#define IDB_BAR_WKSTA
Definition: resource.h:11
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
Definition: console.h:34
PUCHAR NTAPI InbvGetResourceAddress(IN ULONG ResourceNumber)
Definition: inbv.c:761
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35
VOID NTAPI InbvSetScrollRegion(IN ULONG Left, IN ULONG Top, IN ULONG Right, IN ULONG Bottom)
Definition: inbv.c:543
static RGBQUAD MainPalette[16]
Definition: inbv.c:125
#define IDB_CLUSTER_SERVER
Definition: resource.h:24
static BOOLEAN ShowProgressBar
Definition: inbv.c:39
#define IDB_WKSTA_HEADER
Definition: resource.h:7
char * Text
Definition: combotst.c:136
#define IDB_SERVER_HEADER
Definition: resource.h:21
LONGLONG QuadPart
Definition: typedefs.h:112
struct tagRGBQUAD * LPRGBQUAD

◆ DisplayFilter()

VOID NTAPI INIT_FUNCTION DisplayFilter ( PCHAR String)

Definition at line 1136 of file inbv.c.

Referenced by DisplayBootBitmap().

1137 {
1138  /* Windows hack to skip first dots */
1139  static BOOLEAN DotHack = TRUE;
1140 
1141  /* If "." is given set *String to empty string */
1142  if(DotHack && strcmp(*String, ".") == 0)
1143  *String = "";
1144 
1145  if(**String)
1146  {
1147  /* Remove the filter */
1149 
1150  DotHack = FALSE;
1151 
1152  /* Draw text screen */
1154  }
1155 }
#define TRUE
Definition: types.h:120
static WCHAR String[]
Definition: stringtable.c:55
VOID NTAPI INIT_FUNCTION DisplayBootBitmap(IN BOOLEAN TextMode)
Definition: inbv.c:891
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI InbvInstallDisplayStringFilter(IN INBV_DISPLAY_STRING_FILTER Filter)
Definition: inbv.c:484
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ FinalizeBootLogo()

VOID NTAPI INIT_FUNCTION FinalizeBootLogo ( VOID  )

Definition at line 1160 of file inbv.c.

Referenced by Phase1InitializationDiscard().

1161 {
1162  /* Acquire lock and check the display state */
1163  InbvAcquireLock();
1165  {
1166  /* Clear the screen */
1167  VidSolidColorFill(0, 0, 639, 479, 0);
1168  }
1169 
1170  /* Reset progress bar and lock */
1171 #ifdef INBV_ROTBAR_IMPLEMENTED
1174 #endif
1175  InbvReleaseLock();
1176 }
INBV_DISPLAY_STATE NTAPI InbvGetDisplayState(VOID)
Definition: inbv.c:423
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
static ROT_BAR_STATUS PltRotBarStatus
Definition: inbv.c:69
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:67

◆ FindBitmapResource()

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

Definition at line 214 of file inbv.c.

Referenced by InbvDriverInitialize().

216 {
217  UNICODE_STRING UpString = RTL_CONSTANT_STRING(L"ntoskrnl.exe");
218  UNICODE_STRING MpString = RTL_CONSTANT_STRING(L"ntkrnlmp.exe");
219  PLIST_ENTRY NextEntry, ListHead;
220  PLDR_DATA_TABLE_ENTRY LdrEntry;
221  PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
222  LDR_RESOURCE_INFO ResourceInfo;
224  PVOID Data = NULL;
225 
226  /* Loop the driver list */
227  ListHead = &LoaderBlock->LoadOrderListHead;
228  NextEntry = ListHead->Flink;
229  while (NextEntry != ListHead)
230  {
231  /* Get the entry */
232  LdrEntry = CONTAINING_RECORD(NextEntry,
234  InLoadOrderLinks);
235 
236  /* Check for a match */
237  if (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE) ||
238  RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE))
239  {
240  /* Break out */
241  break;
242  }
243  }
244 
245  /* Check if we found it */
246  if (NextEntry != ListHead)
247  {
248  /* Try to find the resource */
249  ResourceInfo.Type = 2; // RT_BITMAP;
250  ResourceInfo.Name = ResourceId;
251  ResourceInfo.Language = 0;
252  Status = LdrFindResource_U(LdrEntry->DllBase,
253  &ResourceInfo,
255  &ResourceDataEntry);
256  if (NT_SUCCESS(Status))
257  {
258  /* Access the resource */
259  ULONG Size = 0;
260  Status = LdrAccessResource(LdrEntry->DllBase,
261  ResourceDataEntry,
262  &Data,
263  &Size);
264  if ((Data) && (ResourceId < 3))
265  {
266  KiBugCheckData[4] ^= RtlComputeCrc32(0, Data, Size);
267  }
268  if (!NT_SUCCESS(Status)) Data = NULL;
269  }
270  }
271 
272  /* Return the pointer */
273  return Data;
274 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
ULONG_PTR Type
Definition: ldrtypes.h:179
PVOID DllBase
Definition: btrfs_drv.h:1766
ULONG_PTR Name
Definition: ldrtypes.h:180
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:24
ULONG_PTR KiBugCheckData[5]
Definition: bug.c:30
static const WCHAR L[]
Definition: oid.c:1087
Definition: btrfs_drv.h:1762
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:143
ULONG_PTR Language
Definition: ldrtypes.h:181
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

◆ InbvAcquireDisplayOwnership()

VOID NTAPI InbvAcquireDisplayOwnership ( VOID  )

Definition at line 390 of file inbv.c.

Referenced by HalHandleNMI(), HalReturnToFirmware(), KdbpInternalEnter(), KdpScreenInit(), KiDisplayBlueScreen(), and PopShutdownHandler().

391 {
392  /* Check if we have a callback and we're just acquiring it now */
395  {
396  /* Call the callback */
398  }
399 
400  /* Acquire the display */
402 }
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters
Definition: inbv.c:42
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34

◆ InbvAcquireLock()

VOID NTAPI InbvAcquireLock ( VOID  )

Definition at line 320 of file inbv.c.

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

321 {
322  KIRQL OldIrql;
323 
324  /* Check if we're at dispatch level or lower */
325  OldIrql = KeGetCurrentIrql();
326  if (OldIrql <= DISPATCH_LEVEL)
327  {
328  /* Loop until the lock is free */
329  while (!KeTestSpinLock(&BootDriverLock));
330 
331  /* Raise IRQL to dispatch level */
332  KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
333  }
334 
335  /* Acquire the lock */
338 }
#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:33
_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:32

◆ InbvBitBlt()

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

Definition at line 672 of file inbv.c.

Referenced by DisplayBootBitmap(), and PopShutdownHandler().

675 {
676  /* Check if we're installed and we own it */
679  {
680  /* Acquire the lock */
681  InbvAcquireLock();
682 
683  /* Do the blit */
684  VidBitBlt(Buffer, X, Y);
685 
686  /* Release the lock */
687  InbvReleaseLock();
688  }
689 }
#define Y(i)
Definition: t_vb_render.c:49
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
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:34
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

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

Referenced by DisplayBootBitmap().

660 {
661  /* Check if we're installed and we own it */
664  {
665  /* Do the blit */
666  VidBufferToScreenBlt(Buffer, X, Y, Width, Height, Delta);
667  }
668 }
#define Y(i)
Definition: t_vb_render.c:49
Definition: bufpool.h:45
static ULONG Delta
Definition: xboxvideo.c:28
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34
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:35

◆ InbvCheckDisplayOwnership()

BOOLEAN NTAPI InbvCheckDisplayOwnership ( VOID  )

Definition at line 415 of file inbv.c.

Referenced by KdbpInternalEnter(), PopShutdownHandler(), ScrCreate(), ScrIoControl(), and ScrWrite().

416 {
417  /* Return if we own it or not */
419 }
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34

◆ InbvDisplayString()

BOOLEAN NTAPI InbvDisplayString ( IN PCHAR  String)

Definition at line 431 of file inbv.c.

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

432 {
433  /* Make sure we own the display */
435  {
436  /* If we're not allowed, return success anyway */
437  if (!InbvDisplayDebugStrings) return TRUE;
438 
439  /* Check if a filter is installed */
441 
442  /* Acquire the lock */
443  InbvAcquireLock();
444 
445  /* Make sure we're installed and display the string */
447 
448  /* Print the string on the EMS port */
450  String,
451  strlen(String) + sizeof(ANSI_NULL),
452  NULL,
453  NULL);
454 
455  /* Release the lock */
456  InbvReleaseLock();
457 
458  /* All done */
459  return TRUE;
460  }
461 
462  /* We don't own it, fail */
463  return FALSE;
464 }
#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:342
#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:36
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter
Definition: inbv.c:37
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

◆ InbvDriverInitialize()

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

Definition at line 279 of file inbv.c.

Referenced by Phase1InitializationDiscard().

281 {
282  PCHAR CommandLine;
283  BOOLEAN ResetMode = FALSE; // By default do not reset the video mode
284  ULONG i;
285 
286  /* Quit if we're already installed */
287  if (InbvBootDriverInstalled) return TRUE;
288 
289  /* Initialize the lock and check the current display state */
292  {
293  /* Reset the video mode in case we do not have a custom boot logo */
294  CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
295  ResetMode = (CommandLine == NULL) || (strstr(CommandLine, "BOOTLOGO") == NULL);
296  }
297 
298  /* Initialize the video */
301  {
302  /* Find bitmap resources in the kernel */
304  for (i = 1; i <= ResourceCount; i++)
305  {
306  /* Do the lookup */
307  ResourceList[i] = FindBitmapResource(LoaderBlock, i);
308  }
309 
310  /* Set the progress bar ranges */
311  InbvSetProgressBarSubset(0, 100);
312  }
313 
314  /* Return install state */
316 }
signed char * PCHAR
Definition: retypes.h:7
VOID NTAPI InbvSetProgressBarSubset(IN ULONG Floor, IN ULONG Ceiling)
Definition: inbv.c:724
#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
PVOID NTAPI INIT_FUNCTION FindBitmapResource(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG ResourceId)
Definition: inbv.c:214
static PUCHAR ResourceList[1+IDB_MAX_RESOURCE]
Definition: inbv.c:44
GLenum GLclampf GLint i
Definition: glfuncs.h:14
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static ULONG ResourceCount
Definition: inbv.c:43
_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:34
unsigned int ULONG
Definition: retypes.h:1
static KSPIN_LOCK BootDriverLock
Definition: inbv.c:32
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

◆ InbvEnableBootDriver()

VOID NTAPI INIT_FUNCTION InbvEnableBootDriver ( IN BOOLEAN  Enable)

Definition at line 359 of file inbv.c.

Referenced by Phase1InitializationDiscard().

360 {
361  /* Check if we're installed */
363  {
364  /* Check for lost state */
366 
367  /* Acquire the lock */
368  InbvAcquireLock();
369 
370  /* Cleanup the screen if we own it */
372 
373  /* Set the new display state */
376 
377  /* Release the lock */
378  InbvReleaseLock();
379  }
380  else
381  {
382  /* Set the new display state */
385  }
386 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:398
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

◆ InbvEnableDisplayString()

BOOLEAN NTAPI InbvEnableDisplayString ( IN BOOLEAN  Enable)

Definition at line 468 of file inbv.c.

Referenced by HalHandleNMI(), KdbpInternalEnter(), KdpScreenInit(), KiDisplayBlueScreen(), Phase1InitializationDiscard(), and PopShutdownHandler().

469 {
470  BOOLEAN OldSetting;
471 
472  /* Get the old setting */
473  OldSetting = InbvDisplayDebugStrings;
474 
475  /* Update it */
477 
478  /* Return the old setting */
479  return OldSetting;
480 }
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
unsigned char BOOLEAN
static BOOLEAN InbvDisplayDebugStrings
Definition: inbv.c:36

◆ InbvGetDisplayState()

INBV_DISPLAY_STATE NTAPI InbvGetDisplayState ( VOID  )

Definition at line 423 of file inbv.c.

Referenced by FinalizeBootLogo().

424 {
425  /* Return the actual state */
426  return InbvDisplayState;
427 }
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34

◆ InbvGetResourceAddress()

PUCHAR NTAPI InbvGetResourceAddress ( IN ULONG  ResourceNumber)

Definition at line 761 of file inbv.c.

Referenced by DisplayBootBitmap(), and PopShutdownHandler().

762 {
763  /* Validate the resource number */
764  if (ResourceNumber > ResourceCount) return NULL;
765 
766  /* Return the address */
767  return ResourceList[ResourceNumber];
768 }
static PUCHAR ResourceList[1+IDB_MAX_RESOURCE]
Definition: inbv.c:44
smooth NULL
Definition: ftsmooth.c:416
static ULONG ResourceCount
Definition: inbv.c:43

◆ InbvIndicateProgress()

VOID NTAPI INIT_FUNCTION InbvIndicateProgress ( VOID  )

Definition at line 740 of file inbv.c.

Referenced by IopInitializeBuiltinDriver(), and IopInitializeSystemDrivers().

741 {
742  ULONG Percentage;
743 
744  /* Increase progress */
746 
747  /* Compute new percentage */
748  Percentage = min(100 * InbvProgressIndicator.Count /
750  99);
751  if (Percentage != InbvProgressIndicator.Percentage)
752  {
753  /* Percentage has moved, update the progress bar */
754  InbvProgressIndicator.Percentage = Percentage;
755  InbvUpdateProgressBar(Percentage);
756  }
757 }
static BT_PROGRESS_INDICATOR InbvProgressIndicator
Definition: inbv.c:41
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI INIT_FUNCTION InbvUpdateProgressBar(IN ULONG Progress)
Definition: inbv.c:624

◆ InbvInstallDisplayStringFilter()

VOID NTAPI InbvInstallDisplayStringFilter ( IN INBV_DISPLAY_STRING_FILTER  Filter)

Definition at line 484 of file inbv.c.

Referenced by DisplayBootBitmap(), DisplayFilter(), HalHandleNMI(), KdbpInternalEnter(), KdpScreenInit(), and KiDisplayBlueScreen().

485 {
486  /* Save the filter */
488 }
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter
Definition: inbv.c:37

◆ InbvIsBootDriverInstalled()

BOOLEAN NTAPI InbvIsBootDriverInstalled ( VOID  )

Definition at line 492 of file inbv.c.

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

493 {
494  /* Return driver state */
496 }
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

◆ InbvNotifyDisplayOwnershipLost()

VOID NTAPI InbvNotifyDisplayOwnershipLost ( IN INBV_RESET_DISPLAY_PARAMETERS  Callback)

Definition at line 500 of file inbv.c.

Referenced by IntVideoPortDispatchClose(), IntVideoPortDispatchWrite(), and Phase1InitializationDiscard().

501 {
502  /* Check if we're installed */
504  {
505  /* Acquire the lock and cleanup if we own the screen */
506  InbvAcquireLock();
508 
509  /* Set the reset callback and display state */
512 
513  /* Release the lock */
514  InbvReleaseLock();
515  }
516  else
517  {
518  /* Set the reset callback and display state */
521  }
522 }
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters
Definition: inbv.c:42
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:398
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35
LPFNPSPCALLBACK Callback
Definition: desk.c:111

◆ InbvReleaseLock()

VOID NTAPI InbvReleaseLock ( VOID  )

Definition at line 342 of file inbv.c.

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

343 {
344  KIRQL OldIrql;
345 
346  /* Capture the old IRQL */
347  OldIrql = InbvOldIrql;
348 
349  /* Release the driver lock */
351 
352  /* If we were at dispatch level or lower, restore the old IRQL */
353  if (InbvOldIrql <= DISPATCH_LEVEL) KeLowerIrql(OldIrql);
354 }
#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:33
_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:32

◆ InbvResetDisplay()

BOOLEAN NTAPI InbvResetDisplay ( VOID  )

Definition at line 526 of file inbv.c.

Referenced by HalHandleNMI(), KdbpInternalEnter(), KdpScreenInit(), KiDisplayBlueScreen(), and PopShutdownHandler().

527 {
528  /* Check if we're installed and we own it */
531  {
532  /* Do the reset */
534  return TRUE;
535  }
536 
537  /* Nothing to reset */
538  return FALSE;
539 }
#define TRUE
Definition: types.h:120
VOID NTAPI VidResetDisplay(IN BOOLEAN HalReset)
Definition: bootvid.c:313
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

◆ InbvRotationThread()

static VOID NTAPI InbvRotationThread ( _In_ PVOID  Context)
static

Definition at line 789 of file inbv.c.

Referenced by DisplayBootBitmap().

791 {
792  ULONG X, Y, Index, Total;
793  LARGE_INTEGER Delay = {{0}};
794 
795  InbvAcquireLock();
797  {
798  Index = 0;
799  }
800  else
801  {
802  Index = 32;
803  }
804  X = ProgressBarLeft + 2;
805  Y = ProgressBarTop + 2;
806  InbvReleaseLock();
807 
809  {
810  /* Wait for a bit */
812 
813  InbvAcquireLock();
814 
815  /* Unknown unexpected command */
817 
819  {
820  /* Stop the thread */
821  InbvReleaseLock();
822  break;
823  }
824 
826  {
827  Delay.QuadPart = -800000; // 80 ms
828  Total = 18;
829  Index %= Total;
830 
831  if (Index >= 3)
832  {
833  /* Fill previous bar position */
834  VidSolidColorFill(X + ((Index - 3) * 8), Y, (X + ((Index - 3) * 8)) + 8 - 1, Y + 9 - 1, 0);
835  }
836  if (Index < Total - 1)
837  {
838  /* Draw the progress bar bit */
839  if (Index < 2)
840  {
841  /* Appearing from the left */
842  VidBufferToScreenBlt(RotBarBuffer + 8 * (2 - Index) / 2, X, Y, 22 - 8 * (2 - Index), 9, 24);
843  }
844  else if (Index >= Total - 3)
845  {
846  /* Hiding to the right */
847  VidBufferToScreenBlt(RotBarBuffer, X + ((Index - 2) * 8), Y, 22 - 8 * (4 - (Total - Index)), 9, 24);
848  }
849  else
850  {
851  VidBufferToScreenBlt(RotBarBuffer, X + ((Index - 2) * 8), Y, 22, 9, 24);
852  }
853  }
854  Index++;
855  }
856  else if (RotBarSelection == RB_PROGRESS_BAR)
857  {
858  Delay.QuadPart = -600000; // 60 ms
859  Total = 640;
860  Index %= Total;
861 
862  /* Right part */
863  VidBufferToScreenBlt(RotLineBuffer, Index, 474, 640 - Index, 6, 640);
864  if (Index > 0)
865  {
866  /* Left part */
867  VidBufferToScreenBlt(RotLineBuffer + (640 - Index) / 2, 0, 474, Index - 2, 6, 640);
868  }
869  Index += 32;
870  }
871 
872  InbvReleaseLock();
873  }
874 
876 }
#define Y(i)
Definition: t_vb_render.c:49
static UCHAR RotBarBuffer[24 *9]
Definition: inbv.c:70
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
static UCHAR RotLineBuffer[640 *6]
Definition: inbv.c:71
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:320
static ROT_BAR_STATUS PltRotBarStatus
Definition: inbv.c:69
static ULONG ProgressBarLeft
Definition: inbv.c:38
static const UCHAR Index[8]
Definition: usbohci.c:18
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static ROT_BAR_TYPE RotBarSelection
Definition: inbv.c:68
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:34
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:38
return STATUS_SUCCESS
Definition: btrfs.c:2710
#define X(b, s)
LONGLONG QuadPart
Definition: typedefs.h:112

◆ InbvRotBarInit()

VOID NTAPI INIT_FUNCTION InbvRotBarInit ( VOID  )

Definition at line 881 of file inbv.c.

Referenced by DisplayBootBitmap().

882 {
884  /* Perform other initialization if needed */
885 }
static ROT_BAR_STATUS PltRotBarStatus
Definition: inbv.c:69

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

Referenced by DisplayBootBitmap().

699 {
700  /* Check if we're installed and we own it */
703  {
704  /* Do the blit */
705  VidScreenToBufferBlt(Buffer, X, Y, Width, Height, Delta);
706  }
707 }
#define Y(i)
Definition: t_vb_render.c:49
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:28
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35

◆ InbvSetDisplayOwnership()

VOID NTAPI InbvSetDisplayOwnership ( IN BOOLEAN  DisplayOwned)

Definition at line 406 of file inbv.c.

407 {
408  /* Set the new display state */
409  InbvDisplayState = DisplayOwned ? INBV_DISPLAY_STATE_OWNED :
411 }
static INBV_DISPLAY_STATE InbvDisplayState
Definition: inbv.c:34

◆ InbvSetProgressBarCoordinates()

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

Definition at line 711 of file inbv.c.

Referenced by DisplayBootBitmap().

713 {
714  /* Update the coordinates */
715  ProgressBarLeft = Left;
717 
718  /* Enable the progress bar */
720 }
#define TRUE
Definition: types.h:120
static ULONG ProgressBarLeft
Definition: inbv.c:38
static ULONG ProgressBarTop
Definition: inbv.c:38
static LPHIST_ENTRY Top
Definition: history.c:53
static BOOLEAN ShowProgressBar
Definition: inbv.c:39

◆ InbvSetProgressBarSubset()

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

Definition at line 724 of file inbv.c.

Referenced by InbvDriverInitialize(), and Phase1InitializationDiscard().

726 {
727  /* Sanity checks */
728  ASSERT(Floor < Ceiling);
729  ASSERT(Ceiling <= 100);
730 
731  /* Update the progress bar state */
732  InbvProgressState.Floor = Floor * 100;
733  InbvProgressState.Ceiling = Ceiling * 100;
734  InbvProgressState.Bias = (Ceiling * 100) - Floor;
735 }
static INBV_PROGRESS_STATE InbvProgressState
Definition: inbv.c:40
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Ceiling
Definition: inbv.h:6

◆ InbvSetScrollRegion()

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

Definition at line 543 of file inbv.c.

Referenced by DisplayBootBitmap(), HalHandleNMI(), KdbpInternalEnter(), KdpScreenInit(), KiDisplayBlueScreen(), and PopShutdownHandler().

547 {
548  /* Just call bootvid */
549  VidSetScrollRegion(Left, Top, Right, Bottom);
550 }
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

◆ InbvSetTextColor()

VOID NTAPI InbvSetTextColor ( IN ULONG  Color)

Definition at line 554 of file inbv.c.

Referenced by DisplayBootBitmap(), HalHandleNMI(), KdbpInternalEnter(), KdpScreenInit(), and KiDisplayBlueScreen().

555 {
556  HEADLESS_CMD_SET_COLOR HeadlessSetColor;
557 
558  /* Set color for EMS port */
559 #ifdef INBV_HEADLESS_COLORS
560  InbvTerminalTextColor = 30 + CGA_TO_ANSI_COLOR(Color);
561 #else
563 #endif
564  HeadlessSetColor.TextColor = InbvTerminalTextColor;
565  HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
567  &HeadlessSetColor,
568  sizeof(HeadlessSetColor),
569  NULL,
570  NULL);
571 
572  /* Update the text color */
574 }
static ULONG InbvTerminalTextColor
Definition: inbv.c:109
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:110

◆ InbvSolidColorFill()

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

Definition at line 578 of file inbv.c.

Referenced by DisplayBootBitmap(), HalHandleNMI(), KdbpInternalEnter(), KdpScreenInit(), KiDisplayBlueScreen(), and PopShutdownHandler().

583 {
584  HEADLESS_CMD_SET_COLOR HeadlessSetColor;
585 
586  /* Make sure we own it */
588  {
589  /* Acquire the lock */
590  InbvAcquireLock();
591 
592  /* Check if we're installed */
594  {
595  /* Call bootvid */
596  VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
597  }
598 
599  /* Set color for EMS port and clear display */
600 #ifdef INBV_HEADLESS_COLORS
601  InbvTerminalBkgdColor = 40 + CGA_TO_ANSI_COLOR(Color);
602 #else
604 #endif
605  HeadlessSetColor.TextColor = InbvTerminalTextColor;
606  HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
608  &HeadlessSetColor,
609  sizeof(HeadlessSetColor),
610  NULL,
611  NULL);
613  NULL, 0,
614  NULL, NULL);
615 
616  /* Release the lock */
617  InbvReleaseLock();
618  }
619 }
static ULONG InbvTerminalTextColor
Definition: inbv.c:109
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:342
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
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:34
static ULONG InbvTerminalBkgdColor
Definition: inbv.c:110
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35
static LPHIST_ENTRY Top
Definition: history.c:53

◆ InbvUpdateProgressBar()

VOID NTAPI INIT_FUNCTION InbvUpdateProgressBar ( IN ULONG  Progress)

Definition at line 624 of file inbv.c.

Referenced by InbvIndicateProgress(), and Phase1InitializationDiscard().

625 {
626  ULONG FillCount, BoundedProgress;
627 
628  /* Make sure the progress bar is enabled, that we own and are installed */
629  if (ShowProgressBar &&
632  {
633  /* Compute fill count */
634  BoundedProgress = (InbvProgressState.Floor / 100) + Progress;
635  FillCount = 121 * (InbvProgressState.Bias * BoundedProgress) / 1000000;
636 
637  /* Acquire the lock */
638  InbvAcquireLock();
639 
640  /* Fill the progress bar */
643  ProgressBarLeft + FillCount,
644  ProgressBarTop + 12,
645  15);
646 
647  /* Release the lock */
648  InbvReleaseLock();
649  }
650 }
VOID NTAPI InbvReleaseLock(VOID)
Definition: inbv.c:342
VOID NTAPI InbvAcquireLock(VOID)
Definition: inbv.c:320
static ULONG ProgressBarLeft
Definition: inbv.c:38
static INBV_PROGRESS_STATE InbvProgressState
Definition: inbv.c:40
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:34
unsigned int ULONG
Definition: retypes.h:1
static ULONG ProgressBarTop
Definition: inbv.c:38
BOOLEAN InbvBootDriverInstalled
Definition: inbv.c:35
static BOOLEAN ShowProgressBar
Definition: inbv.c:39

◆ NtDisplayString()

NTSTATUS NTAPI NtDisplayString ( IN PUNICODE_STRING  DisplayString)

Definition at line 772 of file inbv.c.

773 {
775 
776  /* Convert the string to OEM and display it */
778  InbvDisplayString(OemString.Buffer);
779  RtlFreeOemString(&OemString);
780 
781  /* Return success */
782  return STATUS_SUCCESS;
783 }
*BytesInOemString PCHAR OemString
Definition: rtlfuncs.h:1561
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI InbvDisplayString(IN PCHAR String)
Definition: inbv.c:431
VOID NTAPI RtlFreeOemString(POEM_STRING OemString)
STRING OEM_STRING
Definition: umtypes.h:203
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
VOID DisplayString(LPWSTR Msg)
Definition: misc.c:211
return STATUS_SUCCESS
Definition: btrfs.c:2710

Variable Documentation

◆ BootDriverLock

KSPIN_LOCK BootDriverLock
static

Definition at line 32 of file inbv.c.

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

◆ InbvBootDriverInstalled

◆ InbvDisplayDebugStrings

BOOLEAN InbvDisplayDebugStrings = FALSE
static

Definition at line 36 of file inbv.c.

Referenced by InbvDisplayString(), and InbvEnableDisplayString().

◆ InbvDisplayFilter

INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL
static

Definition at line 37 of file inbv.c.

Referenced by InbvDisplayString(), and InbvInstallDisplayStringFilter().

◆ InbvDisplayState

◆ InbvOldIrql

KIRQL InbvOldIrql
static

Definition at line 33 of file inbv.c.

Referenced by InbvAcquireLock(), and InbvReleaseLock().

◆ InbvProgressIndicator

BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}
static

Definition at line 41 of file inbv.c.

◆ InbvProgressState

INBV_PROGRESS_STATE InbvProgressState
static

Definition at line 40 of file inbv.c.

◆ InbvResetDisplayParameters

INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL
static

Definition at line 42 of file inbv.c.

Referenced by InbvAcquireDisplayOwnership(), and InbvNotifyDisplayOwnershipLost().

◆ InbvTerminalBkgdColor

ULONG InbvTerminalBkgdColor = 40
static

Definition at line 110 of file inbv.c.

Referenced by InbvSetTextColor(), and InbvSolidColorFill().

◆ InbvTerminalTextColor

ULONG InbvTerminalTextColor = 37
static

Definition at line 109 of file inbv.c.

Referenced by InbvSetTextColor(), and InbvSolidColorFill().

◆ MainPalette

RGBQUAD MainPalette[16]
static

Definition at line 125 of file inbv.c.

◆ PltRotBarStatus

ROT_BAR_STATUS PltRotBarStatus = 0
static

Definition at line 69 of file inbv.c.

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

◆ ProgressBarLeft

ULONG ProgressBarLeft = 0
static

Definition at line 38 of file inbv.c.

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

◆ ProgressBarTop

ULONG ProgressBarTop = 0
static

Definition at line 38 of file inbv.c.

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

◆ ResourceCount

◆ ResourceList

PUCHAR ResourceList[1+IDB_MAX_RESOURCE]
static

Definition at line 44 of file inbv.c.

Referenced by InbvDriverInitialize(), and InbvGetResourceAddress().

◆ RotBarBuffer

UCHAR RotBarBuffer[24 *9]
static

Definition at line 70 of file inbv.c.

Referenced by DisplayBootBitmap(), and InbvRotationThread().

◆ RotBarSelection

ROT_BAR_TYPE RotBarSelection = RB_UNSPECIFIED
static

Definition at line 68 of file inbv.c.

Referenced by DisplayBootBitmap(), and InbvRotationThread().

◆ RotBarThreadActive

BOOLEAN RotBarThreadActive = FALSE
static

Definition at line 67 of file inbv.c.

Referenced by DisplayBootBitmap(), and FinalizeBootLogo().

◆ RotLineBuffer

UCHAR RotLineBuffer[640 *6]
static

Definition at line 71 of file inbv.c.

Referenced by DisplayBootBitmap(), and InbvRotationThread().

◆ ShowProgressBar

BOOLEAN ShowProgressBar = FALSE
static

Definition at line 39 of file inbv.c.

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