[3/8] msi: Handle escaped double quotes in command line parsing.

Hans Leidekker hans at codeweavers.com
Thu Jun 30 05:14:26 CDT 2011


Fixes http://bugs.winehq.org/show_bug.cgi?id=13536
---
 dlls/msi/action.c        |    4 ++--
 dlls/msi/tests/install.c |   12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 01df974..8fe1221 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -229,7 +229,7 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes )
                 break;
             case '"':
                 state = state_quote;
-                if (in_quotes) count--;
+                if (in_quotes && p[1] != '\"') count--;
                 else count++;
                 break;
             default:
@@ -267,7 +267,7 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes )
             switch (*p)
             {
             case '"':
-                if (in_quotes) count--;
+                if (in_quotes && p[1] != '\"') count--;
                 else count++;
                 break;
             case ' ':
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index f93cc48..1c550ae 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -6350,6 +6350,18 @@ static void test_command_line_parsing(void)
     r = MsiInstallProductA(msifile, cmd);
     ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
 
+    cmd = "P=\"\"\"one\"\"\" Q=\"two\"";
+    r = MsiInstallProductA(msifile, cmd);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+    cmd = "P=\"one \"\"two\"\"\" Q=\"three\"";
+    r = MsiInstallProductA(msifile, cmd);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
+    cmd = "P=\"\"\"one\"\" two\" Q=\"three\"";
+    r = MsiInstallProductA(msifile, cmd);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+
     DeleteFile(msifile);
     RemoveDirectory("msitest");
 }
-- 
1.7.4.1







More information about the wine-patches mailing list