Andrew Eikum : shell32: ShellExec with empty operation should behave same as with NULL operation.
Alexandre Julliard
julliard at winehq.org
Wed Oct 19 14:05:25 CDT 2011
Module: wine
Branch: master
Commit: 3f3e42b6bc296af9f18a4b3eff6610590db033c7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3f3e42b6bc296af9f18a4b3eff6610590db033c7
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Tue Oct 18 15:19:17 2011 -0500
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 9fbdf0e..a56af62 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 7fd485e..77212f0 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 9c0bc58..5542ea5 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;
}
More information about the wine-cvs
mailing list