Alistair Leslie-Hughes : shell32: Properly fail when a data object cannot be created.
Alexandre Julliard
julliard at winehq.org
Tue Oct 16 15:53:06 CDT 2018
Module: wine
Branch: master
Commit: cce8398dea7d8ac8198f95c0af91f8154afcca1b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cce8398dea7d8ac8198f95c0af91f8154afcca1b
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue Oct 16 00:41:38 2018 +0000
shell32: Properly fail when a data object cannot be created.
Based on a patch by Mark Jansen.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shell32/shlexec.c | 15 +++++++--------
dlls/shell32/tests/shlexec.c | 8 ++++----
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 0b794b0..1e795ac 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1165,13 +1165,12 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei )
return hkey;
}
-static IDataObject *shellex_get_dataobj( LPSHELLEXECUTEINFOW sei )
+static HRESULT shellex_get_dataobj( LPSHELLEXECUTEINFOW sei, IDataObject **dataobj )
{
LPCITEMIDLIST pidllast = NULL;
- IDataObject *dataobj = NULL;
IShellFolder *shf = NULL;
LPITEMIDLIST pidl = NULL;
- HRESULT r;
+ HRESULT r = SE_ERR_DLLNOTFOUND;
if (sei->fMask & SEE_MASK_CLASSALL)
pidl = sei->lpIDList;
@@ -1192,15 +1191,15 @@ static IDataObject *shellex_get_dataobj( LPSHELLEXECUTEINFOW sei )
if ( FAILED( r ) )
goto end;
- IShellFolder_GetUIObjectOf( shf, NULL, 1, &pidllast,
- &IID_IDataObject, NULL, (LPVOID*) &dataobj );
+ r = IShellFolder_GetUIObjectOf( shf, NULL, 1, &pidllast,
+ &IID_IDataObject, NULL, (void**)dataobj );
end:
if ( pidl != sei->lpIDList )
ILFree( pidl );
if ( shf )
IShellFolder_Release( shf );
- return dataobj;
+ return r;
}
static HRESULT shellex_run_context_menu_default( IShellExtInit *obj,
@@ -1295,8 +1294,8 @@ static HRESULT shellex_load_object_and_run( HKEY hkey, LPCGUID guid, LPSHELLEXEC
goto end;
}
- dataobj = shellex_get_dataobj( sei );
- if ( !dataobj )
+ r = shellex_get_dataobj( sei, &dataobj );
+ if ( FAILED( r ) )
{
ERR("failed to get data object\n");
goto end;
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index bb2b842..9dff9f8 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -1780,7 +1780,7 @@ static fileurl_tests_t fileurl_tests[]=
{"file:///", "%%TMPDIR%%\\test file.shlexec", 0, 0},
/* Test shortcuts vs. URLs */
- {"file://///", "%s\\test_shortcut_shlexec.lnk", 0, 0x1d},
+ {"file://///", "%s\\test_shortcut_shlexec.lnk", 0, 0x1c},
/* Confuse things by mixing protocols */
{"file://", "shlproto://foo/bar", USE_COLON, 0},
@@ -1926,11 +1926,11 @@ static void test_urls(void)
}
/* A .lnk ending does not turn a URL into a shortcut */
- todo_wait rc = shell_execute(NULL, "shlproto://foo/bar.lnk", NULL, NULL);
+ rc = shell_execute(NULL, "shlproto://foo/bar.lnk", NULL, NULL);
ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
okChildInt("argcA", 5);
- todo_wine okChildString("argvA3", "URL");
- todo_wine okChildString("argvA4", "shlproto://foo/bar.lnk");
+ okChildString("argvA3", "URL");
+ okChildString("argvA4", "shlproto://foo/bar.lnk");
/* Neither does a .exe extension */
rc = shell_execute(NULL, "shlproto://foo/bar.exe", NULL, NULL);
More information about the wine-cvs
mailing list