@@ -314,6 +314,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
314314 PLDR_DATA_TABLE_ENTRY * DriverDTE )
315315{
316316 CHAR FullPath [1024 ];
317+ CHAR FullFileName [1024 ];
318+ CHAR ArcPath [1024 ];
317319 CHAR DriverPath [1024 ];
318320 CHAR DllName [1024 ];
319321 PCHAR DriverNamePos ;
@@ -349,10 +351,11 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
349351 }
350352
351353 // It's not loaded, we have to load it
352- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%wZ" , BootPath , FilePath );
354+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%wZ" , BootPath , FilePath );
355+ RtlStringCbPrintfA (FullFileName , sizeof (FullFileName ), "\\SystemRoot\\%s%s" , DriverPath , DllName );
353356
354- NtLdrOutputLoadMsg (FullPath , NULL );
355- Success = PeLdrLoadImage (FullPath , LoaderBootDriver , & DriverBase );
357+ NtLdrOutputLoadMsg (ArcPath , NULL );
358+ Success = PeLdrLoadImage (ArcPath , LoaderBootDriver , & DriverBase );
356359 if (!Success )
357360 {
358361 ERR ("PeLdrLoadImage('%s') failed\n" , DllName );
@@ -361,9 +364,9 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
361364
362365 // Allocate a DTE for it
363366 Success = PeLdrAllocateDataTableEntry (LoadOrderListHead ,
364- DllName ,
365- DllName ,
366- PaToVa (DriverBase ),
367+ DllName ,
368+ FullFileName ,
369+ PaToVa (DriverBase ),
367370 DriverDTE );
368371 if (!Success )
369372 {
@@ -380,8 +383,10 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
380383 (* DriverDTE )-> Flags |= Flags ;
381384
382385 // Look for any dependencies it may have, and load them too
383- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%s" , BootPath , DriverPath );
384- Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , * DriverDTE );
386+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%s" , BootPath , DriverPath );
387+ RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "\\SystemRoot\\%s" , DriverPath );
388+
389+ Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , ArcPath , * DriverDTE );
385390 if (!Success )
386391 {
387392 /* Cleanup and bail out */
@@ -535,6 +540,7 @@ PVOID
535540LoadModule (
536541 IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock ,
537542 IN PCCH Path ,
543+ IN PCCH ArcPath ,
538544 IN PCCH File ,
539545 IN PCCH ImportName , // BaseDllName
540546 IN TYPE_OF_MEMORY MemoryType ,
@@ -543,6 +549,7 @@ LoadModule(
543549{
544550 BOOLEAN Success ;
545551 CHAR FullFileName [MAX_PATH ];
552+ CHAR ArcFileName [MAX_PATH ];
546553 CHAR ProgressString [256 ];
547554 PVOID BaseAddress ;
548555
@@ -552,8 +559,11 @@ LoadModule(
552559 RtlStringCbCopyA (FullFileName , sizeof (FullFileName ), Path );
553560 RtlStringCbCatA (FullFileName , sizeof (FullFileName ), File );
554561
555- NtLdrOutputLoadMsg (FullFileName , NULL );
556- Success = PeLdrLoadImage (FullFileName , MemoryType , & BaseAddress );
562+ RtlStringCbCopyA (ArcFileName , sizeof (ArcFileName ), ArcPath );
563+ RtlStringCbCatA (ArcFileName , sizeof (ArcFileName ), File );
564+
565+ NtLdrOutputLoadMsg (ArcFileName , NULL );
566+ Success = PeLdrLoadImage (ArcFileName , MemoryType , & BaseAddress );
557567 if (!Success )
558568 {
559569 ERR ("PeLdrLoadImage('%s') failed\n" , File );
@@ -649,15 +659,18 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
649659 PVOID KernelBase , HalBase , KdDllBase = NULL ;
650660 PLDR_DATA_TABLE_ENTRY HalDTE , KdDllDTE = NULL ;
651661 CHAR DirPath [MAX_PATH ];
662+ CHAR ArcPath [MAX_PATH ];
652663 CHAR HalFileName [MAX_PATH ];
653664 CHAR KernelFileName [MAX_PATH ];
654665 CHAR KdDllName [MAX_PATH ];
655666
656667 if (!KernelDTE ) return FALSE;
657668
658669 /* Initialize SystemRoot\System32 path */
659- RtlStringCbCopyA (DirPath , sizeof (DirPath ), BootPath );
660- RtlStringCbCatA (DirPath , sizeof (DirPath ), "system32\\" );
670+ RtlStringCbCopyA (DirPath , sizeof (DirPath ), "\\SystemRoot\\system32\\" );
671+
672+ RtlStringCbCopyA (ArcPath , sizeof (ArcPath ), BootPath );
673+ RtlStringCbCatA (ArcPath , sizeof (ArcPath ), "system32\\" );
661674
662675 /* Parse the boot options */
663676 TRACE ("LoadWindowsCore: BootOptions '%s'\n" , BootOptions );
@@ -780,7 +793,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
780793 */
781794
782795 /* Load the Kernel */
783- KernelBase = LoadModule (LoaderBlock , DirPath , KernelFileName ,
796+ KernelBase = LoadModule (LoaderBlock , DirPath , ArcPath , KernelFileName ,
784797 "ntoskrnl.exe" , LoaderSystemCode , KernelDTE , 30 );
785798 if (!KernelBase )
786799 {
@@ -790,7 +803,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
790803 }
791804
792805 /* Load the HAL */
793- HalBase = LoadModule (LoaderBlock , DirPath , HalFileName ,
806+ HalBase = LoadModule (LoaderBlock , DirPath , ArcPath , HalFileName ,
794807 "hal.dll" , LoaderHalCode , & HalDTE , 35 );
795808 if (!HalBase )
796809 {
@@ -865,7 +878,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
865878 _strlwr (KdDllName );
866879
867880 /* Load the KD DLL. Override its base DLL name to the default "KDCOM.DLL". */
868- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
881+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
869882 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
870883 if (!KdDllBase )
871884 {
@@ -878,7 +891,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
878891 IsCustomKdDll = FALSE;
879892 RtlStringCbCopyA (KdDllName , sizeof (KdDllName ), "kdcom.dll" );
880893
881- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
894+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
882895 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
883896 }
884897
@@ -892,21 +905,21 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
892905 }
893906
894907 /* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
895- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , * KernelDTE );
908+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , * KernelDTE );
896909 if (!Success )
897910 {
898911 UiMessageBox ("Could not load %s" , KernelFileName );
899912 goto Quit ;
900913 }
901- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , HalDTE );
914+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , HalDTE );
902915 if (!Success )
903916 {
904917 UiMessageBox ("Could not load %s" , HalFileName );
905918 goto Quit ;
906919 }
907920 if (KdDllDTE )
908921 {
909- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , KdDllDTE );
922+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , KdDllDTE );
910923 if (!Success )
911924 {
912925 UiMessageBox ("Could not load %s" , KdDllName );
0 commit comments