[2/5] winemenubuilder: use the full path to start.exe

Damjan Jovanovic damjan.jov at gmail.com
Sat May 22 10:56:19 CDT 2010


Changelog:
* winemenubuilder: use the full path to start.exe

Damjan Jovanovic
-------------- next part --------------
--- a/programs/winemenubuilder/winemenubuilder.c	2010-05-22 16:18:01.203778715 +0200
+++ b/programs/winemenubuilder/winemenubuilder.c	2010-05-22 16:18:09.883779312 +0200
@@ -2499,6 +2499,16 @@
     return hasChanged;
 }
 
+static char *get_start_exe_path(void)
+ {
+    static const WCHAR startW[] = {'\\','c','o','m','m','a','n','d',
+                                   '\\','s','t','a','r','t','.','e','x','e',0};
+    WCHAR start_path[MAX_PATH];
+    GetWindowsDirectoryW(start_path, MAX_PATH);
+    lstrcatW(start_path, startW);
+    return escape(start_path);
+}
+
 static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bWait )
 {
     static const WCHAR startW[] = {'\\','c','o','m','m','a','n','d',
@@ -2512,6 +2522,7 @@
     DWORD csidl = -1;
     HANDLE hsem = NULL;
     char *unix_link = NULL;
+    char *start_path = NULL;
 
     if ( !link )
     {
@@ -2636,6 +2647,13 @@
         goto cleanup;
     }
 
+    start_path = get_start_exe_path();
+    if (start_path == NULL)
+    {
+        WINE_ERR("out of memory\n");
+        goto cleanup;
+    }
+
     /* building multiple menus concurrently has race conditions */
     hsem = CreateSemaphoreA( NULL, 1, 1, "winemenubuilder_semaphore");
     if( WAIT_OBJECT_0 != MsgWaitForMultipleObjects( 1, &hsem, FALSE, INFINITE, QS_ALLINPUT ) )
@@ -2673,7 +2691,7 @@
                 char *menuarg = heap_printf("/Unix %s", escaped_lnk);
                 if (menuarg)
                 {
-                    r = !write_menu_entry(unix_link, link_name, "start", menuarg, description, work_dir, icon_name);
+                    r = !write_menu_entry(unix_link, link_name, start_path, menuarg, description, work_dir, icon_name);
                     HeapFree(GetProcessHeap(), 0, menuarg);
                 }
                 HeapFree(GetProcessHeap(), 0, escaped_lnk);
@@ -2692,7 +2710,8 @@
     HeapFree( GetProcessHeap(), 0, escaped_args );
     HeapFree( GetProcessHeap(), 0, escaped_path );
     HeapFree( GetProcessHeap(), 0, description );
-    HeapFree( GetProcessHeap(), 0, unix_link);
+    HeapFree( GetProcessHeap(), 0, unix_link );
+    HeapFree( GetProcessHeap(), 0, start_path );
 
     if (r && !bWait)
         WINE_ERR("failed to build the menu\n" );


More information about the wine-patches mailing list