Commit 4e559454 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

shell32: Handle long command line in execute_from_key().

parent f1c57f06
......@@ -965,7 +965,7 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWST
SHELL_ExecuteW32 execfunc,
LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out)
{
WCHAR cmd[256], param[1024], ddeexec[256];
WCHAR cmd[256], parambuffer[1024], ddeexec[256], *param = parambuffer;
LONG cmdlen = sizeof(cmd), ddeexeclen = sizeof(ddeexec);
UINT_PTR retval = SE_ERR_NOASSOC;
DWORD resultLen;
......@@ -987,9 +987,12 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWST
if (cmdlen >= ARRAY_SIZE(cmd))
cmdlen = ARRAY_SIZE(cmd) - 1;
cmd[cmdlen] = '\0';
SHELL_ArgifyW(param, ARRAY_SIZE(param), cmd, lpFile, psei->lpIDList, szCommandline, &resultLen);
if (resultLen > ARRAY_SIZE(param))
ERR("Argify buffer not large enough, truncating\n");
SHELL_ArgifyW(param, ARRAY_SIZE(parambuffer), cmd, lpFile, psei->lpIDList, szCommandline, &resultLen);
if (resultLen > ARRAY_SIZE(parambuffer))
{
if ((param = malloc(resultLen * sizeof(*param))))
SHELL_ArgifyW(param, resultLen, cmd, lpFile, psei->lpIDList, szCommandline, &resultLen);
}
}
/* Get the parameters needed by the application
......@@ -1012,6 +1015,7 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWST
else
WARN("Nothing appropriate found for %s\n", debugstr_w(key));
if (param != parambuffer) free(param);
return retval;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment