msi: Accept whitespace-only property values on the command line.

This commit is contained in:
Hans Leidekker 2011-03-30 12:31:19 +02:00 committed by Alexandre Julliard
parent e4d19fc47b
commit 8d58ddfe12
2 changed files with 9 additions and 5 deletions

View File

@ -276,7 +276,7 @@ static int parse_prop( const WCHAR *str, WCHAR *value, int *quotes )
break; break;
case ' ': case ' ':
state = state_whitespace; state = state_whitespace;
if (!count || !len) goto done; if (!count) goto done;
in_quotes = 1; in_quotes = 1;
break; break;
default: default:
@ -317,7 +317,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
BOOL preserve_case ) BOOL preserve_case )
{ {
LPCWSTR ptr, ptr2; LPCWSTR ptr, ptr2;
int quotes; int num_quotes;
DWORD len; DWORD len;
WCHAR *prop, *val; WCHAR *prop, *val;
UINT r; UINT r;
@ -345,10 +345,10 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine,
ptr2++; ptr2++;
while (*ptr2 == ' ') ptr2++; while (*ptr2 == ' ') ptr2++;
quotes = 0; num_quotes = 0;
val = msi_alloc( (strlenW( ptr2 ) + 1) * sizeof(WCHAR) ); val = msi_alloc( (strlenW( ptr2 ) + 1) * sizeof(WCHAR) );
len = parse_prop( ptr2, val, &quotes ); len = parse_prop( ptr2, val, &num_quotes );
if (quotes % 2) if (num_quotes % 2)
{ {
WARN("unbalanced quotes\n"); WARN("unbalanced quotes\n");
msi_free( val ); msi_free( val );

View File

@ -6282,6 +6282,10 @@ static void test_command_line_parsing(void)
r = MsiInstallProductA(msifile, cmd); r = MsiInstallProductA(msifile, cmd);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
cmd = "P=\" \"";
r = MsiInstallProductA(msifile, cmd);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
cmd = "P=one"; cmd = "P=one";
r = MsiInstallProductA(msifile, cmd); r = MsiInstallProductA(msifile, cmd);
ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);