[2/2] shell32: Supply a module name to CreateProcess (try 2)

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Feb 11 02:56:33 CST 2014


Hi,


Changelog:
      shell32: Supply a module name to CreateProcess


Best Regards
   Alistair Leslie-Hughes

-------------- next part --------------
>From f7389ce3431ad08638ad7561e0079a605a05bf26 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Wed, 5 Feb 2014 14:18:53 +1100
Subject: [PATCH] Supply a module name to CreateProcess
To: wine-patches <wine-patches at winehq.org>

---
 dlls/shell32/shlexec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 9f6698a..6363258 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -315,6 +315,8 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
     WCHAR curdir[MAX_PATH];
     DWORD dwCreationFlags;
     const WCHAR *lpDirectory = NULL;
+    WCHAR module_path[MAX_PATH] = {0};
+    WCHAR *path = NULL;
 
     TRACE("Execute %s from directory %s\n", debugstr_w(lpCmd), debugstr_w(psei->lpDirectory));
 
@@ -330,9 +332,14 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
     /* ShellExecute specifies the command from psei->lpDirectory
      * if present. Not from the current dir as CreateProcess does */
     if( lpDirectory )
+    {
         if( ( gcdret = GetCurrentDirectoryW( MAX_PATH, curdir)))
             if( !SetCurrentDirectoryW( lpDirectory))
                 ERR("cannot set directory %s\n", debugstr_w(lpDirectory));
+
+        PathCombineW(module_path, psei->lpDirectory, psei->lpFile);
+        path = module_path;
+    }
     ZeroMemory(&startup,sizeof(STARTUPINFOW));
     startup.cb = sizeof(STARTUPINFOW);
     startup.dwFlags = STARTF_USESHOWWINDOW;
@@ -340,7 +347,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
     dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
     if ( !(psei->fMask & SEE_MASK_NO_CONSOLE) )
         dwCreationFlags |= CREATE_NEW_CONSOLE;
-    if (CreateProcessW(NULL, (LPWSTR)lpCmd, NULL, NULL, FALSE, dwCreationFlags, env,
+    if (CreateProcessW(path, (LPWSTR)lpCmd, NULL, NULL, FALSE, dwCreationFlags, env,
                        lpDirectory, &startup, &info))
     {
         /* Give 30 seconds to the app to come up, if desired. Probably only needed
-- 
1.8.3.2



More information about the wine-patches mailing list