@@ -130,6 +130,7 @@ static BOOLEAN
130130PeLdrpLoadAndScanReferencedDll (
131131 IN OUT PLIST_ENTRY ModuleListHead ,
132132 IN PCCH DirectoryPath ,
133+ IN PCCH ArcPath ,
133134 IN PCH ImportName ,
134135 IN PLIST_ENTRY Parent OPTIONAL ,
135136 OUT PLDR_DATA_TABLE_ENTRY * DataTableEntry );
@@ -145,6 +146,7 @@ PeLdrpBindImportName(
145146 _In_ ULONG ExportSize ,
146147 _In_ BOOLEAN ProcessForwards ,
147148 _In_ PCSTR DirectoryPath ,
149+ _In_ PCSTR ArcPath ,
148150 _In_ PLIST_ENTRY Parent )
149151{
150152 ULONG Ordinal ;
@@ -316,6 +318,7 @@ PeLdrpBindImportName(
316318 /* Now let's try to load it! */
317319 Success = PeLdrpLoadAndScanReferencedDll (ModuleListHead ,
318320 DirectoryPath ,
321+ ArcPath ,
319322 ForwardDllName ,
320323 Parent ,
321324 & DataTableEntry );
@@ -366,6 +369,7 @@ PeLdrpBindImportName(
366369 RefExportSize ,
367370 TRUE,
368371 DirectoryPath ,
372+ ArcPath ,
369373 Parent );
370374
371375 /* Fill out the ThunkData with data from RefThunkData */
@@ -389,28 +393,33 @@ static BOOLEAN
389393PeLdrpLoadAndScanReferencedDll (
390394 IN OUT PLIST_ENTRY ModuleListHead ,
391395 IN PCCH DirectoryPath ,
396+ IN PCCH ArcPath ,
392397 IN PCH ImportName ,
393398 IN PLIST_ENTRY Parent OPTIONAL ,
394399 OUT PLDR_DATA_TABLE_ENTRY * DataTableEntry )
395400{
396401 CHAR FullDllName [256 ];
402+ CHAR ArcFullDllName [256 ];
397403 BOOLEAN Success ;
398404 PVOID BasePA = NULL ;
399405
400406 /* Prepare the full path to the file to be loaded */
401407 RtlStringCbCopyA (FullDllName , sizeof (FullDllName ), DirectoryPath );
402408 RtlStringCbCatA (FullDllName , sizeof (FullDllName ), ImportName );
403409
410+ RtlStringCbCopyA (ArcFullDllName , sizeof (ArcFullDllName ), ArcPath );
411+ RtlStringCbCatA (ArcFullDllName , sizeof (ArcFullDllName ), ImportName );
412+
404413 TRACE ("Loading referenced DLL: %s\n" , FullDllName );
405414
406415 if (PeLdrImportDllLoadCallback )
407- PeLdrImportDllLoadCallback (FullDllName );
416+ PeLdrImportDllLoadCallback (ArcFullDllName );
408417
409418 /* Load the image */
410- Success = PeLdrLoadImage (FullDllName , LoaderBootDriver , & BasePA );
419+ Success = PeLdrLoadImage (ArcFullDllName , LoaderBootDriver , & BasePA );
411420 if (!Success )
412421 {
413- ERR ("PeLdrLoadImage('%s') failed\n" , FullDllName );
422+ ERR ("PeLdrLoadImage('%s') failed\n" , ArcFullDllName );
414423 return Success ;
415424 }
416425
@@ -437,7 +446,7 @@ PeLdrpLoadAndScanReferencedDll(
437446 TRACE ("PeLdrScanImportDescriptorTable() calling ourselves for '%.*S'\n" ,
438447 (* DataTableEntry )-> BaseDllName .Length / sizeof (WCHAR ),
439448 VaToPa ((* DataTableEntry )-> BaseDllName .Buffer ));
440- Success = PeLdrScanImportDescriptorTable (ModuleListHead , DirectoryPath , * DataTableEntry );
449+ Success = PeLdrScanImportDescriptorTable (ModuleListHead , DirectoryPath , ArcPath , * DataTableEntry );
441450 if (!Success )
442451 {
443452 /* Cleanup and bail out */
@@ -458,6 +467,7 @@ PeLdrpScanImportAddressTable(
458467 _In_ PIMAGE_THUNK_DATA ThunkName ,
459468 _Inout_ PIMAGE_THUNK_DATA ThunkData ,
460469 _In_ PCSTR DirectoryPath ,
470+ _In_ PCSTR ArcPath ,
461471 _In_ PLIST_ENTRY Parent )
462472{
463473 PIMAGE_EXPORT_DIRECTORY ExportDirectory = NULL ;
@@ -504,6 +514,7 @@ PeLdrpScanImportAddressTable(
504514 ExportSize ,
505515 FALSE,
506516 DirectoryPath ,
517+ ArcPath ,
507518 Parent );
508519 /* Fail if binding was unsuccessful */
509520 if (!Success )
@@ -629,6 +640,7 @@ BOOLEAN
629640PeLdrScanImportDescriptorTable (
630641 IN OUT PLIST_ENTRY ModuleListHead ,
631642 IN PCCH DirectoryPath ,
643+ IN PCCH ArcPath ,
632644 IN PLDR_DATA_TABLE_ENTRY ScanDTE )
633645{
634646 PLDR_DATA_TABLE_ENTRY DataTableEntry ;
@@ -675,6 +687,7 @@ PeLdrScanImportDescriptorTable(
675687 {
676688 Success = PeLdrpLoadAndScanReferencedDll (ModuleListHead ,
677689 DirectoryPath ,
690+ ArcPath ,
678691 ImportName ,
679692 & ScanDTE -> InLoadOrderLinks ,
680693 & DataTableEntry );
@@ -692,6 +705,7 @@ PeLdrScanImportDescriptorTable(
692705 ThunkName ,
693706 ThunkData ,
694707 DirectoryPath ,
708+ ArcPath ,
695709 & ScanDTE -> InLoadOrderLinks );
696710
697711 if (!Success )
@@ -1083,7 +1097,7 @@ PeLdrLoadBootImage(
10831097 }
10841098
10851099 /* Resolve imports */
1086- Success = PeLdrScanImportDescriptorTable (& FrLdrModuleList , "" , * DataTableEntry );
1100+ Success = PeLdrScanImportDescriptorTable (& FrLdrModuleList , "" , "" , * DataTableEntry );
10871101 if (!Success )
10881102 {
10891103 /* Cleanup and bail out */
0 commit comments