@@ -316,6 +316,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
316316 PLDR_DATA_TABLE_ENTRY * DriverDTE )
317317{
318318 CHAR FullPath [1024 ];
319+ CHAR FullFileName [1024 ];
320+ CHAR ArcPath [1024 ];
319321 CHAR DriverPath [1024 ];
320322 CHAR DllName [1024 ];
321323 PCHAR DriverNamePos ;
@@ -351,10 +353,11 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
351353 }
352354
353355 // It's not loaded, we have to load it
354- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%wZ" , BootPath , FilePath );
356+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%wZ" , BootPath , FilePath );
357+ RtlStringCbPrintfA (FullFileName , sizeof (FullFileName ), "\\SystemRoot\\%s%s" , DriverPath , DllName );
355358
356- NtLdrOutputLoadMsg (FullPath , NULL );
357- Success = PeLdrLoadImage (FullPath , LoaderBootDriver , & DriverBase );
359+ NtLdrOutputLoadMsg (ArcPath , NULL );
360+ Success = PeLdrLoadImage (ArcPath , LoaderBootDriver , & DriverBase );
358361 if (!Success )
359362 {
360363 ERR ("PeLdrLoadImage('%s') failed\n" , DllName );
@@ -363,9 +366,9 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
363366
364367 // Allocate a DTE for it
365368 Success = PeLdrAllocateDataTableEntry (LoadOrderListHead ,
366- DllName ,
367- DllName ,
368- PaToVa (DriverBase ),
369+ DllName ,
370+ FullFileName ,
371+ PaToVa (DriverBase ),
369372 DriverDTE );
370373 if (!Success )
371374 {
@@ -382,8 +385,10 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
382385 (* DriverDTE )-> Flags |= Flags ;
383386
384387 // Look for any dependencies it may have, and load them too
385- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%s" , BootPath , DriverPath );
386- Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , * DriverDTE );
388+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%s" , BootPath , DriverPath );
389+ RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "\\SystemRoot\\%s" , DriverPath );
390+
391+ Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , ArcPath , * DriverDTE );
387392 if (!Success )
388393 {
389394 /* Cleanup and bail out */
@@ -537,6 +542,7 @@ PVOID
537542LoadModule (
538543 IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock ,
539544 IN PCCH Path ,
545+ IN PCCH ArcPath ,
540546 IN PCCH File ,
541547 IN PCCH ImportName , // BaseDllName
542548 IN TYPE_OF_MEMORY MemoryType ,
@@ -545,6 +551,7 @@ LoadModule(
545551{
546552 BOOLEAN Success ;
547553 CHAR FullFileName [MAX_PATH ];
554+ CHAR ArcFileName [MAX_PATH ];
548555 CHAR ProgressString [256 ];
549556 PVOID BaseAddress ;
550557
@@ -554,8 +561,11 @@ LoadModule(
554561 RtlStringCbCopyA (FullFileName , sizeof (FullFileName ), Path );
555562 RtlStringCbCatA (FullFileName , sizeof (FullFileName ), File );
556563
557- NtLdrOutputLoadMsg (FullFileName , NULL );
558- Success = PeLdrLoadImage (FullFileName , MemoryType , & BaseAddress );
564+ RtlStringCbCopyA (ArcFileName , sizeof (ArcFileName ), ArcPath );
565+ RtlStringCbCatA (ArcFileName , sizeof (ArcFileName ), File );
566+
567+ NtLdrOutputLoadMsg (ArcFileName , NULL );
568+ Success = PeLdrLoadImage (ArcFileName , MemoryType , & BaseAddress );
559569 if (!Success )
560570 {
561571 ERR ("PeLdrLoadImage('%s') failed\n" , File );
@@ -651,15 +661,18 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
651661 PVOID KernelBase , HalBase , KdDllBase = NULL ;
652662 PLDR_DATA_TABLE_ENTRY HalDTE , KdDllDTE = NULL ;
653663 CHAR DirPath [MAX_PATH ];
664+ CHAR ArcPath [MAX_PATH ];
654665 CHAR HalFileName [MAX_PATH ];
655666 CHAR KernelFileName [MAX_PATH ];
656667 CHAR KdDllName [MAX_PATH ];
657668
658669 if (!KernelDTE ) return FALSE;
659670
660671 /* Initialize SystemRoot\System32 path */
661- RtlStringCbCopyA (DirPath , sizeof (DirPath ), BootPath );
662- RtlStringCbCatA (DirPath , sizeof (DirPath ), "system32\\" );
672+ RtlStringCbCopyA (DirPath , sizeof (DirPath ), "\\SystemRoot\\system32\\" );
673+
674+ RtlStringCbCopyA (ArcPath , sizeof (ArcPath ), BootPath );
675+ RtlStringCbCatA (ArcPath , sizeof (ArcPath ), "system32\\" );
663676
664677 /* Parse the boot options */
665678 TRACE ("LoadWindowsCore: BootOptions '%s'\n" , BootOptions );
@@ -782,7 +795,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
782795 */
783796
784797 /* Load the Kernel */
785- KernelBase = LoadModule (LoaderBlock , DirPath , KernelFileName ,
798+ KernelBase = LoadModule (LoaderBlock , DirPath , ArcPath , KernelFileName ,
786799 "ntoskrnl.exe" , LoaderSystemCode , KernelDTE , 30 );
787800 if (!KernelBase )
788801 {
@@ -792,7 +805,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
792805 }
793806
794807 /* Load the HAL */
795- HalBase = LoadModule (LoaderBlock , DirPath , HalFileName ,
808+ HalBase = LoadModule (LoaderBlock , DirPath , ArcPath , HalFileName ,
796809 "hal.dll" , LoaderHalCode , & HalDTE , 35 );
797810 if (!HalBase )
798811 {
@@ -867,7 +880,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
867880 _strlwr (KdDllName );
868881
869882 /* Load the KD DLL. Override its base DLL name to the default "KDCOM.DLL". */
870- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
883+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
871884 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
872885 if (!KdDllBase )
873886 {
@@ -880,7 +893,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
880893 IsCustomKdDll = FALSE;
881894 RtlStringCbCopyA (KdDllName , sizeof (KdDllName ), "kdcom.dll" );
882895
883- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
896+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
884897 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
885898 }
886899
@@ -894,21 +907,21 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
894907 }
895908
896909 /* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
897- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , * KernelDTE );
910+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , * KernelDTE );
898911 if (!Success )
899912 {
900913 UiMessageBox ("Could not load %s" , KernelFileName );
901914 goto Quit ;
902915 }
903- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , HalDTE );
916+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , HalDTE );
904917 if (!Success )
905918 {
906919 UiMessageBox ("Could not load %s" , HalFileName );
907920 goto Quit ;
908921 }
909922 if (KdDllDTE )
910923 {
911- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , KdDllDTE );
924+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , KdDllDTE );
912925 if (!Success )
913926 {
914927 UiMessageBox ("Could not load %s" , KdDllName );
0 commit comments