Commit in reactos/lib/shell32 on MAIN
shlexec.c+9-31.42 -> 1.43
- Don't double-quote an already double-quoted argument
- Properly increment the fmt pointer

reactos/lib/shell32
shlexec.c 1.42 -> 1.43
diff -u -r1.42 -r1.43
--- shlexec.c	7 Oct 2004 09:13:56 -0000	1.42
+++ shlexec.c	21 Oct 2004 18:30:36 -0000	1.43
@@ -142,8 +142,10 @@
                     else
                         cmd = lpFile;
 
-                    /* Add double quotation marks unless we already have them (e.g.: "file://%1" %* for exefile) */
-                    if (res == out || *(fmt + 1) != '"')
+                    /* Add double quotation marks unless we already have them
+                       (e.g.: "file://%1" %* for exefile) or unless the arg is already
+                       enclosed in double quotation marks */
+                    if ((res == out || *(fmt + 1) != '"') && *cmd != '"')
                     {
                         *res++ = '"';
                         strcpyW(res, cmd);
@@ -207,10 +209,14 @@
                         strcpyW( res, tmpEnvBuff );
                     res += strlenW(res);
                 }
-                fmt++;
                 done = TRUE;
                 break;
             }
+            /* Don't skip past terminator (catch a single '%' at the end) */
+            if (*fmt != '\0')
+            {
+                fmt++;
+            }
         }
         else
             *res++ = *fmt++;
CVSspam 0.2.8