[PATCH 0/1] MR10798: shell32: Remove full path from executable file name when trying to retrive App Paths
Execution from the link can't find DLLs placed at additional paths in `App Paths` due to the assumption that the file name (`szName` parameter) contains only the file name itself, without the path, or that the `App Paths` subkey in the registry can contain the full path. Since registry subkeys cannot contain a backslash, it is safe to remove the path from the file name and use only the file name as the subkey to check and retrieve the path value for the application. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=625 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10798
From: Mykola Mykhno <klimmihno5+wine+gitlab@gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=625 --- dlls/shell32/shlexec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index d2a6d5700d4..33c65a80490 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <ctype.h> #include <assert.h> +#include <wchar.h> #define COBJMACROS @@ -455,15 +456,18 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env) LONG res; BOOL found = FALSE; + /* Registry subkey can't include backslash. */ + LPCWSTR filenameOnly = wcsrchr(szName, L'\\'); + if (env) *env = NULL; wcscpy(buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"); - if (wcslen(buffer) + wcslen(szName) + 1 > ARRAY_SIZE(buffer)) + if (wcslen(buffer) + wcslen(filenameOnly) + 1 > ARRAY_SIZE(buffer)) { WARN("Name is too big.\n"); return FALSE; } - wcscat(buffer, szName); + wcscat(buffer, filenameOnly); res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkApp); if (res) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10798
participants (2)
-
Mykola Mykhno -
Mykola Mykhno (@MykolaMykhno)