Commit 5b7fac05 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

setupapi: Treat trailing \0 in field values same way as trailing spaces.

parent 43115a74
......@@ -724,7 +724,7 @@ static const WCHAR *value_name_state( struct parser *parser, const WCHAR *pos )
set_state( parser, EOL_BACKSLASH );
return p;
default:
if (!iswspace(*p)) token_end = p + 1;
if (*p && !iswspace(*p)) token_end = p + 1;
else
{
push_token( parser, p );
......@@ -838,7 +838,7 @@ static const WCHAR *trailing_spaces_state( struct parser *parser, const WCHAR *p
set_state( parser, EOL_BACKSLASH );
return p;
}
if (!iswspace(*p)) break;
if (*p && !iswspace(*p)) break;
}
pop_state( parser );
return p;
......
......@@ -370,6 +370,9 @@ static const struct
{ C("ab\032=cd"), "ab", { "ab" } },
/* nulls */
{ C("abcd=ef\x0gh"), "abcd", { "ef gh" } },
{ C("foo=%bar%\n[Strings]\nbar=bbb\0\n"), "foo", { "bbb" } },
{ C("foo=%bar%\n[Strings]\nbar=bbb \0\n"), "foo", { "bbb" } },
{ C("foo=%bar%\n[Strings]\nbar=aaa\0bbb \0\n"), "foo", { "aaa bbb" } },
/* multiple sections with same name */
{ C("[Test2]\nab\n[Test]\nee=ff\n"), "ee", { "ff" } },
/* string substitution */
......@@ -470,12 +473,12 @@ static void test_key_names(void)
ok( err == 0, "line %u: bad error %u\n", i, err );
if (key_names[i].fields[index])
{
if (i == 49)
if (i == 52)
ok( !strcmp( field, key_names[i].fields[index] ) ||
!strcmp( field, A1200), /* Vista, W2K8 */
"line %u: bad field %s/%s\n",
i, field, key_names[i].fields[index] );
else if (i == 52)
else if (i == 55)
ok( !strcmp( field, key_names[i].fields[index] ) ||
!strcmp( field, A4096), /* Win10 >= 1709 */
"line %u: bad field %s/%s\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment