[3/3] shell32: Fix FindExecutable() to return the executable path, not the whole command.

Francois Gouget fgouget at codeweavers.com
Wed Dec 13 11:06:45 CST 2006


---

Ideally we would try to guess the executable name like CreateProcess() 
does but apparently Windows does not bother. So this will do, at least 
for now.


 dlls/shell32/shlexec.c       |   10 ++++++++++
 dlls/shell32/tests/shlexec.c |   14 +++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 433af9a..f49382a 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -707,6 +707,16 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOperation,
 		}
 		*p = '\0';
 	    }
+            else
+            {
+                /* Truncate on first space, like Windows:
+                 * http://support.microsoft.com/?scid=kb%3Ben-us%3B140724
+                 */
+		WCHAR *p = lpResult;
+		while (*p != ' ' && *p != '\0')
+                    p++;
+                *p='\0';
+            }
 	}
     }
     else /* Check win.ini */
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index cb05217..4375a9a 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -498,24 +498,24 @@ static filename_tests_t filename_tests[]=
     {NULL,           "%s\\nonexistent.noassoc", 0x11, SE_ERR_FNF},
 
     /* Standard tests */
-    {NULL,           "%s\\test file.shlexec",   0x20, 33},
-    {NULL,           "%s\\test file.shlexec.",  0x20, 33},
-    {NULL,           "%s\\%%nasty%% $file.shlexec", 0x20, 33},
-    {NULL,           "%s/test file.shlexec",    0x20, 33},
+    {NULL,           "%s\\test file.shlexec",   0x0, 33},
+    {NULL,           "%s\\test file.shlexec.",  0x0, 33},
+    {NULL,           "%s\\%%nasty%% $file.shlexec", 0x0, 33},
+    {NULL,           "%s/test file.shlexec",    0x0, 33},
 
     /* Test filenames with no association */
     {NULL,           "%s\\test file.noassoc",   0x0,  SE_ERR_NOASSOC},
 
     /* Test double extensions */
-    {NULL,           "%s\\test file.noassoc.shlexec", 0x20, 33},
+    {NULL,           "%s\\test file.noassoc.shlexec", 0x0, 33},
     {NULL,           "%s\\test file.shlexec.noassoc", 0x0, SE_ERR_NOASSOC},
 
     /* Test alternate verbs */
     {"LowerL",       "%s\\nonexistent.shlexec", 0x11, SE_ERR_FNF},
     {"LowerL",       "%s\\test file.noassoc",   0x0,  SE_ERR_NOASSOC},
 
-    {"QuotedLowerL", "%s\\test file.shlexec",   0x20, 33},
-    {"QuotedUpperL", "%s\\test file.shlexec",   0x20, 33},
+    {"QuotedLowerL", "%s\\test file.shlexec",   0x0, 33},
+    {"QuotedUpperL", "%s\\test file.shlexec",   0x0, 33},
 
     {NULL, NULL, 0}
 };
-- 
1.4.4.1




More information about the wine-patches mailing list