Alexandre Julliard : shell32: Specify the full application path when starting winemenubuilder.exe.
Alexandre Julliard
julliard at winehq.org
Tue Oct 27 09:46:31 CDT 2009
Module: wine
Branch: master
Commit: d72e7af9b1883c5632e794d934da3bf187217d49
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d72e7af9b1883c5632e794d934da3bf187217d49
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Oct 27 11:21:34 2009 +0100
shell32: Specify the full application path when starting winemenubuilder.exe.
---
dlls/shell32/changenotify.c | 30 +++---------------------------
dlls/shell32/shell32_main.h | 2 ++
dlls/shell32/shelllink.c | 35 ++++++++++++++++++++++++++++-------
3 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/dlls/shell32/changenotify.c b/dlls/shell32/changenotify.c
index 43a5fb8..96ffd99 100644
--- a/dlls/shell32/changenotify.c
+++ b/dlls/shell32/changenotify.c
@@ -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))
{
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index 12d50e2..16fb4a5 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -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);
diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 231c72c..414cc54 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -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);
More information about the wine-cvs
mailing list