Commit in reactos/lib/shell32 on MAIN
shlexec.c+27-31.27 -> 1.28
merge WineHQ commit:

Rein Klazes <rklazes@xs4all.nl>
In SHELL_ExecuteW, if a new current directory is specified, change to
it before calling CreateProcess so that it will find the correct
executable.

Patch: http://cvs.winehq.org/patch.py?id=11578

reactos/lib/shell32
shlexec.c 1.27 -> 1.28
diff -u -r1.27 -r1.28
--- shlexec.c	16 Mar 2004 10:07:38 -0000	1.27
+++ shlexec.c	19 Mar 2004 09:18:52 -0000	1.28
@@ -301,9 +301,18 @@
     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(psei->lpDirectory));
 
+    /* ShellExecute specifies the command from psei->lpDirectory
+     * if present. Not from the current dir as CreateProcess does */
+    if( psei->lpDirectory && psei->lpDirectory[0] )
+        if( ( gcdret = GetCurrentDirectoryW( MAX_PATH, curdir)))
+            if( !SetCurrentDirectoryW( psei->lpDirectory))
+                ERR("cannot set directory %s\n", debugstr_w(psei->lpDirectory));
+
     ZeroMemory(&startup, sizeof(startup));
     startup.cb = sizeof(STARTUPINFOW);
     startup.dwFlags = STARTF_USESHOWWINDOW;
@@ -335,6 +344,11 @@
     TRACE("returning %u\n", retval);
 
     psei_out->hInstApp = (HINSTANCE)retval;
+
+    if( gcdret ) 
+        if( !SetCurrentDirectoryW( curdir))
+            ERR("cannot return to directory %s\n", debugstr_w(curdir));
+
     return retval;
 }
 
@@ -800,7 +814,7 @@
         }
     }
 
-    SHELL_ArgifyW(res, sizeof(res), exec, lpFile, pidl, szCommandline);
+    SHELL_ArgifyW(res, sizeof(res)/sizeof(WCHAR), exec, lpFile, pidl, szCommandline);
     TRACE("%s %s => %s\n", debugstr_w(exec), debugstr_w(lpFile), debugstr_w(res));
 
     ret = (DdeClientTransaction((LPBYTE)res, (strlenW(res) + 1) * sizeof(WCHAR), hConv, 0L, 0,
@@ -1039,7 +1053,17 @@
 
     if (ext && !strcmpiW(ext, wExtLnk))	/* or check for: shell_attribs & SFGAO_LINK */
     {
-	HRESULT hr = SHELL_ResolveShortCutW((LPWSTR)sei_tmp.lpFile, (LPWSTR)sei_tmp.lpParameters, (LPWSTR)sei_tmp.lpDirectory,
+	HRESULT hr;
+
+	/* expand paths before reading shell link */
+	if (ExpandEnvironmentStringsW(sei_tmp.lpFile, buffer, MAX_PATH))
+	    lstrcpyW(wszApplicationName/*sei_tmp.lpFile*/, buffer);
+
+	if (*sei_tmp.lpParameters)
+	    if (ExpandEnvironmentStringsW(sei_tmp.lpParameters, buffer, MAX_PATH))
+		lstrcpyW(wszParameters/*sei_tmp.lpParameters*/, buffer);
+
+	hr = SHELL_ResolveShortCutW((LPWSTR)sei_tmp.lpFile, (LPWSTR)sei_tmp.lpParameters, (LPWSTR)sei_tmp.lpDirectory,
 					    sei_tmp.hwnd, sei_tmp.lpVerb?sei_tmp.lpVerb:wszEmpty, &sei_tmp.nShow, (LPITEMIDLIST*)&sei_tmp.lpIDList);
 
 	if (psei->lpIDList)
@@ -1184,7 +1208,7 @@
 	if (sei_tmp.lpIDList!=psei->lpIDList && sei_tmp.lpIDList)
 	    SHFree(sei_tmp.lpIDList);
 
-        TRACE("execfunc: retval=%d sei_tmp.hInstApp=%p\n", retval, sei_tmp.hInstApp);
+        TRACE("execfunc: retval=%d psei->hInstApp=%p\n", retval, psei->hInstApp);
         return TRUE;
     }
 
CVSspam 0.2.8