Skip to content

Commit 4de8a0d

Browse files
committed
[0.4.9] revert [NTDLL/LDR] Overhaul sxs work
This reverts commit 0.4.8-dev-502-g 7000fe2. This reverts commit 0.4.8-dev-503-g f318a25. The two changes were done once to work towards better shim-supporting APIs of newer Windows versions on demand in the future. Luckily we do not depend on them yet. Giannis already fixed most regressions of the 2 commits before branching 0.4.8RC (e.g. 2nd stage theme-selector). Unfortunately we still have issues atm with the existing mixture of Wine comctl32 v5 vs v6. The image-lists of both are not compatible as Giannis told us. We revert both commits for this release to fix CORE-14433 (missing icons due to incompatible image-lists). We can not simply add a manifest here, because 3rd party apps are affected. I double-checked, all of those (formerly affected) apps are working fine and show the icons after the revert: 2nd-stage-theme-selection, MS Excel Viewer 2007 open-dlg, MSVCPP 6 installer open-dlg, FaxViewer save-dlg, MS Word Viewer 2003 open-dlg This revert also obsoletes works/fixes like 2f11904. (cherry picked from commit 11bf8fa)
1 parent ad20c37 commit 4de8a0d

File tree

3 files changed

+277
-509
lines changed

3 files changed

+277
-509
lines changed

dll/ntdll/ldr/ldrpe.c

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
803803
return Status;
804804
}
805805

806+
/* FIXME: This function is missing SxS support */
806807
NTSTATUS
807808
NTAPI
808809
LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
@@ -818,14 +819,9 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
818819
NTSTATUS Status;
819820
PPEB Peb = RtlGetCurrentPeb();
820821
PTEB Teb = NtCurrentTeb();
821-
UNICODE_STRING RedirectedImpDescName;
822-
BOOLEAN RedirectedDll;
823822

824823
DPRINT("LdrpLoadImportModule('%S' '%s' %p %p)\n", DllPath, ImportName, DataTableEntry, Existing);
825824

826-
RedirectedDll = FALSE;
827-
RtlInitEmptyUnicodeString(&RedirectedImpDescName, NULL, 0);
828-
829825
/* Convert import descriptor name to unicode string */
830826
ImpDescName = &Teb->StaticUnicodeString;
831827
RtlInitAnsiString(&AnsiString, ImportName);
@@ -875,59 +871,76 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
875871
&LdrApiDefaultExtension);
876872
}
877873

878-
/* Check if the SxS Assemblies specify another file */
879-
Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE,
880-
ImpDescName,
881-
&LdrApiDefaultExtension,
882-
NULL,
883-
&RedirectedImpDescName,
884-
&ImpDescName,
885-
NULL,
886-
NULL,
887-
NULL);
888-
889-
/* Check success */
890-
if (NT_SUCCESS(Status))
891-
{
892-
/* Let Ldrp know */
893-
RedirectedDll = TRUE;
894-
}
895-
else if (Status != STATUS_SXS_KEY_NOT_FOUND)
896-
{
897-
/* Unrecoverable SxS failure */
898-
DPRINT1("LDR: RtlDosApplyFileIsolationRedirection_Ustr failed with status %x for dll %wZ\n", Status, ImpDescName);
899-
goto done;
900-
}
901-
902874
/* Check if it's loaded */
903875
if (LdrpCheckForLoadedDll(DllPath,
904876
ImpDescName,
905877
TRUE,
906-
RedirectedDll,
878+
FALSE,
907879
DataTableEntry))
908880
{
909881
/* It's already existing in the list */
910882
*Existing = TRUE;
911-
Status = STATUS_SUCCESS;
912-
goto done;
883+
return STATUS_SUCCESS;
913884
}
914885

915886
/* We're loading it for the first time */
916887
*Existing = FALSE;
917888

889+
#if 0
890+
/* Load manifest */
891+
{
892+
ACTCTX_SECTION_KEYED_DATA data;
893+
NTSTATUS status;
894+
895+
//DPRINT1("find_actctx_dll for %S\n", fullname);
896+
//RtlInitUnicodeString(&nameW, libname);
897+
data.cbSize = sizeof(data);
898+
status = RtlFindActivationContextSectionString(
899+
FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
900+
ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
901+
ImpDescName,
902+
&data);
903+
//if (status != STATUS_SUCCESS) return status;
904+
DPRINT1("Status: 0x%08X\n", status);
905+
906+
if (NT_SUCCESS(status))
907+
{
908+
ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
909+
SIZE_T needed, size = 1024;
910+
911+
for (;;)
912+
{
913+
if (!(info = RtlAllocateHeap(RtlGetProcessHeap(), 0, size)))
914+
{
915+
status = STATUS_NO_MEMORY;
916+
goto done;
917+
}
918+
status = RtlQueryInformationActivationContext(0, data.hActCtx, &data.ulAssemblyRosterIndex,
919+
AssemblyDetailedInformationInActivationContext,
920+
info, size, &needed);
921+
if (status == STATUS_SUCCESS) break;
922+
if (status != STATUS_BUFFER_TOO_SMALL) goto done;
923+
RtlFreeHeap(RtlGetProcessHeap(), 0, info);
924+
size = needed;
925+
}
926+
927+
DPRINT("manifestpath === %S\n", info->lpAssemblyManifestPath);
928+
DPRINT("DirectoryName === %S\n", info->lpAssemblyDirectoryName);
929+
}
930+
}
931+
done:
932+
#endif
933+
918934
/* Map it */
919935
Status = LdrpMapDll(DllPath,
920936
NULL,
921937
ImpDescName->Buffer,
922938
NULL,
923939
TRUE,
924-
RedirectedDll,
940+
FALSE,
925941
DataTableEntry);
926-
if (!NT_SUCCESS(Status))
927-
{
928-
DPRINT1("LDR: LdrpMapDll failed with status %x for dll %wZ\n", Status, ImpDescName);
929-
goto done;
930-
}
942+
943+
if (!NT_SUCCESS(Status)) return Status;
931944

932945
/* Walk its import descriptor table */
933946
Status = LdrpWalkImportDescriptor(DllPath,
@@ -939,9 +952,6 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
939952
&(*DataTableEntry)->InInitializationOrderLinks);
940953
}
941954

942-
done:
943-
RtlFreeUnicodeString(&RedirectedImpDescName);
944-
945955
return Status;
946956
}
947957

0 commit comments

Comments
 (0)