osloader!BlOsLoader调试到第一次osloader!BlOutputLoadMessage

第一部分:

BlOsLoader

ARC_STATUS

BlOsLoader (

IN ULONG Argc,

IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,

IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp

)

//

// Load the kernel image into memory.

//

BlOutputLoadMessage(LoadDevice, KernelPathName, NULL);

//

// Load the HAL DLL image into memory.

//

BlOutputLoadMessage(LoadDevice, HalPathName, NULL);

//

// Load the Kernel Debugger DLL image into memory.

//

KdDllLoadFailed = FALSE;

strcpy(&KdDllName[0], KernelDirectoryPath);

strcat(&KdDllName[0], KdFileName);

BlOutputLoadMessage(LoadDevice, &KdDllName[0], NULL);

//

// Scan the import table for the system image and load all referenced

// DLLs.

//

Status = BlScanImportDescriptorTable(&KernelPathSet,

SystemDataTableEntry,

LoaderSystemCode);

//

// Scan the import table for the HAL DLL and load all referenced DLLs.

//

Status = BlScanImportDescriptorTable(&KernelPathSet,

HalDataTableEntry,

LoaderHalCode);

//

// Scan the import table for the Kernel Debugger DLL and load all

// referenced DLLs.

//

if (!KdDllLoadFailed) {

Status = BlScanImportDescriptorTable(&KernelPathSet,

KdDataTableEntry,

LoaderSystemCode);

//

// Load the SYSTEM hive.

//

//

bLastKnownGoodChosenLate = bLastKnownGood;

Status = BlLoadAndScanSystemHive(LoadDeviceId,

LoadDevice,

LoadFileName,

BootFileSystem,

&bLastKnownGoodChosenLate,

&ServerHive,

BadFileName);

//

// Load boot drivers

//

Status = BlLoadBootDrivers(&LoadDevicePathSet,

&BlLoaderBlock->BootDriverListHead,

BadFileName);

//

// Execute the architecture specific setup code.

//

Status = BlSetupForNt(BlLoaderBlock);

BlTransferToKernel(SystemEntry, BlLoaderBlock);

第二部分:

kd> bp osloader!BlOutputLoadMessage

kd> bl

0 e Disable Clear 00428a87 [d:\srv03rtm\base\boot\bldr\osloader.c @ 973] 0001 (0001) osloader!BlOsLoader

1 e Disable Clear 00429fd8 [d:\srv03rtm\base\boot\bldr\regboot.c @ 969] 0001 (0001) osloader!BlLoadBootDrivers

2 e Disable Clear 0042eeaa [d:\srv03rtm\base\boot\lib\i386\ntsetup.c @ 157] 0001 (0001) osloader!BlSetupForNt

3 e Disable Clear 0042847c [d:\srv03rtm\base\boot\bldr\osloader.c @ 3043] 0001 (0001) osloader!BlOutputLoadMessage

//

// Initialize the OS loader console input and output.

//

Status = BlInitStdio(Argc, Argv);

//

// Initialize the OS loader I/O system.

//

Status = BlIoInitialize();

//

// Initialize the progress bar

//

BlSetProgBarCharacteristics(HIBER_UI_BAR_ELEMENT, BLDR_UI_BAR_BACKGROUND);

黑屏。

if (LoadOptions != NULL) {

FileSize = (ULONG)strlen(LoadOptions) + 1;

FileName = (PCHAR)BlAllocateHeap(FileSize);

strcpy(FileName, LoadOptions);

BlLoaderBlock->LoadOptions = FileName;

if (strstr(FileName, "SAFEBOOT") != NULL) {

safeBoot = TRUE;

}

if ((strstr(FileName, "3GB") != NULL) ||

(strstr(FileName, "3gb") != NULL)) {

BlVirtualBias = ALTERNATE_BASE - KSEG0_BASE;

}

if ((strstr(FileName, "PAE") != NULL) ||

(strstr(FileName, "pae") != NULL)) {

userSpecifiedPae = TRUE;

}

if ((strstr(FileName, "NOPAE") != NULL) ||

(strstr(FileName, "nopae") != NULL)) {

userSpecifiedNoPae = TRUE;

}

//

// Open the load device

//

Status = ArcOpen(LoadDevice, ArcOpenReadWrite, &LoadDeviceId);

if (Status != ESUCCESS) {

BlFatalError(LOAD_HW_DISK_CLASS,

DIAG_BL_OPEN_BOOT_DEVICE,

LOAD_HW_DISK_ACT);

goto LoadFailed;

}

//

// Handle triage dump (if present).

//

Status = BlLoadTriageDump (LoadDeviceId,

&BlLoaderBlock->Extension->TriageDumpBlock);

//

// Generate the full path name for the HAL DLL image and load it into

// memory.

//

strcpy(HalPathName, KernelDirectoryPath);

strcat(HalPathName, HalFileName);

//

// Prepare for building the full path name of the kernel

//

strcpy(KernelPathName, KernelDirectoryPath);

dv

HalPathName = char [256] "\WINDOWS\system32\"

strcat(HalPathName, HalFileName);之后:

dv

HalPathName = char [256] "\WINDOWS\system32\hal.dll"

kd> p

Breakpoint 3 hit

osloader!BlOutputLoadMessage:

0042847c 55 push ebp

kd> kc

00 osloader!BlOutputLoadMessage

01 osloader!BlOsLoader

02 osloader!BlStartup

03 osloader!NtProcessStartup

WARNING: Frame IP not in any known module. Following frames may be wrong.

04 0x0

05 osloader!`string'

06 0x0

kd> gu

osloader!BlOsLoader+0xb05:

0042958c 8d45d8 lea eax,[ebp-28h]