shell32: Specify the full application path when starting winemenubuilder.exe.

This commit is contained in:
Alexandre Julliard 2009-10-27 11:21:34 +01:00
parent c4ebf3687b
commit d72e7af9b1
3 changed files with 33 additions and 34 deletions

View File

@ -105,31 +105,6 @@ static const char * DumpEvent( LONG event )
#undef DUMPEV
}
static BOOL RefreshFileTypeAssociations(void)
{
static WCHAR szWinemenubuilder[] = {
'w','i','n','e','m','e','n','u','b','u','i','l','d','e','r','.','e','x','e',
' ','-','a',0 };
STARTUPINFOW si;
PROCESS_INFORMATION pi;
BOOL ret;
TRACE("starting %s\n",debugstr_w(szWinemenubuilder));
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
ret = CreateProcessW( NULL, szWinemenubuilder, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
if (ret)
{
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
return ret;
}
static const char * NodeName(const NOTIFICATIONLIST *item)
{
const char *str;
@ -425,10 +400,11 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID
if (wEventId & SHCNE_ASSOCCHANGED)
{
static const WCHAR args[] = {' ','-','a',0 };
TRACE("refreshing file type associations\n");
RefreshFileTypeAssociations();
run_winemenubuilder( args );
}
/* if we allocated it, free it. The ANSI flag is also set in its Unicode sibling. */
if ((typeFlag & SHCNF_PATHA) || (typeFlag & SHCNF_PRINTERA))
{

View File

@ -197,6 +197,8 @@ BOOL UNIXFS_is_rooted_at_desktop(void);
extern const GUID CLSID_UnixFolder;
extern const GUID CLSID_UnixDosFolder;
extern BOOL run_winemenubuilder( const WCHAR *args );
/* Default shell folder value registration */
HRESULT SHELL_RegisterShellFolders(void);

View File

@ -395,30 +395,33 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
return r;
}
static BOOL StartLinkProcessor( LPCOLESTR szLink )
BOOL run_winemenubuilder( const WCHAR *args )
{
static const WCHAR szFormat[] = {
'w','i','n','e','m','e','n','u','b','u','i','l','d','e','r','.','e','x','e',
' ','-','w',' ','"','%','s','"',0 };
static const WCHAR menubuilder[] = {'\\','w','i','n','e','m','e','n','u','b','u','i','l','d','e','r','.','e','x','e',0};
LONG len;
LPWSTR buffer;
STARTUPINFOW si;
PROCESS_INFORMATION pi;
BOOL ret;
WCHAR app[MAX_PATH];
len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR);
GetSystemDirectoryW( app, MAX_PATH - sizeof(menubuilder)/sizeof(WCHAR) );
strcatW( app, menubuilder );
len = (strlenW( app ) + strlenW( args ) + 1) * sizeof(WCHAR);
buffer = HeapAlloc( GetProcessHeap(), 0, len );
if( !buffer )
return FALSE;
wsprintfW( buffer, szFormat, szLink );
strcpyW( buffer, app );
strcatW( buffer, args );
TRACE("starting %s\n",debugstr_w(buffer));
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
ret = CreateProcessW( NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
ret = CreateProcessW( app, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
HeapFree( GetProcessHeap(), 0, buffer );
@ -431,6 +434,24 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink )
return ret;
}
static BOOL StartLinkProcessor( LPCOLESTR szLink )
{
static const WCHAR szFormat[] = {' ','-','w',' ','"','%','s','"',0 };
LONG len;
LPWSTR buffer;
BOOL ret;
len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR);
buffer = HeapAlloc( GetProcessHeap(), 0, len );
if( !buffer )
return FALSE;
wsprintfW( buffer, szFormat, szLink );
ret = run_winemenubuilder( buffer );
HeapFree( GetProcessHeap(), 0, buffer );
return ret;
}
static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
{
IShellLinkImpl *This = impl_from_IPersistFile(iface);