mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +00:00
[FREELDR]
- Add DPRINT_WINDOWS DPRINT_PELOADER (the only useful) to DEBUG_ALL and DEBUG_CUSTOM - Enable a few useful DPRINTs svn path=/branches/ros-amd64-bringup/; revision=45431
This commit is contained in:
parent
3e8181cc61
commit
4088be01fe
3 changed files with 23 additions and 16 deletions
|
@ -32,15 +32,13 @@
|
||||||
#if defined (DEBUG_ALL)
|
#if defined (DEBUG_ALL)
|
||||||
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
|
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
|
||||||
DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
|
DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
|
||||||
DPRINT_LINUX | DPRINT_HWDETECT;
|
DPRINT_LINUX | DPRINT_HWDETECT | DPRINT_WINDOWS | DPRINT_PELOADER;
|
||||||
#elif defined (DEBUG_INIFILE)
|
#elif defined (DEBUG_INIFILE)
|
||||||
ULONG DebugPrintMask = DPRINT_INIFILE;
|
ULONG DebugPrintMask = DPRINT_INIFILE;
|
||||||
#elif defined (DEBUG_REACTOS)
|
#elif defined (DEBUG_REACTOS)
|
||||||
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
|
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
|
||||||
#elif defined (DEBUG_CUSTOM)
|
#elif defined (DEBUG_CUSTOM)
|
||||||
ULONG DebugPrintMask = DPRINT_WARNING |
|
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_WINDOWS | DPRINT_PELOADER;
|
||||||
DPRINT_UI | DPRINT_CACHE | DPRINT_REACTOS |
|
|
||||||
DPRINT_LINUX;
|
|
||||||
#else //#elif defined (DEBUG_NONE)
|
#else //#elif defined (DEBUG_NONE)
|
||||||
ULONG DebugPrintMask = 0;
|
ULONG DebugPrintMask = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -507,8 +507,8 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||||
LONG High, Low, Middle, Result;
|
LONG High, Low, Middle, Result;
|
||||||
ULONG Hint;
|
ULONG Hint;
|
||||||
|
|
||||||
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
|
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
|
||||||
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
|
DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
|
||||||
|
|
||||||
/* Check passed DllBase param */
|
/* Check passed DllBase param */
|
||||||
if(DllBase == NULL)
|
if(DllBase == NULL)
|
||||||
|
@ -525,7 +525,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||||
{
|
{
|
||||||
/* Yes, calculate the ordinal */
|
/* Yes, calculate the ordinal */
|
||||||
Ordinal = (ULONG)(IMAGE_ORDINAL(ThunkData->u1.Ordinal) - (UINT32)ExportDirectory->Base);
|
Ordinal = (ULONG)(IMAGE_ORDINAL(ThunkData->u1.Ordinal) - (UINT32)ExportDirectory->Base);
|
||||||
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
|
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -543,12 +543,12 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||||
NameTable = (PULONG)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNames));
|
NameTable = (PULONG)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNames));
|
||||||
OrdinalTable = (PUSHORT)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNameOrdinals));
|
OrdinalTable = (PUSHORT)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNameOrdinals));
|
||||||
|
|
||||||
//DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
|
DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
|
||||||
// NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
|
NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
|
||||||
|
|
||||||
/* Get the hint, convert it to a physical pointer */
|
/* Get the hint, convert it to a physical pointer */
|
||||||
Hint = ((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Hint;
|
Hint = ((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Hint;
|
||||||
//DPRINTM(DPRINT_PELOADER, "HintIndex %d\n", Hint);
|
DPRINTM(DPRINT_PELOADER, "HintIndex %d\n", Hint);
|
||||||
|
|
||||||
/* If Hint is less than total number of entries in the export directory,
|
/* If Hint is less than total number of entries in the export directory,
|
||||||
and import name == export name, then we can just get it from the OrdinalTable */
|
and import name == export name, then we can just get it from the OrdinalTable */
|
||||||
|
@ -561,19 +561,20 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Ordinal = OrdinalTable[Hint];
|
Ordinal = OrdinalTable[Hint];
|
||||||
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
|
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* It's not the easy way, we have to lookup import name in the name table.
|
/* It's not the easy way, we have to lookup import name in the name table.
|
||||||
Let's use a binary search for this task. */
|
Let's use a binary search for this task. */
|
||||||
|
|
||||||
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() looking up the import name using binary search...\n");
|
|
||||||
|
|
||||||
/* Low boundary is set to 0, and high boundary to the maximum index */
|
/* Low boundary is set to 0, and high boundary to the maximum index */
|
||||||
Low = 0;
|
Low = 0;
|
||||||
High = ExportDirectory->NumberOfNames - 1;
|
High = ExportDirectory->NumberOfNames - 1;
|
||||||
|
|
||||||
|
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() looking up import '%s' in #0..#%d\n",
|
||||||
|
VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]), High);
|
||||||
|
|
||||||
/* Perform a binary-search loop */
|
/* Perform a binary-search loop */
|
||||||
while (High >= Low)
|
while (High >= Low)
|
||||||
{
|
{
|
||||||
|
@ -584,9 +585,9 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
|
||||||
Result = strcmp(VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Name[0]),
|
Result = strcmp(VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Name[0]),
|
||||||
(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));
|
(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));
|
||||||
|
|
||||||
/*DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '__', Export '%s'\n",*/
|
DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '%s', Export #%ld:'%s' -> %d\n",
|
||||||
/*VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),*/
|
VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),
|
||||||
/*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));*/
|
Middle, (PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])), Result);
|
||||||
|
|
||||||
/*DPRINTM(DPRINT_PELOADER, "TE->u1.AOD %p, fulladdr %p\n",
|
/*DPRINTM(DPRINT_PELOADER, "TE->u1.AOD %p, fulladdr %p\n",
|
||||||
ThunkData->u1.AddressOfData,
|
ThunkData->u1.AddressOfData,
|
||||||
|
|
|
@ -256,7 +256,10 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
sprintf(FullPath,"%s%S", BootPath, FilePath->Buffer);
|
sprintf(FullPath,"%s%S", BootPath, FilePath->Buffer);
|
||||||
Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
|
Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
|
||||||
if (!Status)
|
if (!Status)
|
||||||
|
{
|
||||||
|
DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate a DTE for it
|
// Allocate a DTE for it
|
||||||
Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
|
Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
|
||||||
|
@ -310,6 +313,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
//FIXME: Maybe remove it from the list and try to continue?
|
//FIXME: Maybe remove it from the list and try to continue?
|
||||||
if (!Status)
|
if (!Status)
|
||||||
{
|
{
|
||||||
|
DPRINTM(DPRINT_WARNING, "Can't load boot driver: %wZ\n", &BootDriver->FilePath);
|
||||||
UiMessageBox("Can't load boot driver!");
|
UiMessageBox("Can't load boot driver!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -583,12 +587,16 @@ LoadAndBootWindows(PCSTR OperatingSystemName,
|
||||||
/* Turn on paging mode of CPU*/
|
/* Turn on paging mode of CPU*/
|
||||||
WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt);
|
WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt);
|
||||||
|
|
||||||
|
DbgPrint("Heeelooo\n");
|
||||||
|
|
||||||
/* Save final value of LoaderPagesSpanned */
|
/* Save final value of LoaderPagesSpanned */
|
||||||
LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
|
LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
|
||||||
|
|
||||||
DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
|
DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
|
||||||
KiSystemStartup, LoaderBlockVA);
|
KiSystemStartup, LoaderBlockVA);
|
||||||
|
|
||||||
|
DbgPrint("Heeelooo\n");
|
||||||
|
|
||||||
WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
|
WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
|
||||||
WinLdrpDumpBootDriver(LoaderBlockVA);
|
WinLdrpDumpBootDriver(LoaderBlockVA);
|
||||||
WinLdrpDumpArcDisks(LoaderBlockVA);
|
WinLdrpDumpArcDisks(LoaderBlockVA);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue