winemenubuilder: Always initialize COM.

This commit is contained in:
Damjan Jovanovic 2010-07-20 21:16:29 +02:00 committed by Alexandre Julliard
parent 10e1387f61
commit 187dec992f
1 changed files with 9 additions and 18 deletions

View File

@ -2775,13 +2775,6 @@ static BOOL Process_Link( LPCWSTR linkname, BOOL bWait )
return 1; return 1;
} }
r = CoInitialize( NULL );
if( FAILED( r ) )
{
WINE_ERR("CoInitialize failed\n");
return 1;
}
r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLinkW, (LPVOID *) &sl ); &IID_IShellLinkW, (LPVOID *) &sl );
if( FAILED( r ) ) if( FAILED( r ) )
@ -2817,8 +2810,6 @@ static BOOL Process_Link( LPCWSTR linkname, BOOL bWait )
IPersistFile_Release( pf ); IPersistFile_Release( pf );
IShellLinkW_Release( sl ); IShellLinkW_Release( sl );
CoUninitialize();
return !r; return !r;
} }
@ -2845,13 +2836,6 @@ static BOOL Process_URL( LPCWSTR urlname, BOOL bWait )
return 1; return 1;
} }
r = CoInitialize( NULL );
if( FAILED( r ) )
{
WINE_ERR("CoInitialize failed\n");
return 1;
}
r = CoCreateInstance( &CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance( &CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
&IID_IUniformResourceLocatorW, (LPVOID *) &url ); &IID_IUniformResourceLocatorW, (LPVOID *) &url );
if( FAILED( r ) ) if( FAILED( r ) )
@ -2882,8 +2866,6 @@ static BOOL Process_URL( LPCWSTR urlname, BOOL bWait )
IPersistFile_Release( pf ); IPersistFile_Release( pf );
url->lpVtbl->Release( url ); url->lpVtbl->Release( url );
CoUninitialize();
return !r; return !r;
} }
@ -3116,11 +3098,19 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sh
LPWSTR token = NULL, p; LPWSTR token = NULL, p;
BOOL bWait = FALSE; BOOL bWait = FALSE;
BOOL bURL = FALSE; BOOL bURL = FALSE;
HRESULT hr;
int ret = 0; int ret = 0;
if (!init_xdg()) if (!init_xdg())
return 1; return 1;
hr = CoInitialize(NULL);
if (FAILED(hr))
{
WINE_ERR("could not initialize COM, error 0x%08X\n", hr);
return 1;
}
for( p = cmdline; p && *p; ) for( p = cmdline; p && *p; )
{ {
token = next_token( &p ); token = next_token( &p );
@ -3160,5 +3150,6 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sh
} }
} }
CoUninitialize();
return ret; return ret;
} }