Componenets installed by winetricks have "deadbeef.manifest" trailer in their manifests, so it's not clear that filtering logic works. On the other hand when manifests for versions 1.2.3.4 and 1.2.3.10 are installed and application exe needs version 1.2.0.0 and later uses LoadLibrary() to load a plugin.dll that needs 1.2.3.7, version 1.2.3.4 gets loaded with an .exe (because manifest for version 1.2.3.10 is ignored) and version 1.2.3.10 gets loaded with a plugin.dll, and this leads to crashes.
From: Dmitry Timoshkov dmitry@baikal.ru
Componenets installed by winetricks have "deadbeef.manifest" trailer in their manifests, so it's not clear that filtering logic works. On the other hand when manifests for versions 1.2.3.4 and 1.2.3.10 are installed and application exe needs version 1.2.0.0 and later uses LoadLibrary() to load a plugin.dll that needs 1.2.3.7, version 1.2.3.4 gets loaded with an .exe (because manifest for version 1.2.3.10 is ignored) and version 1.2.3.10 gets loaded with a plugin.dll, and this leads to crashes.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/ntdll/actctx.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index a4581d05b91..501db15356e 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -3159,7 +3159,6 @@ static NTSTATUS get_manifest_in_associated_manifest( struct actctx_loader* acl, static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai ) { static const WCHAR lookup_fmtW[] = L"%s_%s_%s_%u.%u.*.*_%s_*.manifest"; - static const WCHAR wine_trailerW[] = {'d','e','a','d','b','e','e','f','.','m','a','n','i','f','e','s','t'};
WCHAR *lookup, *ret = NULL; UNICODE_STRING lookup_us; @@ -3211,22 +3210,8 @@ static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai ) tmp = wcschr(tmp, '.') + 1; revision = wcstoul( tmp, NULL, 10 ); if (build == min_build && revision < min_revision) continue; - tmp = wcschr(tmp, '_') + 1; - tmp = wcschr(tmp, '_') + 1; - if (dir_info->FileNameLength - (tmp - dir_info->FileName) * sizeof(WCHAR) == sizeof(wine_trailerW) && - !wcsnicmp( tmp, wine_trailerW, ARRAY_SIZE( wine_trailerW ))) - { - /* prefer a non-Wine manifest if we already have one */ - /* we'll still load the builtin dll if specified through DllOverrides */ - if (ret) continue; - } - else - { - min_build = build; - min_revision = revision; - } - ai->version.build = build; - ai->version.revision = revision; + ai->version.build = min_build = build; + ai->version.revision = min_revision = revision; RtlFreeHeap( GetProcessHeap(), 0, ret ); if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, dir_info->FileNameLength + sizeof(WCHAR) ))) {
This patch fixes the case when an application installed manifest and one installed with winetricks differ in build/revision fields, however due to a bug (that the patch fixes) both get loaded (one by main exe, another one by a plugin) and this leads to a crash in plugin dll because some initialization APIs are not called in the 2nd case.
Is there nything else that needs a clarification?
I'm not sure I understand what winetricks is doing here with builtin manifests, but in any case the filtering was added for a reason. The algorithm may need to be made smarter, but simply removing it is going to reintroduce the problem that this was addressing.
On Tue Jan 28 19:33:35 2025 +0000, Alexandre Julliard wrote:
I'm not sure I understand what winetricks is doing here with builtin manifests, but in any case the filtering was added for a reason. The algorithm may need to be made smarter, but simply removing it is going to reintroduce the problem that this was addressing.
It's not about builtin manifests. It's about mfc90.dll. 'winetricks -q vcrun2008' installs mfc90.dll version 9.0.30729.6161, and the application ships with 9.0.30729.1. In both cases manifest file names end with deadbeef.manifest, and being removed code treats these manifests as builtin, which is wrong.
On Tue Jan 28 19:33:35 2025 +0000, Dmitry Timoshkov wrote:
It's not about builtin manifests. It's about mfc90.dll. 'winetricks -q vcrun2008' installs mfc90.dll version 9.0.30729.6161, and the application ships with 9.0.30729.1. In both cases manifest file names end with deadbeef.manifest, and being removed code treats these manifests as builtin, which is wrong.
It looks like the real issue is that the assembly cache is installing native manifests with deadbeef names.