Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/setupapi/parser.c | 4 ++-- dlls/setupapi/tests/parser.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c index 560c2401b8..c81a712ad8 100644 --- a/dlls/setupapi/parser.c +++ b/dlls/setupapi/parser.c @@ -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; diff --git a/dlls/setupapi/tests/parser.c b/dlls/setupapi/tests/parser.c index 8cde35b9de..c18063fbe3 100644 --- a/dlls/setupapi/tests/parser.c +++ b/dlls/setupapi/tests/parser.c @@ -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",