@@ -296,6 +296,8 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
296296 PLDR_DATA_TABLE_ENTRY * DriverDTE )
297297{
298298 CHAR FullPath [1024 ];
299+ CHAR FullFileName [1024 ];
300+ CHAR ArcPath [1024 ];
299301 CHAR DriverPath [1024 ];
300302 CHAR DllName [1024 ];
301303 PCHAR DriverNamePos ;
@@ -331,18 +333,23 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
331333 }
332334
333335 // It's not loaded, we have to load it
334- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%wZ" , BootPath , FilePath );
336+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%wZ" , BootPath , FilePath );
335337
336- NtLdrOutputLoadMsg (FullPath , NULL );
337- Success = PeLdrLoadImage (FullPath , LoaderBootDriver , & DriverBase );
338+ NtLdrOutputLoadMsg (ArcPath , NULL );
339+ Success = PeLdrLoadImage (ArcPath , LoaderBootDriver , & DriverBase );
338340 if (!Success )
339341 {
340342 ERR ("PeLdrLoadImage('%s') failed\n" , DllName );
341343 return FALSE;
342344 }
343345
344346 // Allocate a DTE for it
345- Success = PeLdrAllocateDataTableEntry (LoadOrderListHead , DllName , DllName , DriverBase , DriverDTE );
347+ RtlStringCbPrintfA (FullFileName , sizeof (FullFileName ), "\\SystemRoot\\%s%s" , DriverPath , DllName );
348+ Success = PeLdrAllocateDataTableEntry (LoadOrderListHead ,
349+ DllName ,
350+ FullFileName ,
351+ DriverBase ,
352+ DriverDTE );
346353 if (!Success )
347354 {
348355 /* Cleanup and bail out */
@@ -358,8 +365,9 @@ WinLdrLoadDeviceDriver(PLIST_ENTRY LoadOrderListHead,
358365 (* DriverDTE )-> Flags |= Flags ;
359366
360367 // Look for any dependencies it may have, and load them too
361- RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "%s%s" , BootPath , DriverPath );
362- Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , * DriverDTE );
368+ RtlStringCbPrintfA (ArcPath , sizeof (ArcPath ), "%s%s" , BootPath , DriverPath );
369+ RtlStringCbPrintfA (FullPath , sizeof (FullPath ), "\\SystemRoot\\%s" , DriverPath );
370+ Success = PeLdrScanImportDescriptorTable (LoadOrderListHead , FullPath , ArcPath , * DriverDTE );
363371 if (!Success )
364372 {
365373 /* Cleanup and bail out */
@@ -513,6 +521,7 @@ PVOID
513521LoadModule (
514522 IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock ,
515523 IN PCCH Path ,
524+ IN PCCH ArcPath ,
516525 IN PCCH File ,
517526 IN PCCH ImportName , // BaseDllName
518527 IN TYPE_OF_MEMORY MemoryType ,
@@ -521,6 +530,7 @@ LoadModule(
521530{
522531 BOOLEAN Success ;
523532 CHAR FullFileName [MAX_PATH ];
533+ CHAR ArcFileName [MAX_PATH ];
524534 CHAR ProgressString [256 ];
525535 PVOID BaseAddress ;
526536
@@ -530,8 +540,11 @@ LoadModule(
530540 RtlStringCbCopyA (FullFileName , sizeof (FullFileName ), Path );
531541 RtlStringCbCatA (FullFileName , sizeof (FullFileName ), File );
532542
533- NtLdrOutputLoadMsg (FullFileName , NULL );
534- Success = PeLdrLoadImage (FullFileName , MemoryType , & BaseAddress );
543+ RtlStringCbCopyA (ArcFileName , sizeof (ArcFileName ), ArcPath );
544+ RtlStringCbCatA (ArcFileName , sizeof (ArcFileName ), File );
545+
546+ NtLdrOutputLoadMsg (ArcFileName , NULL );
547+ Success = PeLdrLoadImage (ArcFileName , MemoryType , & BaseAddress );
535548 if (!Success )
536549 {
537550 ERR ("PeLdrLoadImage('%s') failed\n" , File );
@@ -547,7 +560,7 @@ LoadModule(
547560 if (!Success )
548561 {
549562 /* Cleanup and bail out */
550- ERR ("PeLdrAllocateDataTableEntry('%s') failed\n" , FullFileName );
563+ ERR ("PeLdrAllocateDataTableEntry('%s') failed\n" , ArcFileName );
551564 MmFreeMemory (BaseAddress );
552565 return NULL ;
553566 }
@@ -626,6 +639,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
626639 ULONG OptionLength ;
627640 PVOID KernelBase , HalBase , KdDllBase = NULL ;
628641 PLDR_DATA_TABLE_ENTRY HalDTE , KdDllDTE = NULL ;
642+ CHAR ArcPath [MAX_PATH ];
629643 CHAR DirPath [MAX_PATH ];
630644 CHAR HalFileName [MAX_PATH ];
631645 CHAR KernelFileName [MAX_PATH ];
@@ -634,8 +648,11 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
634648 if (!KernelDTE ) return FALSE;
635649
636650 /* Initialize SystemRoot\System32 path */
637- RtlStringCbCopyA (DirPath , sizeof (DirPath ), BootPath );
638- RtlStringCbCatA (DirPath , sizeof (DirPath ), "system32\\" );
651+ RtlStringCbCopyA (DirPath , sizeof (DirPath ), "\\SystemRoot\\system32\\" );
652+
653+ /* Initialize SystemRoot\System32 arc path */
654+ RtlStringCbCopyA (ArcPath , sizeof (ArcPath ), BootPath );
655+ RtlStringCbCatA (ArcPath , sizeof (ArcPath ), "system32\\" );
639656
640657 /* Parse the boot options */
641658 TRACE ("LoadWindowsCore: BootOptions '%s'\n" , BootOptions );
@@ -758,7 +775,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
758775 */
759776
760777 /* Load the Kernel */
761- KernelBase = LoadModule (LoaderBlock , DirPath , KernelFileName ,
778+ KernelBase = LoadModule (LoaderBlock , DirPath , ArcPath , KernelFileName ,
762779 "ntoskrnl.exe" , LoaderSystemCode , KernelDTE , 30 );
763780 if (!KernelBase )
764781 {
@@ -768,7 +785,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
768785 }
769786
770787 /* Load the HAL */
771- HalBase = LoadModule (LoaderBlock , DirPath , HalFileName ,
788+ HalBase = LoadModule (LoaderBlock , DirPath , ArcPath , HalFileName ,
772789 "hal.dll" , LoaderHalCode , & HalDTE , 35 );
773790 if (!HalBase )
774791 {
@@ -843,7 +860,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
843860 _strlwr (KdDllName );
844861
845862 /* Load the KD DLL. Override its base DLL name to the default "KDCOM.DLL". */
846- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
863+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
847864 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
848865 if (!KdDllBase )
849866 {
@@ -856,7 +873,7 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
856873 IsCustomKdDll = FALSE;
857874 RtlStringCbCopyA (KdDllName , sizeof (KdDllName ), "kdcom.dll" );
858875
859- KdDllBase = LoadModule (LoaderBlock , DirPath , KdDllName ,
876+ KdDllBase = LoadModule (LoaderBlock , DirPath , ArcPath , KdDllName ,
860877 "kdcom.dll" , LoaderSystemCode , & KdDllDTE , 40 );
861878 }
862879
@@ -870,21 +887,21 @@ LoadWindowsCore(IN USHORT OperatingSystemVersion,
870887 }
871888
872889 /* Load all referenced DLLs for Kernel, HAL and Kernel Debugger Transport DLL */
873- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , * KernelDTE );
890+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , * KernelDTE );
874891 if (!Success )
875892 {
876893 UiMessageBox ("Could not load %s" , KernelFileName );
877894 goto Quit ;
878895 }
879- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , HalDTE );
896+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , HalDTE );
880897 if (!Success )
881898 {
882899 UiMessageBox ("Could not load %s" , HalFileName );
883900 goto Quit ;
884901 }
885902 if (KdDllDTE )
886903 {
887- Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , KdDllDTE );
904+ Success = PeLdrScanImportDescriptorTable (& LoaderBlock -> LoadOrderListHead , DirPath , ArcPath , KdDllDTE );
888905 if (!Success )
889906 {
890907 UiMessageBox ("Could not load %s" , KdDllName );
0 commit comments