@@ -690,7 +690,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
690
690
PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry = NULL ;
691
691
PIMAGE_IMPORT_DESCRIPTOR ImportEntry ;
692
692
ULONG BoundSize , IatSize ;
693
- DPRINT ("LdrpWalkImportDescriptor('%S' %p)\n" , DllPath , LdrEntry );
693
+
694
+ DPRINT ("LdrpWalkImportDescriptor - BEGIN (%wZ %p '%S')\n" , & LdrEntry -> BaseDllName , LdrEntry , DllPath );
694
695
695
696
/* Set up the Act Ctx */
696
697
RtlZeroMemory (& ActCtx , sizeof (ActCtx ));
@@ -711,7 +712,7 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
711
712
Status2 != STATUS_RESOURCE_LANG_NOT_FOUND )
712
713
{
713
714
/* Some serious issue */
714
- Status = Status2 ;
715
+ // Status = Status2; // FIXME: Ignore that error for now
715
716
DbgPrintEx (DPFLTR_SXS_ID ,
716
717
DPFLTR_WARNING_LEVEL ,
717
718
"LDR: LdrpWalkImportDescriptor() failed to probe %wZ for its "
@@ -724,16 +725,20 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
724
725
if (!NT_SUCCESS (Status )) return Status ;
725
726
726
727
/* Get the Active ActCtx */
727
- Status = RtlGetActiveActivationContext (& LdrEntry -> EntryPointActivationContext );
728
- if (!NT_SUCCESS (Status ))
728
+ if (!LdrEntry -> EntryPointActivationContext )
729
729
{
730
- /* Exit */
731
- DbgPrintEx (DPFLTR_SXS_ID ,
732
- DPFLTR_WARNING_LEVEL ,
733
- "LDR: RtlGetActiveActivationContext() failed; ntstatus = "
734
- "0x%08lx\n" ,
735
- Status );
736
- return Status ;
730
+ Status = RtlGetActiveActivationContext (& LdrEntry -> EntryPointActivationContext );
731
+
732
+ if (!NT_SUCCESS (Status ))
733
+ {
734
+ /* Exit */
735
+ DbgPrintEx (DPFLTR_SXS_ID ,
736
+ DPFLTR_WARNING_LEVEL ,
737
+ "LDR: RtlGetActiveActivationContext() failed; ntstatus = "
738
+ "0x%08lx\n" ,
739
+ Status );
740
+ return Status ;
741
+ }
737
742
}
738
743
739
744
/* Activate the ActCtx */
@@ -807,6 +812,8 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
807
812
/* Release the activation context */
808
813
RtlDeactivateActivationContextUnsafeFast (& ActCtx );
809
814
815
+ DPRINT ("LdrpWalkImportDescriptor - END (%wZ %p)\n" , & LdrEntry -> BaseDllName , LdrEntry );
816
+
810
817
/* Return status */
811
818
return Status ;
812
819
}
@@ -826,7 +833,7 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
826
833
PPEB Peb = RtlGetCurrentPeb ();
827
834
PTEB Teb = NtCurrentTeb ();
828
835
829
- DPRINT ("LdrpLoadImportModule('%S' '% s' %p %p %p)\n" , DllPath , ImportName , DllBase , DataTableEntry , Existing );
836
+ DPRINT ("LdrpLoadImportModule('%s' %p %p %p '%S' )\n" , ImportName , DllBase , DataTableEntry , Existing , DllPath );
830
837
831
838
/* Convert import descriptor name to unicode string */
832
839
ImpDescName = & Teb -> StaticUnicodeString ;
@@ -849,6 +856,51 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
849
856
/* We're loading it for the first time */
850
857
* Existing = FALSE;
851
858
859
+ #if 0
860
+ /* Load manifest */
861
+ {
862
+ ACTCTX_SECTION_KEYED_DATA data ;
863
+ NTSTATUS status ;
864
+
865
+ //DPRINT1("find_actctx_dll for %S\n", fullname);
866
+ //RtlInitUnicodeString(&nameW, libname);
867
+ data .cbSize = sizeof (data );
868
+ status = RtlFindActivationContextSectionString (
869
+ FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX , NULL ,
870
+ ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION ,
871
+ ImpDescName ,
872
+ & data );
873
+ //if (status != STATUS_SUCCESS) return status;
874
+ DPRINT1 ("Status: 0x%08X\n" , status );
875
+
876
+ if (NT_SUCCESS (status ))
877
+ {
878
+ ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION * info ;
879
+ SIZE_T needed , size = 1024 ;
880
+
881
+ for (;;)
882
+ {
883
+ if (!(info = RtlAllocateHeap (RtlGetProcessHeap (), 0 , size )))
884
+ {
885
+ status = STATUS_NO_MEMORY ;
886
+ goto done ;
887
+ }
888
+ status = RtlQueryInformationActivationContext (0 , data .hActCtx , & data .ulAssemblyRosterIndex ,
889
+ AssemblyDetailedInformationInActivationContext ,
890
+ info , size , & needed );
891
+ if (status == STATUS_SUCCESS ) break ;
892
+ if (status != STATUS_BUFFER_TOO_SMALL ) goto done ;
893
+ RtlFreeHeap (RtlGetProcessHeap (), 0 , info );
894
+ size = needed ;
895
+ }
896
+
897
+ DPRINT ("manifestpath === %S\n" , info -> lpAssemblyManifestPath );
898
+ DPRINT ("DirectoryName === %S\n" , info -> lpAssemblyDirectoryName );
899
+ }
900
+ }
901
+ done :
902
+ #endif
903
+
852
904
/* Map it */
853
905
Status = LdrpMapDll (DllPath ,
854
906
NULL ,
0 commit comments