[BOOT] Improve debug logging

This commit is contained in:
Quinn Stephens 2024-09-01 17:54:40 -04:00
parent 43c6c75710
commit 2a19fd42de
3 changed files with 5 additions and 59 deletions

View File

@ -317,6 +317,7 @@ Return Value:
PMEMORY_DESCRIPTOR CurrentDescriptor;
if (Mdl == NULL || Descriptor == NULL) {
DebugPrint(L"MmMdAddDescriptorToList(): Mdl and/or Descriptor are NULL\r\n");
return STATUS_INVALID_PARAMETER;
}
@ -477,6 +478,7 @@ Return Value:
// virtual flag must be set.
//
if (Mdl->Type == MDL_TYPE_VIRTUAL) {
DebugPrint(L"MmMdFindDescriptorFromMdl(): Flags is invalid\r\n");
return NULL;
}
}
@ -577,6 +579,7 @@ Return Value:
// virtual flag must be set.
//
if (Mdl->Type == MDL_TYPE_VIRTUAL) {
DebugPrint(L"MmMdRemoveRegionFromMdlEx(): Flags is invalid\r\n");
return STATUS_INVALID_PARAMETER;
}
}
@ -732,7 +735,7 @@ Return Value:
// Free the descriptor from the heap.
// TODO: Use BlMmFreeHeap().
//
ConsolePrint(L"MmMdFreeDescriptor(): need BlMmFreeHeap() to free descriptor\r\n");
ConsolePrint(L"MmMdFreeDescriptor(): Heap not available\r\n");
return STATUS_NOT_IMPLEMENTED;
// return BlMmFreeHeap(Descriptor);
}

View File

@ -139,7 +139,7 @@ Return Value:
return STATUS_NO_MEMORY;
}
Status = MmMdAddDescriptorToList(&MmMdlReservedAllocated, NewDescriptor, 0x00);
Status = MmMdAddDescriptorToList(&MmMdlReservedAllocated, NewDescriptor, 0);
if (!NT_SUCCESS(Status)) {
MmMdFreeDescriptor(NewDescriptor);
return Status;

View File

@ -105,63 +105,6 @@ Return Value:
return Status;
}
//
// Print debug information.
// TODO: Remove this once the project is more stable?
//
#ifdef _DEBUG
DebugPrint(L"Boot device type: ");
switch (BlpBootDevice->Type) {
case BOOT_DEVICE_TYPE_PARTITION:
DebugPrint(L"partition\r\n");
BlockDevice = &BlpBootDevice->Partition.Parent;
break;
case BOOT_DEVICE_TYPE_PARTITION_EX:
DebugPrint(L"partition\r\n");
BlockDevice = &BlpBootDevice->PartitionEx.Parent;
break;
default:
DebugPrint(L"generic block device\r\n");
BlockDevice = &BlpBootDevice->Block;
break;
}
DebugPrint(L"Boot device parent type: ");
switch (BlockDevice->Type) {
case BOOT_BLOCK_DEVICE_TYPE_HARDDRIVE:
DebugPrint(L"hard drive\r\n");
break;
case BOOT_BLOCK_DEVICE_TYPE_CDROM:
DebugPrint(L"CD-ROM\r\n");
break;
case BOOT_BLOCK_DEVICE_TYPE_RAMDISK:
DebugPrint(L"RAM disk\r\n");
break;
default:
DebugPrint(L"generic block device\r\n");
break;
}
Option = &ApplicationEntry->Options;
for (ULONG Index = 0; !Option->IsInvalid; Index++) {
DebugPrintf(L"Boot entry option %x: ", Index);
if (Option->Type == BCDE_DATA_TYPE_APPLICATION_PATH) {
DebugPrint(L"application path \"");
DebugPrint((PWSTR)((PUCHAR)Option + Option->DataOffset));
DebugPrint(L"\"\r\n");
} else {
DebugPrintf(L"type %x, data size %x\r\n", Option->Type, Option->DataSize);
}
if (Option->NextOptionOffset == 0) {
break;
}
Option = (PBOOT_APPLICATION_OPTION)((PUCHAR)Option + Option->NextOptionOffset);
}
#endif
return STATUS_SUCCESS;
}