shell32: Fix SHELL_execute code that removes quote arround file name.
This commit is contained in:
parent
663f9f4b21
commit
943ead5022
|
@ -1592,14 +1592,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
|
|||
wszApplicationName = HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen*sizeof(WCHAR));
|
||||
*wszApplicationName = '\0';
|
||||
}
|
||||
else if (*sei_tmp.lpFile == '\"')
|
||||
else if (*sei_tmp.lpFile == '\"' && sei_tmp.lpFile[(len = strlenW(sei_tmp.lpFile))-1] == '\"')
|
||||
{
|
||||
DWORD l = strlenW(sei_tmp.lpFile+1);
|
||||
if(l >= dwApplicationNameLen) dwApplicationNameLen = l+1;
|
||||
if(len-1 >= dwApplicationNameLen) dwApplicationNameLen = len;
|
||||
wszApplicationName = HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen*sizeof(WCHAR));
|
||||
memcpy(wszApplicationName, sei_tmp.lpFile+1, (l+1)*sizeof(WCHAR));
|
||||
if (wszApplicationName[l-1] == '\"')
|
||||
wszApplicationName[l-1] = '\0';
|
||||
memcpy(wszApplicationName, sei_tmp.lpFile+1, len*sizeof(WCHAR));
|
||||
if(len > 2)
|
||||
wszApplicationName[len-2] = '\0';
|
||||
TRACE("wszApplicationName=%s\n",debugstr_w(wszApplicationName));
|
||||
} else {
|
||||
DWORD l = strlenW(sei_tmp.lpFile)+1;
|
||||
|
|
|
@ -905,6 +905,8 @@ static filename_tests_t filename_tests[]=
|
|||
{NULL, "%s\\masked file.shlexec", 0x0, 33},
|
||||
/* Test if quoting prevents the masking */
|
||||
{NULL, "%s\\masked file.shlexec", 0x40, 33},
|
||||
/* Test with incorrect quote */
|
||||
{NULL, "\"%s\\masked file.shlexec", 0x0, SE_ERR_FNF},
|
||||
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
@ -2114,6 +2116,15 @@ static void test_exes(void)
|
|||
{
|
||||
win_skip("Skipping shellexecute of file with unassociated extension\n");
|
||||
}
|
||||
|
||||
/* test combining executable and parameters */
|
||||
sprintf(filename, "%s shlexec \"%s\" Exec", argv0, child_file);
|
||||
rc = shell_execute(NULL, filename, NULL, NULL);
|
||||
ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
|
||||
|
||||
sprintf(filename, "\"%s\" shlexec \"%s\" Exec", argv0, child_file);
|
||||
rc = shell_execute(NULL, filename, NULL, NULL);
|
||||
ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
|
Loading…
Reference in New Issue