Commit cce8398d authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

shell32: Properly fail when a data object cannot be created.

Based on a patch by Mark Jansen. Signed-off-by: 's avatarAlistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f7d47b49
...@@ -1165,13 +1165,12 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei ) ...@@ -1165,13 +1165,12 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei )
return hkey; return hkey;
} }
static IDataObject *shellex_get_dataobj( LPSHELLEXECUTEINFOW sei ) static HRESULT shellex_get_dataobj( LPSHELLEXECUTEINFOW sei, IDataObject **dataobj )
{ {
LPCITEMIDLIST pidllast = NULL; LPCITEMIDLIST pidllast = NULL;
IDataObject *dataobj = NULL;
IShellFolder *shf = NULL; IShellFolder *shf = NULL;
LPITEMIDLIST pidl = NULL; LPITEMIDLIST pidl = NULL;
HRESULT r; HRESULT r = SE_ERR_DLLNOTFOUND;
if (sei->fMask & SEE_MASK_CLASSALL) if (sei->fMask & SEE_MASK_CLASSALL)
pidl = sei->lpIDList; pidl = sei->lpIDList;
...@@ -1192,15 +1191,15 @@ static IDataObject *shellex_get_dataobj( LPSHELLEXECUTEINFOW sei ) ...@@ -1192,15 +1191,15 @@ static IDataObject *shellex_get_dataobj( LPSHELLEXECUTEINFOW sei )
if ( FAILED( r ) ) if ( FAILED( r ) )
goto end; goto end;
IShellFolder_GetUIObjectOf( shf, NULL, 1, &pidllast, r = IShellFolder_GetUIObjectOf( shf, NULL, 1, &pidllast,
&IID_IDataObject, NULL, (LPVOID*) &dataobj ); &IID_IDataObject, NULL, (void**)dataobj );
end: end:
if ( pidl != sei->lpIDList ) if ( pidl != sei->lpIDList )
ILFree( pidl ); ILFree( pidl );
if ( shf ) if ( shf )
IShellFolder_Release( shf ); IShellFolder_Release( shf );
return dataobj; return r;
} }
static HRESULT shellex_run_context_menu_default( IShellExtInit *obj, 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 ...@@ -1295,8 +1294,8 @@ static HRESULT shellex_load_object_and_run( HKEY hkey, LPCGUID guid, LPSHELLEXEC
goto end; goto end;
} }
dataobj = shellex_get_dataobj( sei ); r = shellex_get_dataobj( sei, &dataobj );
if ( !dataobj ) if ( FAILED( r ) )
{ {
ERR("failed to get data object\n"); ERR("failed to get data object\n");
goto end; goto end;
......
...@@ -1780,7 +1780,7 @@ static fileurl_tests_t fileurl_tests[]= ...@@ -1780,7 +1780,7 @@ static fileurl_tests_t fileurl_tests[]=
{"file:///", "%%TMPDIR%%\\test file.shlexec", 0, 0}, {"file:///", "%%TMPDIR%%\\test file.shlexec", 0, 0},
/* Test shortcuts vs. URLs */ /* 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 */ /* Confuse things by mixing protocols */
{"file://", "shlproto://foo/bar", USE_COLON, 0}, {"file://", "shlproto://foo/bar", USE_COLON, 0},
...@@ -1926,11 +1926,11 @@ static void test_urls(void) ...@@ -1926,11 +1926,11 @@ static void test_urls(void)
} }
/* A .lnk ending does not turn a URL into a shortcut */ /* 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); ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
okChildInt("argcA", 5); okChildInt("argcA", 5);
todo_wine okChildString("argvA3", "URL"); okChildString("argvA3", "URL");
todo_wine okChildString("argvA4", "shlproto://foo/bar.lnk"); okChildString("argvA4", "shlproto://foo/bar.lnk");
/* Neither does a .exe extension */ /* Neither does a .exe extension */
rc = shell_execute(NULL, "shlproto://foo/bar.exe", NULL, NULL); rc = shell_execute(NULL, "shlproto://foo/bar.exe", NULL, NULL);
......
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