[PATCH 0/1] MR5232: rundll32: Allow DLL name and entrypoint to be separated by any combination of spaces/commas.
This is one of the two rundll32 changes required for GeForce NOW installer to work (the other one is too hacky to upstream without major changes) This commit was originally found on https://github.com/aabgrall/wine-base-geforcenow (but the author never bothered to send it to the ML/GitLab) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5232
From: Alexandre Abgrall <aabgrall98(a)gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52542 Signed-off-by: Alexandre Abgrall <aabgrall98(a)gmail.com> --- programs/rundll32/rundll32.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/programs/rundll32/rundll32.c b/programs/rundll32/rundll32.c index 2fb87fb8a50..31e1f338cad 100644 --- a/programs/rundll32/rundll32.c +++ b/programs/rundll32/rundll32.c @@ -191,11 +191,12 @@ static void *get_entry_point32( HMODULE module, LPCWSTR entry, BOOL *unicode ) return ret; } -static LPWSTR get_next_arg(LPWSTR *cmdline) +static LPWSTR get_next_arg(LPWSTR *cmdline, BOOL can_have_commas) { LPWSTR s; LPWSTR arg,d; BOOL in_quotes; + BOOL is_separator; int bcount,len=0; /* count the chars */ @@ -203,7 +204,8 @@ static LPWSTR get_next_arg(LPWSTR *cmdline) in_quotes=FALSE; s=*cmdline; while (1) { - if (*s==0 || ((*s=='\t' || *s==' ') && !in_quotes)) { + is_separator = (*s=='\t' || *s==' ' || (*s==',' && !can_have_commas)); + if (*s==0 || (is_separator && !in_quotes)) { /* end of this command line argument */ break; } else if (*s=='\\') { @@ -229,7 +231,8 @@ static LPWSTR get_next_arg(LPWSTR *cmdline) d=arg; s=*cmdline; while (*s) { - if ((*s=='\t' || *s==' ') && !in_quotes) { + is_separator = (*s=='\t' || *s==' ' || (*s==',' && !can_have_commas)); + if (is_separator && !in_quotes) { /* end of this command line argument */ break; } else if (*s=='\\') { @@ -263,8 +266,9 @@ static LPWSTR get_next_arg(LPWSTR *cmdline) *d=0; *cmdline=s; - /* skip the remaining spaces */ - while (**cmdline=='\t' || **cmdline==' ') { + /* skip the remaining spaces/commas */ + while (**cmdline=='\t' || **cmdline==' ' || + (**cmdline==',' && !can_have_commas)) { (*cmdline)++; } @@ -294,14 +298,11 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE hOldInstance, LPWSTR szCmdLine /* Get the dll name and API EntryPoint */ WINE_TRACE("CmdLine=%s\n",wine_dbgstr_w(szCmdLine)); - szDllName = get_next_arg(&szCmdLine); + szDllName = get_next_arg(&szCmdLine, 0); if (!szDllName || *szDllName==0) goto CLEANUP; WINE_TRACE("DllName=%s\n",wine_dbgstr_w(szDllName)); - if ((szEntryPoint = wcschr(szDllName, ',' ))) - *szEntryPoint++=0; - else - szEntryPoint = get_next_arg(&szCmdLine); + szEntryPoint = get_next_arg(&szCmdLine, 1); WINE_TRACE("EntryPoint=%s\n",wine_dbgstr_w(szEntryPoint)); /* Activate context before DllMain() is called */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5232
This merge request was approved by Aida Jonikienė. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5232
This merge request was closed by Alexandre Julliard. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5232
Superseded by 5c597119a069cc0343b6fa82d0ba946048d038ea. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5232#note_87657
participants (3)
-
Aida Jonikienė -
Alexandre Abgrall -
Alexandre Julliard (@julliard)