From 3f3e42b6bc296af9f18a4b3eff6610590db033c7 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 18 Oct 2011 15:19:17 -0500 Subject: [PATCH] shell32: ShellExec with empty operation should behave same as with NULL operation. --- dlls/shell32/classes.c | 2 +- dlls/shell32/shlexec.c | 4 ++-- dlls/shell32/tests/shlexec.c | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c index 9fbdf0e5121..a56af62fd0e 100644 --- a/dlls/shell32/classes.c +++ b/dlls/shell32/classes.c @@ -129,7 +129,7 @@ BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD l TRACE("%p %s %p\n", hkeyClass, debugstr_w(szVerb), szDest); - if (szVerb) + if (szVerb && *szVerb) { lstrcpynW(szDest, szVerb, len); return TRUE; diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index 7fd485e5944..77212f0e508 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -1517,7 +1517,7 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wFile, LPCWSTR wcmd, TRACE("Got URL: %s\n", debugstr_w(lpFile)); /* Looking for ...protocol\shell\lpOperation\command */ len = iSize + lstrlenW(wShell) + lstrlenW(wCommand) + 1; - if (psei->lpVerb) + if (psei->lpVerb && *psei->lpVerb) len += lstrlenW(psei->lpVerb); else len += lstrlenW(wszOpen); @@ -1525,7 +1525,7 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wFile, LPCWSTR wcmd, memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR)); lpstrProtocol[iSize] = '\0'; strcatW(lpstrProtocol, wShell); - strcatW(lpstrProtocol, psei->lpVerb? psei->lpVerb: wszOpen); + strcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: wszOpen); strcatW(lpstrProtocol, wCommand); /* Remove File Protocol from lpFile */ diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 9c0bc582861..5542ea5801e 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -92,7 +92,10 @@ static void strcat_param(char* str, const char* param) static char shell_call[2048]=""; static int shell_execute(LPCSTR operation, LPCSTR file, LPCSTR parameters, LPCSTR directory) { - INT_PTR rc; + INT_PTR rc, rcEmpty = 0; + + if(!operation) + rcEmpty = shell_execute("", file, parameters, directory); strcpy(shell_call, "ShellExecute("); strcat_param(shell_call, operation); @@ -139,6 +142,10 @@ static int shell_execute(LPCSTR operation, LPCSTR file, LPCSTR parameters, LPCST if (rc > 32) dump_child(); + if(!operation) + ok(rc == rcEmpty || broken(rc > 32 && rcEmpty == SE_ERR_NOASSOC) /* NT4 */, + "Got different return value with empty string: %lu %lu\n", rc, rcEmpty); + return rc; } -- 2.11.4.GIT