@@ -295,6 +295,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
295295 PLDR_DATA_TABLE_ENTRY * DriverDTE )
296296{
297297 CHAR FullPath [1024 ];
298+ CHAR FullFileName [1024 ];
299+ CHAR ArcPath [1024 ];
298300 CHAR DriverPath [1024 ];
299301 CHAR DllName [1024 ];
300302 PCHAR DriverNamePos ;
@@ -330,20 +332,21 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
330332 }
331333
332334 // It's not loaded, we have to load it
333- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%wZ" , BootPath , FilePath );
335+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%wZ" , BootPath , FilePath );
334336
335- NtLdrOutputLoadMsg (FullPath , NULL );
336- Success = PeLdrLoadImage (FullPath , LoaderBootDriver , & DriverBase );
337+ NtLdrOutputLoadMsg (ArcPath , NULL );
338+ Success = PeLdrLoadImage (ArcPath , LoaderBootDriver , & DriverBase );
337339 if (!Success )
338340 {
339341 ERR ("PeLdrLoadImage('%s') failed\n" , DllName );
340342 return FALSE;
341343 }
342344
343345 // Allocate a DTE for it
346+ RtlStringCbPrintfA (FullFileName , sizeof (FullFileName ), "\\SystemRoot\\%s%s" , DriverPath , DllName );
344347 Success = PeLdrAllocateDataTableEntry (LoadOrderListHead ,
345348 DllName ,
346- DllName ,
349+ FullFileName ,
347350 PaToVa (DriverBase ),
348351 DriverDTE );
349352 if (!Success )
@@ -361,8 +364,9 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
361364 (* DriverDTE )-> Flags |= Flags ;
362365
363366 // Look for any dependencies it may have, and load them too
364- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%s" , BootPath , DriverPath );
365- Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , * DriverDTE );
367+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%s" , BootPath , DriverPath );
368+ RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "\\SystemRoot\\%s" , DriverPath );
369+ Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , ArcPath , * DriverDTE );
366370 if (!Success )
367371 {
368372 /* Cleanup and bail out */
@@ -516,6 +520,7 @@ PVOID
516520LoadModule (
517521 IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock ,
518522 IN PCCH Path ,
523+ IN PCCH ArcPath ,
519524 IN PCCH File ,
520525 IN PCCH ImportName , // BaseDllName
521526 IN TYPE_OF_MEMORY MemoryType ,
@@ -524,6 +529,7 @@ LoadModule(
524529{
525530 BOOLEAN Success ;
526531 CHAR FullFileName [MAX_PATH ];
532+ CHAR ArcFileName [MAX_PATH ];
527533 CHAR ProgressString [256 ];
528534 PVOID BaseAddress ;
529535
@@ -533,8 +539,11 @@ LoadModule(
533539 RtlStringCbCopyA (FullFileName , sizeof (FullFileName ), Path );
534540 RtlStringCbCatA (FullFileName , sizeof (FullFileName ), File );
535541
536- NtLdrOutputLoadMsg (FullFileName , NULL );
537- Success = PeLdrLoadImage (FullFileName , MemoryType , & BaseAddress );
542+ RtlStringCbCopyA (ArcFileName , sizeof (ArcFileName ), ArcPath );
543+ RtlStringCbCatA (ArcFileName , sizeof (ArcFileName ), File );
544+
545+ NtLdrOutputLoadMsg (ArcFileName , NULL );
546+ Success = PeLdrLoadImage (ArcFileName , MemoryType , & BaseAddress );
538547 if (!Success )
539548 {
540549 ERR ("PeLdrLoadImage('%s') failed\n" , File );
@@ -550,7 +559,7 @@ LoadModule(
550559 if (!Success )
551560 {
552561 /* Cleanup and bail out */
553- ERR ("PeLdrAllocateDataTableEntry('%s') failed\n" , FullFileName );
562+ ERR ("PeLdrAllocateDataTableEntry('%s') failed\n" , ArcFileName );
554563 MmFreeMemory (BaseAddress );
555564 return NULL ;
556565 }
@@ -629,6 +638,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
629638 ULONG OptionLength ;
630639 PVOID KernelBase , HalBase , KdDllBase = NULL ;
631640 PLDR_DATA_TABLE_ENTRY HalDTE , KdDllDTE = NULL ;
641+ CHAR ArcPath [MAX_PATH ];
632642 CHAR DirPath [MAX_PATH ];
633643 CHAR HalFileName [MAX_PATH ];
634644 CHAR KernelFileName [MAX_PATH ];
@@ -637,8 +647,11 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
637647 if (!KernelDTE ) return FALSE;
638648
639649 /* Initialize SystemRoot\System32 path */
640- RtlStringCbCopyA (DirPath , sizeof (DirPath ), BootPath );
641- RtlStringCbCatA (DirPath , sizeof (DirPath ), "system32\\" );
650+ RtlStringCbCopyA (DirPath , sizeof (DirPath ), "\\SystemRoot\\system32\\" );
651+
652+ /* Initialize SystemRoot\System32 arc path */
653+ RtlStringCbCopyA (ArcPath , sizeof (ArcPath ), BootPath );
654+ RtlStringCbCatA (ArcPath , sizeof (ArcPath ), "system32\\" );
642655
643656 /* Parse the boot options */
644657 TRACE ("LoadWindowsCore: BootOptions '%s'\n" , BootOptions );
@@ -761,7 +774,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
761774 */
762775
763776 /* Load the Kernel */
764- KernelBase = LoadModule (LoaderBlock , DirPath , KernelFileName ,
777+ KernelBase = LoadModule (LoaderBlock , DirPath , ArcPath , KernelFileName ,
765778 "ntoskrnl.exe" , LoaderSystemCode , KernelDTE , 30 );
766779 if (!KernelBase )
767780 {
@@ -771,7 +784,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
771784 }
772785
773786 /* Load the HAL */
774- HalBase = LoadModule (LoaderBlock , DirPath , HalFileName ,
787+ HalBase = LoadModule (LoaderBlock , DirPath , ArcPath , HalFileName ,
775788 "hal.dll" , LoaderHalCode , & HalDTE , 35 );
776789 if (!HalBase )
777790 {
@@ -846,7 +859,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
846859 _strlwr (KdDllName );
847860
848861 /* Load the KD DLL. Override its base DLL name to the default "KDCOM.DLL". */
849- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
862+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
850863 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
851864 if (!KdDllBase )
852865 {
@@ -859,7 +872,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
859872 IsCustomKdDll = FALSE;
860873 RtlStringCbCopyA (KdDllName , sizeof (KdDllName ), "kdcom.dll" );
861874
862- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
875+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
863876 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
864877 }
865878
@@ -873,21 +886,21 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
873886 }
874887
875888 /* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
876- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , * KernelDTE );
889+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , * KernelDTE );
877890 if (!Success )
878891 {
879892 UiMessageBox ("Could not load %s" , KernelFileName );
880893 goto Quit ;
881894 }
882- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , HalDTE );
895+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , HalDTE );
883896 if (!Success )
884897 {
885898 UiMessageBox ("Could not load %s" , HalFileName );
886899 goto Quit ;
887900 }
888901 if (KdDllDTE )
889902 {
890- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , KdDllDTE );
903+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , KdDllDTE );
891904 if (!Success )
892905 {
893906 UiMessageBox ("Could not load %s" , KdDllName );
0 commit comments