[ROSLOAD]: Begin target preparation code. 1/104.

[ROSLOAD]: Stubs for OslFatalErrorEx, OslAbortBoot.
OslpSanitizeLoadOptionsString, OslpSanitizeStringOptions
[ROSLOAD]: Implement OslBlStatusErrorHandler,
OslpRemoveInternalApplicationOptions
[ROSLOAD]: Begin work on OslPrepareTarget. Small misc. fixes.
[BOOTLIB]: Extend BlStatusError to handle a custom status error handler.
This commit is contained in:
Alex Ionescu 2018-02-03 15:52:31 -08:00
parent 3b777fd133
commit adcb9bd175
5 changed files with 334 additions and 12 deletions

View file

@ -16,6 +16,8 @@ CHAR AnsiBuffer[1024];
BOOLEAN BdDebuggerNotPresent;
BOOLEAN BdSubsystemInitialized;
BOOLEAN BdArchBlockDebuggerOperation;
BOOLEAN BlpStatusErrorInProgress;
PBL_STATUS_ERROR_HANDLER BlpStatusErrorHandler;
/* FUNCTIONS *****************************************************************/
@ -124,6 +126,35 @@ BlStatusError (
_In_ ULONG_PTR Parameter4
)
{
NTSTATUS Status;
/* Is this a non-boot error? */
if (ErrorCode != 1)
{
/* Is one already ongoing? */
if (!BlpStatusErrorInProgress)
{
/* Do we have a custom error handler registered? */
if (BlpStatusErrorHandler)
{
/* Call it, making sure to avoid recursion */
BlpStatusErrorInProgress = TRUE;
Status = BlpStatusErrorHandler(ErrorCode,
Parameter1,
Parameter2,
Parameter3,
Parameter4);
BlpStatusErrorInProgress = FALSE;
/* If the error handler consumed the error, we're done */
if (NT_SUCCESS(Status))
{
return;
}
}
}
}
/* Check if the boot debugger is enabled */
if (BlBdDebuggerEnabled())
{

View file

@ -1654,7 +1654,7 @@ ImgpCopyApplicationBootDevice (
NTSTATUS
ImgpInitializeBootApplicationParameters (
_In_ PBL_IMAGE_PARAMETERS ImageParameters,
_In_ PBL_BUFFER_DESCRIPTOR ImageParameters,
_In_ PBL_APPLICATION_ENTRY AppEntry,
_In_ PVOID ImageBase,
_In_ ULONG ImageSize
@ -1662,7 +1662,7 @@ ImgpInitializeBootApplicationParameters (
{
NTSTATUS Status;
PIMAGE_NT_HEADERS NtHeaders;
BL_IMAGE_PARAMETERS MemoryParameters;
BL_BUFFER_DESCRIPTOR MemoryParameters;
LIST_ENTRY MemoryList;
PBL_FIRMWARE_DESCRIPTOR FirmwareParameters;
PBL_DEVICE_DESCRIPTOR BootDevice;
@ -1841,7 +1841,7 @@ ImgArchEfiStartBootApplication (
PVOID BootData;
PIMAGE_NT_HEADERS NtHeaders;
PVOID NewStack, NewGdt, NewIdt;
BL_IMAGE_PARAMETERS Parameters;
BL_BUFFER_DESCRIPTOR Parameters;
/* Read the current IDT and GDT */
_sgdt(&Gdt.Limit);