Some strange things with files

Rein Klazes rklazes at xs4all.nl
Tue Mar 16 12:58:56 CST 2004


On Sat, 13 Mar 2004 14:48:38 +0100 (CET), you wrote:

[snip]

Can you try if attached patch works? 

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/dlls/shell32/shlexec.c	2004-03-06 11:55:48.000000000 +0100
+++ mywine/dlls/shell32/shlexec.c	2004-03-16 15:22:19.000000000 +0100
@@ -134,8 +134,16 @@
     STARTUPINFOW  startup;
     PROCESS_INFORMATION info;
     UINT retval = 31;
+    UINT gcdret = 0;
+    WCHAR curdir[MAX_PATH];
 
     TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd), debugstr_w(sei->lpDirectory));
+    /* ShellExecute specifies the command from sei->lpDirectory
+     * if present. Not from the current dir as CreateProcess does */
+    if( sei->lpDirectory && sei->lpDirectory[0] )
+        if( ( gcdret = GetCurrentDirectoryW( MAX_PATH, curdir)))
+            if( !SetCurrentDirectoryW( sei->lpDirectory))
+                ERR("cannot set directory %s\n", debugstr_w(sei->lpDirectory));
     ZeroMemory(&startup,sizeof(STARTUPINFOW));
     startup.cb = sizeof(STARTUPINFOW);
     startup.dwFlags = STARTF_USESHOWWINDOW;
@@ -164,6 +172,10 @@
     TRACE("returning %u\n", retval);
 
     sei->hInstApp = (HINSTANCE)retval;
+    if( gcdret ) 
+        if( !SetCurrentDirectoryW( curdir))
+            ERR("cannot return to directory %s\n", debugstr_w(curdir));
+
     return retval;
 }
 


More information about the wine-users mailing list