[ros-diffs] [tkreuzer] 45431: [FREELDR] - Add DPRINT_WINDOWS DPRINT_PELOADER (the only useful) to DEBUG_ALL and DEBUG_CUSTOM - Enable a few useful DPRINTs

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Feb 5 04:03:38 CET 2010


Author: tkreuzer
Date: Fri Feb  5 04:03:38 2010
New Revision: 45431

URL: http://svn.reactos.org/svn/reactos?rev=45431&view=rev
Log:
[FREELDR]
- Add DPRINT_WINDOWS DPRINT_PELOADER (the only useful) to DEBUG_ALL and DEBUG_CUSTOM
- Enable a few useful DPRINTs

Modified:
    branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/debug.c
    branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/peloader.c
    branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/winldr.c

Modified: branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/debug.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/debug.c?rev=45431&r1=45430&r2=45431&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] Fri Feb  5 04:03:38 2010
@@ -32,15 +32,13 @@
 #if defined (DEBUG_ALL)
 ULONG		DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
 		                 DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
-		                 DPRINT_LINUX | DPRINT_HWDETECT;
+		                 DPRINT_LINUX | DPRINT_HWDETECT | DPRINT_WINDOWS | DPRINT_PELOADER;
 #elif defined (DEBUG_INIFILE)
 ULONG		DebugPrintMask = DPRINT_INIFILE;
 #elif defined (DEBUG_REACTOS)
 ULONG		DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
 #elif defined (DEBUG_CUSTOM)
-ULONG		DebugPrintMask = DPRINT_WARNING |
-		                 DPRINT_UI | DPRINT_CACHE | DPRINT_REACTOS |
-		                 DPRINT_LINUX;
+ULONG		DebugPrintMask = DPRINT_WARNING | DPRINT_WINDOWS | DPRINT_PELOADER;
 #else //#elif defined (DEBUG_NONE)
 ULONG		DebugPrintMask = 0;
 #endif

Modified: branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/peloader.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/peloader.c?rev=45431&r1=45430&r2=45431&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/peloader.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/peloader.c [iso-8859-1] Fri Feb  5 04:03:38 2010
@@ -507,8 +507,8 @@
 	LONG High, Low, Middle, Result;
 	ULONG Hint;
 
-	//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);
+	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);
 
 	/* Check passed DllBase param */
 	if(DllBase == NULL)
@@ -525,7 +525,7 @@
 	{
 		/* Yes, calculate the ordinal */
 		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
 	{
@@ -543,12 +543,12 @@
 		NameTable = (PULONG)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNames));
 		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",
-		//	NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
+		DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
+			NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
 
 		/* Get the hint, convert it to a physical pointer */
 		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,
 		   and import name == export name, then we can just get it from the OrdinalTable */
@@ -561,18 +561,19 @@
 			)
 		{
 			Ordinal = OrdinalTable[Hint];
-			//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
+			DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
 		}
 		else
 		{
 			/* 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. */
-
-			//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 = 0;
 			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 */
 			while (High >= Low)
@@ -584,9 +585,9 @@
 				Result = strcmp(VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Name[0]),
 					(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));
 
-				/*DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '__', Export '%s'\n",*/
-					/*VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),*/
-					/*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));*/
+				DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '%s', Export #%ld:'%s' -> %d\n",
+					VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),
+					Middle, (PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])), Result);
 
 				/*DPRINTM(DPRINT_PELOADER, "TE->u1.AOD %p, fulladdr %p\n",
 					ThunkData->u1.AddressOfData,

Modified: branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/winldr.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/winldr.c?rev=45431&r1=45430&r2=45431&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] Fri Feb  5 04:03:38 2010
@@ -256,7 +256,10 @@
 	sprintf(FullPath,"%s%S", BootPath, FilePath->Buffer);
 	Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
 	if (!Status)
+	{
+		DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage() failed\n");
 		return FALSE;
+	}
 
 	// Allocate a DTE for it
 	Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
@@ -310,6 +313,7 @@
 		//FIXME: Maybe remove it from the list and try to continue?
 		if (!Status)
 		{
+			DPRINTM(DPRINT_WARNING, "Can't load boot driver: %wZ\n", &BootDriver->FilePath);
 			UiMessageBox("Can't load boot driver!");
 			return FALSE;
 		}
@@ -583,11 +587,15 @@
 	/* Turn on paging mode of CPU*/
 	WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt);
 
+DbgPrint("Heeelooo\n");
+
 	/* Save final value of LoaderPagesSpanned */
 	LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
 
 	DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
 		KiSystemStartup, LoaderBlockVA);
+
+DbgPrint("Heeelooo\n");
 
 	WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
 	WinLdrpDumpBootDriver(LoaderBlockVA);




More information about the Ros-diffs mailing list