[BOOT:LIB] Print boot info in InitializeLibrary()
This commit is contained in:
parent
3759f7dbfe
commit
c091f7ef59
@ -129,7 +129,11 @@ Return Value:
|
||||
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PBOOT_APPLICATION_ENTRY ApplicationEntry;
|
||||
PBOOT_DEVICE BootDevice;
|
||||
PBOOT_FIRMWARE_DATA FirmwareData;
|
||||
PBOOT_BLOCK_IDENTIFIER BlockDevice;
|
||||
PBOOT_APPLICATION_ENTRY_OPTION Option;
|
||||
|
||||
(VOID)LibraryParameters;
|
||||
|
||||
@ -142,15 +146,79 @@ Return Value:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate structure addresses from offsets.
|
||||
//
|
||||
ApplicationEntry = (PBOOT_APPLICATION_ENTRY)((PUCHAR)InputParameters + InputParameters->ApplicationEntryOffset);
|
||||
BootDevice = (PBOOT_DEVICE)((PUCHAR)InputParameters + InputParameters->BootDeviceOffset);
|
||||
FirmwareData = (PBOOT_FIRMWARE_DATA)((PUCHAR)InputParameters + InputParameters->FirmwareDataOffset);
|
||||
|
||||
//
|
||||
// Initialize firmware library.
|
||||
//
|
||||
FirmwareData = (PBOOT_FIRMWARE_DATA)((PUCHAR)InputParameters + InputParameters->FirmwareDataOffset);
|
||||
Status = BlpFwInitialize(0, FirmwareData);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Print debug information.
|
||||
//
|
||||
|
||||
ConsolePrintf(L"Image base: %x %x\r\n", (ULONG)((ULONG_PTR)InputParameters->ImageBase >> 32), (ULONG)((ULONG_PTR)InputParameters->ImageBase));
|
||||
ConsolePrintf(L"Image size: %x\r\n", InputParameters->ImageSize);
|
||||
|
||||
ConsolePrint(L"Boot device type: ");
|
||||
switch (BootDevice->Type) {
|
||||
case BOOT_DEVICE_TYPE_PARTITION:
|
||||
ConsolePrint(L"partition\r\n");
|
||||
BlockDevice = &BootDevice->Partition.Parent;
|
||||
break;
|
||||
case BOOT_DEVICE_TYPE_PARTITION_EX:
|
||||
ConsolePrint(L"partition\r\n");
|
||||
BlockDevice = &BootDevice->PartitionEx.Parent;
|
||||
break;
|
||||
default:
|
||||
ConsolePrint(L"generic block device\r\n");
|
||||
BlockDevice = &BootDevice->Block;
|
||||
break;
|
||||
}
|
||||
|
||||
ConsolePrint(L"Boot device parent type: ");
|
||||
switch (BlockDevice->Type) {
|
||||
case BOOT_BLOCK_DEVICE_TYPE_HARDDRIVE:
|
||||
ConsolePrint(L"hard drive\r\n");
|
||||
break;
|
||||
case BOOT_BLOCK_DEVICE_TYPE_CDROM:
|
||||
ConsolePrint(L"CD-ROM\r\n");
|
||||
break;
|
||||
case BOOT_BLOCK_DEVICE_TYPE_RAMDISK:
|
||||
ConsolePrint(L"RAM disk\r\n");
|
||||
break;
|
||||
default:
|
||||
ConsolePrint(L"generic block device\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
Option = &ApplicationEntry->Options;
|
||||
for (ULONG Index = 0; !Option->IsInvalid; Index++) {
|
||||
ConsolePrintf(L"Boot entry option %x: ", Index);
|
||||
|
||||
if (Option->Type == BCDE_DATA_TYPE_APPLICATION_PATH) {
|
||||
ConsolePrint(L"application path \"");
|
||||
ConsolePrint((PWSTR)((PUCHAR)Option + Option->DataOffset));
|
||||
ConsolePrint(L"\"\r\n");
|
||||
} else {
|
||||
ConsolePrintf(L"type %x, data size %x\r\n", Option->Type, Option->DataSize);
|
||||
}
|
||||
|
||||
if (Option->NextOptionOffset == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
Option = (PBOOT_APPLICATION_ENTRY_OPTION)((PUCHAR)Option + Option->NextOptionOffset);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user