Commit 454fa4be authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Make sure we only CoUninitialize after successfully initializing.

Fix the address of the returned IShellLinkDataList interface.
parent bf5155b6
...@@ -1818,14 +1818,12 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget, ...@@ -1818,14 +1818,12 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
IShellLinkDataList *dl = NULL; IShellLinkDataList *dl = NULL;
IPersistFile *pf = NULL; IPersistFile *pf = NULL;
LPEXP_DARWIN_LINK darwin = NULL; LPEXP_DARWIN_LINK darwin = NULL;
HRESULT r; HRESULT r, init;
TRACE("%s %p %p %p\n", debugstr_w(szShortcutTarget), TRACE("%s %p %p %p\n", debugstr_w(szShortcutTarget),
szProductCode, szFeatureId, szComponentCode ); szProductCode, szFeatureId, szComponentCode );
r = CoInitialize(NULL); init = CoInitialize(NULL);
if( FAILED( r ) )
return ERROR_FUNCTION_FAILED;
r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IPersistFile, (LPVOID*) &pf ); &IID_IPersistFile, (LPVOID*) &pf );
...@@ -1836,7 +1834,7 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget, ...@@ -1836,7 +1834,7 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
if( SUCCEEDED( r ) ) if( SUCCEEDED( r ) )
{ {
r = IPersistFile_QueryInterface( pf, &IID_IShellLinkDataList, r = IPersistFile_QueryInterface( pf, &IID_IShellLinkDataList,
(LPVOID*) dl ); (LPVOID*) &dl );
if( SUCCEEDED( r ) ) if( SUCCEEDED( r ) )
{ {
IShellLinkDataList_CopyDataBlock( dl, EXP_DARWIN_ID_SIG, IShellLinkDataList_CopyDataBlock( dl, EXP_DARWIN_ID_SIG,
...@@ -1847,7 +1845,8 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget, ...@@ -1847,7 +1845,8 @@ UINT WINAPI MsiGetShortcutTargetW( LPCWSTR szShortcutTarget,
IPersistFile_Release( pf ); IPersistFile_Release( pf );
} }
CoUninitialize(); if (SUCCEEDED(init))
CoUninitialize();
TRACE("darwin = %p\n", darwin); TRACE("darwin = %p\n", darwin);
......
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