2022-02-13 19:57:12 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: BSD - See COPYING.ARM in the top level directory
|
|
|
|
* PURPOSE: Boot Video Driver support
|
|
|
|
* COPYRIGHT: Copyright 2007 Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
* Copyright 2010 Aleksey Bragin (aleksey@reactos.org)
|
|
|
|
* Copyright 2015-2022 Hermès Bélusca-Maïto
|
|
|
|
*/
|
|
|
|
|
2003-08-11 18:50:12 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2020-04-06 21:48:01 +00:00
|
|
|
#include "inbv/logo.h"
|
2005-11-28 23:25:31 +00:00
|
|
|
|
2003-08-11 18:50:12 +00:00
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
2015-02-26 01:59:05 +00:00
|
|
|
/*
|
|
|
|
* Enable this define if you want Inbv to use coloured headless mode.
|
|
|
|
*/
|
|
|
|
// #define INBV_HEADLESS_COLORS
|
|
|
|
|
2019-08-19 23:52:25 +00:00
|
|
|
typedef struct _INBV_PROGRESS_STATE
|
|
|
|
{
|
|
|
|
ULONG Floor;
|
|
|
|
ULONG Ceiling;
|
|
|
|
ULONG Bias;
|
|
|
|
} INBV_PROGRESS_STATE;
|
|
|
|
|
|
|
|
typedef struct _BT_PROGRESS_INDICATOR
|
|
|
|
{
|
|
|
|
ULONG Count;
|
|
|
|
ULONG Expected;
|
|
|
|
ULONG Percentage;
|
|
|
|
} BT_PROGRESS_INDICATOR, *PBT_PROGRESS_INDICATOR;
|
|
|
|
|
2015-02-26 01:59:05 +00:00
|
|
|
static KSPIN_LOCK BootDriverLock;
|
|
|
|
static KIRQL InbvOldIrql;
|
2016-02-02 23:28:45 +00:00
|
|
|
static INBV_DISPLAY_STATE InbvDisplayState = INBV_DISPLAY_STATE_DISABLED;
|
2011-06-15 12:53:32 +00:00
|
|
|
BOOLEAN InbvBootDriverInstalled = FALSE;
|
2022-02-13 19:57:12 +00:00
|
|
|
static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL;
|
|
|
|
|
2015-02-26 01:59:05 +00:00
|
|
|
static BOOLEAN InbvDisplayDebugStrings = FALSE;
|
2016-02-02 23:28:45 +00:00
|
|
|
static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL;
|
2022-02-13 19:57:12 +00:00
|
|
|
|
|
|
|
ULONG ProgressBarLeft = 0, ProgressBarTop = 0;
|
|
|
|
BOOLEAN ShowProgressBar = FALSE;
|
2015-02-26 01:59:05 +00:00
|
|
|
static INBV_PROGRESS_STATE InbvProgressState;
|
|
|
|
static BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0};
|
2022-02-13 19:57:12 +00:00
|
|
|
|
2015-02-27 01:39:49 +00:00
|
|
|
static ULONG ResourceCount = 0;
|
2022-05-02 00:48:46 +00:00
|
|
|
static PUCHAR ResourceList[1 + IDB_MAX_RESOURCES]; // First entry == NULL, followed by 'ResourceCount' entries.
|
2015-02-26 01:59:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Headless terminal text colors
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef INBV_HEADLESS_COLORS
|
|
|
|
|
|
|
|
// Conversion table CGA to ANSI color index
|
|
|
|
static const UCHAR CGA_TO_ANSI_COLOR_TABLE[16] =
|
|
|
|
{
|
|
|
|
0, // Black
|
|
|
|
4, // Blue
|
|
|
|
2, // Green
|
|
|
|
6, // Cyan
|
|
|
|
1, // Red
|
|
|
|
5, // Magenta
|
|
|
|
3, // Brown/Yellow
|
|
|
|
7, // Grey/White
|
|
|
|
|
|
|
|
60, // Bright Black
|
|
|
|
64, // Bright Blue
|
|
|
|
62, // Bright Green
|
|
|
|
66, // Bright Cyan
|
|
|
|
61, // Bright Red
|
|
|
|
65, // Bright Magenta
|
|
|
|
63, // Bright Yellow
|
|
|
|
67 // Bright Grey (White)
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CGA_TO_ANSI_COLOR(CgaColor) \
|
|
|
|
CGA_TO_ANSI_COLOR_TABLE[CgaColor & 0x0F]
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Default colors: text in white, background in black
|
|
|
|
static ULONG InbvTerminalTextColor = 37;
|
|
|
|
static ULONG InbvTerminalBkgdColor = 40;
|
|
|
|
|
2003-08-24 12:08:16 +00:00
|
|
|
|
2003-08-11 18:50:12 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2022-02-13 19:57:12 +00:00
|
|
|
static
|
2007-02-03 20:30:32 +00:00
|
|
|
PVOID
|
2022-02-13 19:57:12 +00:00
|
|
|
FindBitmapResource(
|
|
|
|
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|
|
|
_In_ ULONG ResourceId)
|
2006-10-09 04:00:34 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
UNICODE_STRING UpString = RTL_CONSTANT_STRING(L"ntoskrnl.exe");
|
|
|
|
UNICODE_STRING MpString = RTL_CONSTANT_STRING(L"ntkrnlmp.exe");
|
|
|
|
PLIST_ENTRY NextEntry, ListHead;
|
|
|
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
|
|
|
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
|
|
|
|
LDR_RESOURCE_INFO ResourceInfo;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID Data = NULL;
|
|
|
|
|
|
|
|
/* Loop the driver list */
|
|
|
|
ListHead = &LoaderBlock->LoadOrderListHead;
|
2024-03-08 18:53:12 +00:00
|
|
|
for (NextEntry = ListHead->Flink;
|
|
|
|
NextEntry != ListHead;
|
|
|
|
NextEntry = NextEntry->Flink)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Get the entry */
|
|
|
|
LdrEntry = CONTAINING_RECORD(NextEntry,
|
|
|
|
LDR_DATA_TABLE_ENTRY,
|
|
|
|
InLoadOrderLinks);
|
|
|
|
|
|
|
|
/* Check for a match */
|
2016-02-02 23:28:45 +00:00
|
|
|
if (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE) ||
|
|
|
|
RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE))
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Break out */
|
2006-10-09 04:00:34 +00:00
|
|
|
break;
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if we found it */
|
|
|
|
if (NextEntry != ListHead)
|
|
|
|
{
|
|
|
|
/* Try to find the resource */
|
2016-02-02 23:28:45 +00:00
|
|
|
ResourceInfo.Type = 2; // RT_BITMAP;
|
2007-02-03 20:30:32 +00:00
|
|
|
ResourceInfo.Name = ResourceId;
|
|
|
|
ResourceInfo.Language = 0;
|
|
|
|
Status = LdrFindResource_U(LdrEntry->DllBase,
|
|
|
|
&ResourceInfo,
|
|
|
|
RESOURCE_DATA_LEVEL,
|
|
|
|
&ResourceDataEntry);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Access the resource */
|
2010-09-24 17:02:13 +00:00
|
|
|
ULONG Size = 0;
|
2007-02-03 20:30:32 +00:00
|
|
|
Status = LdrAccessResource(LdrEntry->DllBase,
|
|
|
|
ResourceDataEntry,
|
|
|
|
&Data,
|
2010-09-24 17:02:13 +00:00
|
|
|
&Size);
|
|
|
|
if ((Data) && (ResourceId < 3))
|
|
|
|
{
|
|
|
|
KiBugCheckData[4] ^= RtlComputeCrc32(0, Data, Size);
|
|
|
|
}
|
2007-02-03 20:30:32 +00:00
|
|
|
if (!NT_SUCCESS(Status)) Data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the pointer */
|
|
|
|
return Data;
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2022-02-13 19:57:12 +00:00
|
|
|
PUCHAR
|
|
|
|
NTAPI
|
|
|
|
InbvGetResourceAddress(
|
|
|
|
_In_ ULONG ResourceNumber)
|
|
|
|
{
|
|
|
|
/* Validate the resource number */
|
|
|
|
if (ResourceNumber > ResourceCount) return NULL;
|
|
|
|
|
|
|
|
/* Return the address */
|
|
|
|
return ResourceList[ResourceNumber];
|
|
|
|
}
|
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvDriverInitialize(
|
|
|
|
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|
|
|
_In_ ULONG Count)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
PCHAR CommandLine;
|
2016-02-02 23:28:45 +00:00
|
|
|
BOOLEAN ResetMode = FALSE; // By default do not reset the video mode
|
2007-02-03 20:30:32 +00:00
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
/* Quit if we're already installed */
|
|
|
|
if (InbvBootDriverInstalled) return TRUE;
|
|
|
|
|
|
|
|
/* Initialize the lock and check the current display state */
|
|
|
|
KeInitializeSpinLock(&BootDriverLock);
|
|
|
|
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
|
|
|
|
{
|
2016-02-02 23:28:45 +00:00
|
|
|
/* Reset the video mode in case we do not have a custom boot logo */
|
2015-02-27 01:39:49 +00:00
|
|
|
CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
|
2016-02-02 23:28:45 +00:00
|
|
|
ResetMode = (CommandLine == NULL) || (strstr(CommandLine, "BOOTLOGO") == NULL);
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the video */
|
2016-02-02 23:28:45 +00:00
|
|
|
InbvBootDriverInstalled = VidInitialize(ResetMode);
|
2007-02-03 20:30:32 +00:00
|
|
|
if (InbvBootDriverInstalled)
|
|
|
|
{
|
|
|
|
/* Find bitmap resources in the kernel */
|
2015-02-27 01:39:49 +00:00
|
|
|
ResourceCount = min(Count, RTL_NUMBER_OF(ResourceList) - 1);
|
2015-02-26 01:59:05 +00:00
|
|
|
for (i = 1; i <= ResourceCount; i++)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Do the lookup */
|
|
|
|
ResourceList[i] = FindBitmapResource(LoaderBlock, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the progress bar ranges */
|
|
|
|
InbvSetProgressBarSubset(0, 100);
|
2022-02-13 19:57:12 +00:00
|
|
|
|
|
|
|
// BootAnimInitialize(LoaderBlock, Count);
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Return install state */
|
|
|
|
return InbvBootDriverInstalled;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-10-09 04:00:34 +00:00
|
|
|
InbvAcquireLock(VOID)
|
|
|
|
{
|
2010-09-10 21:28:24 +00:00
|
|
|
KIRQL OldIrql;
|
|
|
|
|
|
|
|
/* Check if we're at dispatch level or lower */
|
|
|
|
OldIrql = KeGetCurrentIrql();
|
|
|
|
if (OldIrql <= DISPATCH_LEVEL)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
2010-09-10 21:28:24 +00:00
|
|
|
/* Loop until the lock is free */
|
|
|
|
while (!KeTestSpinLock(&BootDriverLock));
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Raise IRQL to dispatch level */
|
2010-09-10 21:28:24 +00:00
|
|
|
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Acquire the lock */
|
|
|
|
KiAcquireSpinLock(&BootDriverLock);
|
2010-09-10 21:28:24 +00:00
|
|
|
InbvOldIrql = OldIrql;
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-10-09 04:00:34 +00:00
|
|
|
InbvReleaseLock(VOID)
|
|
|
|
{
|
2010-09-10 21:28:24 +00:00
|
|
|
KIRQL OldIrql;
|
|
|
|
|
|
|
|
/* Capture the old IRQL */
|
|
|
|
OldIrql = InbvOldIrql;
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Release the driver lock */
|
|
|
|
KiReleaseSpinLock(&BootDriverLock);
|
|
|
|
|
2010-09-10 21:28:24 +00:00
|
|
|
/* If we were at dispatch level or lower, restore the old IRQL */
|
|
|
|
if (InbvOldIrql <= DISPATCH_LEVEL) KeLowerIrql(OldIrql);
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvEnableBootDriver(
|
|
|
|
_In_ BOOLEAN Enable)
|
2006-10-09 04:00:34 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Check if we're installed */
|
|
|
|
if (InbvBootDriverInstalled)
|
|
|
|
{
|
|
|
|
/* Check for lost state */
|
|
|
|
if (InbvDisplayState >= INBV_DISPLAY_STATE_LOST) return;
|
|
|
|
|
|
|
|
/* Acquire the lock */
|
|
|
|
InbvAcquireLock();
|
|
|
|
|
|
|
|
/* Cleanup the screen if we own it */
|
|
|
|
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED) VidCleanUp();
|
|
|
|
|
|
|
|
/* Set the new display state */
|
2015-02-26 01:59:05 +00:00
|
|
|
InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED :
|
2007-02-03 20:30:32 +00:00
|
|
|
INBV_DISPLAY_STATE_DISABLED;
|
|
|
|
|
|
|
|
/* Release the lock */
|
|
|
|
InbvReleaseLock();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Set the new display state */
|
2015-02-26 01:59:05 +00:00
|
|
|
InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED :
|
2007-02-03 20:30:32 +00:00
|
|
|
INBV_DISPLAY_STATE_DISABLED;
|
|
|
|
}
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2003-08-11 18:50:12 +00:00
|
|
|
InbvAcquireDisplayOwnership(VOID)
|
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Check if we have a callback and we're just acquiring it now */
|
|
|
|
if ((InbvResetDisplayParameters) &&
|
|
|
|
(InbvDisplayState == INBV_DISPLAY_STATE_LOST))
|
|
|
|
{
|
|
|
|
/* Call the callback */
|
|
|
|
InbvResetDisplayParameters(80, 50);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Acquire the display */
|
|
|
|
InbvDisplayState = INBV_DISPLAY_STATE_OWNED;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvSetDisplayOwnership(
|
|
|
|
_In_ BOOLEAN DisplayOwned)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Set the new display state */
|
2015-02-26 01:59:05 +00:00
|
|
|
InbvDisplayState = DisplayOwned ? INBV_DISPLAY_STATE_OWNED :
|
2007-02-03 20:30:32 +00:00
|
|
|
INBV_DISPLAY_STATE_LOST;
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2003-08-11 18:50:12 +00:00
|
|
|
InbvCheckDisplayOwnership(VOID)
|
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Return if we own it or not */
|
|
|
|
return InbvDisplayState != INBV_DISPLAY_STATE_LOST;
|
|
|
|
}
|
|
|
|
|
|
|
|
INBV_DISPLAY_STATE
|
|
|
|
NTAPI
|
|
|
|
InbvGetDisplayState(VOID)
|
|
|
|
{
|
|
|
|
/* Return the actual state */
|
|
|
|
return InbvDisplayState;
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvDisplayString(
|
|
|
|
_In_ PCHAR String)
|
2003-08-11 18:50:12 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Make sure we own the display */
|
|
|
|
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
|
|
|
|
{
|
|
|
|
/* If we're not allowed, return success anyway */
|
|
|
|
if (!InbvDisplayDebugStrings) return TRUE;
|
2006-05-17 20:34:34 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Check if a filter is installed */
|
|
|
|
if (InbvDisplayFilter) InbvDisplayFilter(&String);
|
2006-05-17 20:34:34 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Acquire the lock */
|
|
|
|
InbvAcquireLock();
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Make sure we're installed and display the string */
|
2014-08-31 23:00:29 +00:00
|
|
|
if (InbvBootDriverInstalled) VidDisplayString((PUCHAR)String);
|
2007-02-03 20:30:32 +00:00
|
|
|
|
2010-09-15 07:46:28 +00:00
|
|
|
/* Print the string on the EMS port */
|
2012-12-09 21:43:51 +00:00
|
|
|
HeadlessDispatch(HeadlessCmdPutString,
|
|
|
|
String,
|
|
|
|
strlen(String) + sizeof(ANSI_NULL),
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2007-02-03 20:30:32 +00:00
|
|
|
|
|
|
|
/* Release the lock */
|
|
|
|
InbvReleaseLock();
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* All done */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We don't own it, fail */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-02-01 16:40:23 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvEnableDisplayString(
|
|
|
|
_In_ BOOLEAN Enable)
|
2003-08-11 18:50:12 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN OldSetting;
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Get the old setting */
|
|
|
|
OldSetting = InbvDisplayDebugStrings;
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Update it */
|
|
|
|
InbvDisplayDebugStrings = Enable;
|
|
|
|
|
|
|
|
/* Return the old setting */
|
|
|
|
return OldSetting;
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvInstallDisplayStringFilter(
|
|
|
|
_In_ INBV_DISPLAY_STRING_FILTER DisplayFilter)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Save the filter */
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvDisplayFilter = DisplayFilter;
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2003-08-11 18:50:12 +00:00
|
|
|
InbvIsBootDriverInstalled(VOID)
|
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Return driver state */
|
|
|
|
return InbvBootDriverInstalled;
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvNotifyDisplayOwnershipLost(
|
|
|
|
_In_ INBV_RESET_DISPLAY_PARAMETERS Callback)
|
2003-08-11 18:50:12 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Check if we're installed */
|
|
|
|
if (InbvBootDriverInstalled)
|
|
|
|
{
|
|
|
|
/* Acquire the lock and cleanup if we own the screen */
|
|
|
|
InbvAcquireLock();
|
|
|
|
if (InbvDisplayState != INBV_DISPLAY_STATE_LOST) VidCleanUp();
|
|
|
|
|
|
|
|
/* Set the reset callback and display state */
|
|
|
|
InbvResetDisplayParameters = Callback;
|
|
|
|
InbvDisplayState = INBV_DISPLAY_STATE_LOST;
|
|
|
|
|
|
|
|
/* Release the lock */
|
|
|
|
InbvReleaseLock();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Set the reset callback and display state */
|
|
|
|
InbvResetDisplayParameters = Callback;
|
|
|
|
InbvDisplayState = INBV_DISPLAY_STATE_LOST;
|
|
|
|
}
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2003-08-11 18:50:12 +00:00
|
|
|
InbvResetDisplay(VOID)
|
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Check if we're installed and we own it */
|
2015-02-26 01:59:05 +00:00
|
|
|
if (InbvBootDriverInstalled &&
|
2007-02-03 20:30:32 +00:00
|
|
|
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
|
|
|
|
{
|
|
|
|
/* Do the reset */
|
|
|
|
VidResetDisplay(TRUE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Nothing to reset */
|
|
|
|
return FALSE;
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvSetScrollRegion(
|
|
|
|
_In_ ULONG Left,
|
|
|
|
_In_ ULONG Top,
|
|
|
|
_In_ ULONG Right,
|
|
|
|
_In_ ULONG Bottom)
|
2003-08-11 18:50:12 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Just call bootvid */
|
2014-08-31 23:00:29 +00:00
|
|
|
VidSetScrollRegion(Left, Top, Right, Bottom);
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvSetTextColor(
|
|
|
|
_In_ ULONG Color)
|
2003-08-11 18:50:12 +00:00
|
|
|
{
|
2015-02-26 01:59:05 +00:00
|
|
|
HEADLESS_CMD_SET_COLOR HeadlessSetColor;
|
|
|
|
|
|
|
|
/* Set color for EMS port */
|
|
|
|
#ifdef INBV_HEADLESS_COLORS
|
|
|
|
InbvTerminalTextColor = 30 + CGA_TO_ANSI_COLOR(Color);
|
|
|
|
#else
|
|
|
|
InbvTerminalTextColor = 37;
|
|
|
|
#endif
|
|
|
|
HeadlessSetColor.TextColor = InbvTerminalTextColor;
|
|
|
|
HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
|
|
|
|
HeadlessDispatch(HeadlessCmdSetColor,
|
|
|
|
&HeadlessSetColor,
|
|
|
|
sizeof(HeadlessSetColor),
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Update the text color */
|
|
|
|
VidSetTextColor(Color);
|
|
|
|
}
|
2003-08-11 18:50:12 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvSolidColorFill(
|
|
|
|
_In_ ULONG Left,
|
|
|
|
_In_ ULONG Top,
|
|
|
|
_In_ ULONG Right,
|
|
|
|
_In_ ULONG Bottom,
|
|
|
|
_In_ ULONG Color)
|
2003-08-11 18:50:12 +00:00
|
|
|
{
|
2015-02-26 01:59:05 +00:00
|
|
|
HEADLESS_CMD_SET_COLOR HeadlessSetColor;
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Make sure we own it */
|
|
|
|
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
|
|
|
|
{
|
|
|
|
/* Acquire the lock */
|
|
|
|
InbvAcquireLock();
|
|
|
|
|
|
|
|
/* Check if we're installed */
|
|
|
|
if (InbvBootDriverInstalled)
|
|
|
|
{
|
|
|
|
/* Call bootvid */
|
2014-08-31 23:00:29 +00:00
|
|
|
VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
|
|
|
|
2015-02-26 01:59:05 +00:00
|
|
|
/* Set color for EMS port and clear display */
|
|
|
|
#ifdef INBV_HEADLESS_COLORS
|
|
|
|
InbvTerminalBkgdColor = 40 + CGA_TO_ANSI_COLOR(Color);
|
|
|
|
#else
|
|
|
|
InbvTerminalBkgdColor = 40;
|
|
|
|
#endif
|
|
|
|
HeadlessSetColor.TextColor = InbvTerminalTextColor;
|
|
|
|
HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
|
|
|
|
HeadlessDispatch(HeadlessCmdSetColor,
|
|
|
|
&HeadlessSetColor,
|
|
|
|
sizeof(HeadlessSetColor),
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
HeadlessDispatch(HeadlessCmdClearDisplay,
|
|
|
|
NULL, 0,
|
|
|
|
NULL, NULL);
|
2007-02-03 20:30:32 +00:00
|
|
|
|
|
|
|
/* Release the lock */
|
|
|
|
InbvReleaseLock();
|
|
|
|
}
|
2003-08-11 18:50:12 +00:00
|
|
|
}
|
2005-01-07 06:54:27 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvBitBlt(
|
|
|
|
_In_ PUCHAR Buffer,
|
|
|
|
_In_ ULONG X,
|
|
|
|
_In_ ULONG Y)
|
2006-10-09 04:00:34 +00:00
|
|
|
{
|
2022-02-13 19:57:12 +00:00
|
|
|
/* Check if we're installed and we own it */
|
|
|
|
if (InbvBootDriverInstalled &&
|
2007-02-03 20:30:32 +00:00
|
|
|
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
|
|
|
|
{
|
2010-02-19 03:16:04 +00:00
|
|
|
/* Acquire the lock */
|
|
|
|
InbvAcquireLock();
|
|
|
|
|
2022-02-13 19:57:12 +00:00
|
|
|
/* Do the blit */
|
|
|
|
VidBitBlt(Buffer, X, Y);
|
2010-02-19 03:16:04 +00:00
|
|
|
|
|
|
|
/* Release the lock */
|
|
|
|
InbvReleaseLock();
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvBufferToScreenBlt(
|
|
|
|
_In_ PUCHAR Buffer,
|
|
|
|
_In_ ULONG X,
|
|
|
|
_In_ ULONG Y,
|
|
|
|
_In_ ULONG Width,
|
|
|
|
_In_ ULONG Height,
|
|
|
|
_In_ ULONG Delta)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Check if we're installed and we own it */
|
2015-02-26 01:59:05 +00:00
|
|
|
if (InbvBootDriverInstalled &&
|
2007-02-03 20:30:32 +00:00
|
|
|
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
|
|
|
|
{
|
|
|
|
/* Do the blit */
|
|
|
|
VidBufferToScreenBlt(Buffer, X, Y, Width, Height, Delta);
|
|
|
|
}
|
|
|
|
}
|
2006-10-09 04:00:34 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvScreenToBufferBlt(
|
|
|
|
_Out_ PUCHAR Buffer,
|
|
|
|
_In_ ULONG X,
|
|
|
|
_In_ ULONG Y,
|
|
|
|
_In_ ULONG Width,
|
|
|
|
_In_ ULONG Height,
|
|
|
|
_In_ ULONG Delta)
|
2007-02-03 20:30:32 +00:00
|
|
|
{
|
|
|
|
/* Check if we're installed and we own it */
|
2015-02-26 01:59:05 +00:00
|
|
|
if (InbvBootDriverInstalled &&
|
2007-02-03 20:30:32 +00:00
|
|
|
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
|
|
|
|
{
|
|
|
|
/* Do the blit */
|
|
|
|
VidScreenToBufferBlt(Buffer, X, Y, Width, Height, Delta);
|
|
|
|
}
|
|
|
|
}
|
2006-10-09 04:00:34 +00:00
|
|
|
|
2022-02-13 15:33:20 +00:00
|
|
|
/**
|
|
|
|
* @brief
|
|
|
|
* Sets the screen coordinates of the loading progress bar and enable it.
|
|
|
|
*
|
|
|
|
* @param[in] Left
|
|
|
|
* @param[in] Top
|
|
|
|
* The left/top coordinates.
|
|
|
|
*
|
|
|
|
* @return None.
|
|
|
|
**/
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 15:33:20 +00:00
|
|
|
InbvSetProgressBarCoordinates(
|
|
|
|
_In_ ULONG Left,
|
2022-02-13 19:57:12 +00:00
|
|
|
_In_ ULONG Top)
|
2006-10-09 04:00:34 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Update the coordinates */
|
2022-02-13 19:57:12 +00:00
|
|
|
ProgressBarLeft = Left;
|
|
|
|
ProgressBarTop = Top;
|
2006-10-09 04:00:34 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Enable the progress bar */
|
|
|
|
ShowProgressBar = TRUE;
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2022-02-13 19:57:12 +00:00
|
|
|
/**
|
|
|
|
* @brief
|
|
|
|
* Gives some progress feedback, without specifying any explicit number
|
|
|
|
* of progress steps or percentage.
|
|
|
|
* The corresponding percentage is derived from the progress indicator's
|
|
|
|
* current count, capped to the number of expected calls to be made to
|
|
|
|
* this function (default: 25, see @b InbvProgressIndicator.Expected).
|
|
|
|
*
|
|
|
|
* @return None.
|
|
|
|
**/
|
|
|
|
CODE_SEG("INIT")
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
InbvIndicateProgress(VOID)
|
|
|
|
{
|
|
|
|
ULONG Percentage;
|
|
|
|
|
|
|
|
/* Increase progress */
|
|
|
|
InbvProgressIndicator.Count++;
|
|
|
|
|
|
|
|
/* Compute the new percentage - Don't go over 100% */
|
|
|
|
Percentage = 100 * InbvProgressIndicator.Count /
|
|
|
|
InbvProgressIndicator.Expected;
|
|
|
|
Percentage = min(Percentage, 99);
|
|
|
|
|
|
|
|
if (Percentage != InbvProgressIndicator.Percentage)
|
|
|
|
{
|
|
|
|
/* Percentage has changed, update the progress bar */
|
|
|
|
InbvProgressIndicator.Percentage = Percentage;
|
|
|
|
InbvUpdateProgressBar(Percentage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-13 15:33:20 +00:00
|
|
|
/**
|
|
|
|
* @brief
|
|
|
|
* Specifies a progress percentage sub-range.
|
|
|
|
* Further calls to InbvIndicateProgress() or InbvUpdateProgressBar()
|
|
|
|
* will update the progress percentage relative to this sub-range.
|
|
|
|
* In particular, the percentage provided to InbvUpdateProgressBar()
|
|
|
|
* is relative to this sub-range.
|
|
|
|
*
|
|
|
|
* @param[in] Floor
|
|
|
|
* The lower bound percentage of the sub-range (default: 0).
|
|
|
|
*
|
|
|
|
* @param[in] Ceiling
|
|
|
|
* The upper bound percentage of the sub-range (default: 100).
|
|
|
|
*
|
|
|
|
* @return None.
|
|
|
|
**/
|
2007-02-03 20:30:32 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 15:33:20 +00:00
|
|
|
InbvSetProgressBarSubset(
|
|
|
|
_In_ ULONG Floor,
|
|
|
|
_In_ ULONG Ceiling)
|
2006-10-09 04:00:34 +00:00
|
|
|
{
|
2007-02-03 20:30:32 +00:00
|
|
|
/* Sanity checks */
|
|
|
|
ASSERT(Floor < Ceiling);
|
|
|
|
ASSERT(Ceiling <= 100);
|
|
|
|
|
|
|
|
/* Update the progress bar state */
|
|
|
|
InbvProgressState.Floor = Floor * 100;
|
|
|
|
InbvProgressState.Ceiling = Ceiling * 100;
|
2022-02-13 15:33:20 +00:00
|
|
|
InbvProgressState.Bias = Ceiling - Floor;
|
2006-10-09 04:00:34 +00:00
|
|
|
}
|
|
|
|
|
2022-02-13 15:33:20 +00:00
|
|
|
/**
|
|
|
|
* @brief
|
2022-02-13 19:57:12 +00:00
|
|
|
* Updates the progress bar percentage, relative to the current
|
|
|
|
* percentage sub-range previously set by InbvSetProgressBarSubset().
|
|
|
|
*
|
|
|
|
* @param[in] Percentage
|
|
|
|
* The progress percentage, relative to the current sub-range.
|
2022-02-13 15:33:20 +00:00
|
|
|
*
|
|
|
|
* @return None.
|
|
|
|
**/
|
Patch for better boot logo/progress bar, fixed /SOS (debug) boot screen/output, removal of "funny" shutdown messages, addition of shutdown logo/screen, and misc:
[NTOS]: Add missing InbvIndicateProgress routine to update the progress bar while drivers are loading. Make boot and system driver initialization call it for each new driver. This updates the progress bar in the 25-75% range which was defined prior to IoInitSystem.
[NTOS]: Fix InbvUpdateProgressBar code to correctly handle the floor and ceiling.
[NTOS]: Remove shutdown "funny messages", do correct shutdown (should fix the ACPI shutdown issues) procedure. Display the shutdown screen on systems without ACPI (just like Windows does).
[NTOS]: Add a resource header with IDB_ definitions for all the embedded bitmaps, instead of using magic numbers and guessing which is which.
[NTOS]: Fix the boot logo initialization code as it was all wrong. 5 is the logo to be used during shutdown, for example, not the full logo background (which is supposed to be in 1, with a special palette that's faded in). Also handle server vs workstation scenarios.
[NTOS]: Booting in the new WinNT mode now correctly displays the blue background screen when in debug (/SOS) mode, and the header/footer also has the correct color, as does the separator band.
[DDK]: Add missing SUITE_TYPE definitions.
[NTOS]: Remove logo files that are simply not needed for ReactOS (Compute Cluster Edition, Tablet PC, etc...)
[NTOS]: Fix logo files (mostly) to have correct palettes. Note that 1.bmp is still quite different from Windows (no fade).
svn path=/trunk/; revision=45822
2010-03-04 06:26:11 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2022-02-13 19:57:12 +00:00
|
|
|
InbvUpdateProgressBar(
|
|
|
|
_In_ ULONG Percentage)
|
Patch for better boot logo/progress bar, fixed /SOS (debug) boot screen/output, removal of "funny" shutdown messages, addition of shutdown logo/screen, and misc:
[NTOS]: Add missing InbvIndicateProgress routine to update the progress bar while drivers are loading. Make boot and system driver initialization call it for each new driver. This updates the progress bar in the 25-75% range which was defined prior to IoInitSystem.
[NTOS]: Fix InbvUpdateProgressBar code to correctly handle the floor and ceiling.
[NTOS]: Remove shutdown "funny messages", do correct shutdown (should fix the ACPI shutdown issues) procedure. Display the shutdown screen on systems without ACPI (just like Windows does).
[NTOS]: Add a resource header with IDB_ definitions for all the embedded bitmaps, instead of using magic numbers and guessing which is which.
[NTOS]: Fix the boot logo initialization code as it was all wrong. 5 is the logo to be used during shutdown, for example, not the full logo background (which is supposed to be in 1, with a special palette that's faded in). Also handle server vs workstation scenarios.
[NTOS]: Booting in the new WinNT mode now correctly displays the blue background screen when in debug (/SOS) mode, and the header/footer also has the correct color, as does the separator band.
[DDK]: Add missing SUITE_TYPE definitions.
[NTOS]: Remove logo files that are simply not needed for ReactOS (Compute Cluster Edition, Tablet PC, etc...)
[NTOS]: Fix logo files (mostly) to have correct palettes. Note that 1.bmp is still quite different from Windows (no fade).
svn path=/trunk/; revision=45822
2010-03-04 06:26:11 +00:00
|
|
|
{
|
2022-02-13 19:57:12 +00:00
|
|
|
ULONG TotalProgress;
|
Patch for better boot logo/progress bar, fixed /SOS (debug) boot screen/output, removal of "funny" shutdown messages, addition of shutdown logo/screen, and misc:
[NTOS]: Add missing InbvIndicateProgress routine to update the progress bar while drivers are loading. Make boot and system driver initialization call it for each new driver. This updates the progress bar in the 25-75% range which was defined prior to IoInitSystem.
[NTOS]: Fix InbvUpdateProgressBar code to correctly handle the floor and ceiling.
[NTOS]: Remove shutdown "funny messages", do correct shutdown (should fix the ACPI shutdown issues) procedure. Display the shutdown screen on systems without ACPI (just like Windows does).
[NTOS]: Add a resource header with IDB_ definitions for all the embedded bitmaps, instead of using magic numbers and guessing which is which.
[NTOS]: Fix the boot logo initialization code as it was all wrong. 5 is the logo to be used during shutdown, for example, not the full logo background (which is supposed to be in 1, with a special palette that's faded in). Also handle server vs workstation scenarios.
[NTOS]: Booting in the new WinNT mode now correctly displays the blue background screen when in debug (/SOS) mode, and the header/footer also has the correct color, as does the separator band.
[DDK]: Add missing SUITE_TYPE definitions.
[NTOS]: Remove logo files that are simply not needed for ReactOS (Compute Cluster Edition, Tablet PC, etc...)
[NTOS]: Fix logo files (mostly) to have correct palettes. Note that 1.bmp is still quite different from Windows (no fade).
svn path=/trunk/; revision=45822
2010-03-04 06:26:11 +00:00
|
|
|
|
2022-02-13 19:57:12 +00:00
|
|
|
/* Make sure the progress bar is enabled, that we own and are installed */
|
|
|
|
if (ShowProgressBar &&
|
|
|
|
InbvBootDriverInstalled &&
|
|
|
|
(InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
|
Patch for better boot logo/progress bar, fixed /SOS (debug) boot screen/output, removal of "funny" shutdown messages, addition of shutdown logo/screen, and misc:
[NTOS]: Add missing InbvIndicateProgress routine to update the progress bar while drivers are loading. Make boot and system driver initialization call it for each new driver. This updates the progress bar in the 25-75% range which was defined prior to IoInitSystem.
[NTOS]: Fix InbvUpdateProgressBar code to correctly handle the floor and ceiling.
[NTOS]: Remove shutdown "funny messages", do correct shutdown (should fix the ACPI shutdown issues) procedure. Display the shutdown screen on systems without ACPI (just like Windows does).
[NTOS]: Add a resource header with IDB_ definitions for all the embedded bitmaps, instead of using magic numbers and guessing which is which.
[NTOS]: Fix the boot logo initialization code as it was all wrong. 5 is the logo to be used during shutdown, for example, not the full logo background (which is supposed to be in 1, with a special palette that's faded in). Also handle server vs workstation scenarios.
[NTOS]: Booting in the new WinNT mode now correctly displays the blue background screen when in debug (/SOS) mode, and the header/footer also has the correct color, as does the separator band.
[DDK]: Add missing SUITE_TYPE definitions.
[NTOS]: Remove logo files that are simply not needed for ReactOS (Compute Cluster Edition, Tablet PC, etc...)
[NTOS]: Fix logo files (mostly) to have correct palettes. Note that 1.bmp is still quite different from Windows (no fade).
svn path=/trunk/; revision=45822
2010-03-04 06:26:11 +00:00
|
|
|
{
|
2022-02-13 19:57:12 +00:00
|
|
|
/* Compute the total progress and tick the progress bar */
|
|
|
|
TotalProgress = InbvProgressState.Floor + (Percentage * InbvProgressState.Bias);
|
|
|
|
// TotalProgress /= (100 * 100);
|
2006-10-09 04:00:34 +00:00
|
|
|
|
2022-02-13 19:57:12 +00:00
|
|
|
BootAnimTickProgressBar(TotalProgress);
|
|
|
|
}
|
2007-02-03 20:30:32 +00:00
|
|
|
}
|
2006-10-09 04:00:34 +00:00
|
|
|
|
2007-02-03 20:30:32 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtDisplayString(IN PUNICODE_STRING DisplayString)
|
2005-01-07 06:54:27 +00:00
|
|
|
{
|
2018-12-20 02:32:08 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
UNICODE_STRING CapturedString;
|
2007-02-03 20:30:32 +00:00
|
|
|
OEM_STRING OemString;
|
2018-12-20 23:33:56 +00:00
|
|
|
ULONG OemLength;
|
2018-12-20 02:32:08 +00:00
|
|
|
KPROCESSOR_MODE PreviousMode;
|
|
|
|
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
PreviousMode = ExGetPreviousMode();
|
|
|
|
|
|
|
|
/* We require the TCB privilege */
|
|
|
|
if (!SeSinglePrivilegeCheck(SeTcbPrivilege, PreviousMode))
|
|
|
|
return STATUS_PRIVILEGE_NOT_HELD;
|
|
|
|
|
|
|
|
/* Capture the string */
|
|
|
|
Status = ProbeAndCaptureUnicodeString(&CapturedString, PreviousMode, DisplayString);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
return Status;
|
|
|
|
|
|
|
|
/* Do not display the string if it is empty */
|
|
|
|
if (CapturedString.Length == 0 || CapturedString.Buffer == NULL)
|
|
|
|
{
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
goto Quit;
|
|
|
|
}
|
2005-01-07 06:54:27 +00:00
|
|
|
|
2018-12-20 02:32:08 +00:00
|
|
|
/*
|
|
|
|
* Convert the string since INBV understands only ANSI/OEM. Allocate the
|
|
|
|
* string buffer in non-paged pool because INBV passes it down to BOOTVID.
|
|
|
|
* We cannot perform the allocation using RtlUnicodeStringToOemString()
|
|
|
|
* since its allocator uses PagedPool.
|
|
|
|
*/
|
2018-12-20 23:33:56 +00:00
|
|
|
OemLength = RtlUnicodeStringToOemSize(&CapturedString);
|
|
|
|
if (OemLength > MAXUSHORT)
|
|
|
|
{
|
|
|
|
Status = STATUS_BUFFER_OVERFLOW;
|
|
|
|
goto Quit;
|
|
|
|
}
|
|
|
|
RtlInitEmptyAnsiString((PANSI_STRING)&OemString, NULL, (USHORT)OemLength);
|
|
|
|
OemString.Buffer = ExAllocatePoolWithTag(NonPagedPool, OemLength, TAG_OSTR);
|
2018-12-20 02:32:08 +00:00
|
|
|
if (OemString.Buffer == NULL)
|
|
|
|
{
|
|
|
|
Status = STATUS_NO_MEMORY;
|
|
|
|
goto Quit;
|
|
|
|
}
|
2021-06-17 15:49:40 +00:00
|
|
|
Status = RtlUnicodeStringToOemString(&OemString, &CapturedString, FALSE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ExFreePoolWithTag(OemString.Buffer, TAG_OSTR);
|
|
|
|
goto Quit;
|
|
|
|
}
|
2018-12-20 02:32:08 +00:00
|
|
|
|
|
|
|
/* Display the string */
|
2007-02-03 20:30:32 +00:00
|
|
|
InbvDisplayString(OemString.Buffer);
|
2005-01-07 06:54:27 +00:00
|
|
|
|
2018-12-20 02:32:08 +00:00
|
|
|
/* Free the string buffer */
|
|
|
|
ExFreePoolWithTag(OemString.Buffer, TAG_OSTR);
|
|
|
|
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
Quit:
|
|
|
|
/* Free the captured string */
|
|
|
|
ReleaseCapturedUnicodeString(&CapturedString, PreviousMode);
|
|
|
|
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|