@@ -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,21 +351,23 @@ 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 );
353355
354- NtLdrOutputLoadMsg (FullPath , NULL );
355- Success = PeLdrLoadImage (FullPath , LoaderBootDriver , & DriverBase );
356+ NtLdrOutputLoadMsg (ArcPath , NULL );
357+ Success = PeLdrLoadImage (ArcPath , LoaderBootDriver , & DriverBase );
356358 if (!Success )
357359 {
358360 ERR ("PeLdrLoadImage('%s') failed\n" , DllName );
359361 return FALSE;
360362 }
361363
362364 // Allocate a DTE for it
365+ RtlStringCbPrintfA (FullFileName , sizeof (FullFileName ), "\\SystemRoot\\%s%s" , DriverPath , DllName );
366+
363367 Success = PeLdrAllocateDataTableEntry (LoadOrderListHead ,
364- DllName ,
365- DllName ,
366- PaToVa (DriverBase ),
368+ DllName ,
369+ FullFileName ,
370+ PaToVa (DriverBase ),
367371 DriverDTE );
368372 if (!Success )
369373 {
@@ -380,8 +384,10 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
380384 (* DriverDTE )-> Flags |= Flags ;
381385
382386 // 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 );
387+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%s" , BootPath , DriverPath );
388+ RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "\\SystemRoot\\%s" , DriverPath );
389+
390+ Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , ArcPath , * DriverDTE );
385391 if (!Success )
386392 {
387393 /* Cleanup and bail out */
@@ -535,6 +541,7 @@ PVOID
535541LoadModule (
536542 IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock ,
537543 IN PCCH Path ,
544+ IN PCCH ArcPath ,
538545 IN PCCH File ,
539546 IN PCCH ImportName , // BaseDllName
540547 IN TYPE_OF_MEMORY MemoryType ,
@@ -543,6 +550,7 @@ LoadModule(
543550{
544551 BOOLEAN Success ;
545552 CHAR FullFileName [MAX_PATH ];
553+ CHAR ArcFileName [MAX_PATH ];
546554 CHAR ProgressString [256 ];
547555 PVOID BaseAddress ;
548556
@@ -552,8 +560,11 @@ LoadModule(
552560 RtlStringCbCopyA (FullFileName , sizeof (FullFileName ), Path );
553561 RtlStringCbCatA (FullFileName , sizeof (FullFileName ), File );
554562
563+ RtlStringCbCopyA (ArcFileName , sizeof (ArcFileName ), ArcPath );
564+ RtlStringCbCatA (ArcFileName , sizeof (ArcFileName ), File );
565+
555566 NtLdrOutputLoadMsg (FullFileName , NULL );
556- Success = PeLdrLoadImage (FullFileName , MemoryType , & BaseAddress );
567+ Success = PeLdrLoadImage (ArcFileName , MemoryType , & BaseAddress );
557568 if (!Success )
558569 {
559570 ERR ("PeLdrLoadImage('%s') failed\n" , File );
@@ -649,15 +660,18 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
649660 PVOID KernelBase , HalBase , KdDllBase = NULL ;
650661 PLDR_DATA_TABLE_ENTRY HalDTE , KdDllDTE = NULL ;
651662 CHAR DirPath [MAX_PATH ];
663+ CHAR ArcPath [MAX_PATH ];
652664 CHAR HalFileName [MAX_PATH ];
653665 CHAR KernelFileName [MAX_PATH ];
654666 CHAR KdDllName [MAX_PATH ];
655667
656668 if (!KernelDTE ) return FALSE;
657669
658670 /* Initialize SystemRoot\System32 path */
659- RtlStringCbCopyA (DirPath , sizeof (DirPath ), BootPath );
660- RtlStringCbCatA (DirPath , sizeof (DirPath ), "system32\\" );
671+ RtlStringCbCopyA (DirPath , sizeof (DirPath ), "\\SystemRoot\\system32\\" );
672+
673+ RtlStringCbCopyA (ArcPath , sizeof (ArcPath ), BootPath );
674+ RtlStringCbCatA (ArcPath , sizeof (ArcPath ), "system32\\" );
661675
662676 /* Parse the boot options */
663677 TRACE ("LoadWindowsCore: BootOptions '%s'\n" , BootOptions );
@@ -780,7 +794,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
780794 */
781795
782796 /* Load the Kernel */
783- KernelBase = LoadModule (LoaderBlock , DirPath , KernelFileName ,
797+ KernelBase = LoadModule (LoaderBlock , DirPath , ArcPath , KernelFileName ,
784798 "ntoskrnl.exe" , LoaderSystemCode , KernelDTE , 30 );
785799 if (!KernelBase )
786800 {
@@ -790,7 +804,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
790804 }
791805
792806 /* Load the HAL */
793- HalBase = LoadModule (LoaderBlock , DirPath , HalFileName ,
807+ HalBase = LoadModule (LoaderBlock , DirPath , ArcPath , HalFileName ,
794808 "hal.dll" , LoaderHalCode , & HalDTE , 35 );
795809 if (!HalBase )
796810 {
@@ -865,7 +879,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
865879 _strlwr (KdDllName );
866880
867881 /* Load the KD DLL. Override its base DLL name to the default "KDCOM.DLL". */
868- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
882+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
869883 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
870884 if (!KdDllBase )
871885 {
@@ -878,7 +892,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
878892 IsCustomKdDll = FALSE;
879893 RtlStringCbCopyA (KdDllName , sizeof (KdDllName ), "kdcom.dll" );
880894
881- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
895+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
882896 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
883897 }
884898
@@ -892,21 +906,21 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
892906 }
893907
894908 /* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
895- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , * KernelDTE );
909+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , * KernelDTE );
896910 if (!Success )
897911 {
898912 UiMessageBox ("Could not load %s" , KernelFileName );
899913 goto Quit ;
900914 }
901- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , HalDTE );
915+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , HalDTE );
902916 if (!Success )
903917 {
904918 UiMessageBox ("Could not load %s" , HalFileName );
905919 goto Quit ;
906920 }
907921 if (KdDllDTE )
908922 {
909- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , KdDllDTE );
923+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , KdDllDTE );
910924 if (!Success )
911925 {
912926 UiMessageBox ("Could not load %s" , KdDllName );
0 commit comments