Module: wine Branch: master Commit: bb4a6da373d7fdb4a61743ee0632298f6a2f333f URL: https://source.winehq.org/git/wine.git/?a=commit;h=bb4a6da373d7fdb4a61743ee0...
Author: Zebediah Figura z.figura12@gmail.com Date: Mon Feb 25 22:26:39 2019 -0600
setupapi: Search for substituted strings in SetupFindNextMatchLine().
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/setupapi/parser.c | 4 +++- dlls/setupapi/tests/parser.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c index bc5dba0..5cde5eb 100644 --- a/dlls/setupapi/parser.c +++ b/dlls/setupapi/parser.c @@ -1557,6 +1557,7 @@ BOOL WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key, PINFCONTEXT context_out ) { struct inf_file *file = context_in->CurrentInf; + WCHAR buffer[MAX_STRING_LEN + 1]; struct section *section; struct line *line; unsigned int i; @@ -1570,7 +1571,8 @@ BOOL WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key, for (i = context_in->Line+1, line = §ion->lines[i]; i < section->nb_lines; i++, line++) { if (line->key_field == -1) continue; - if (!strcmpiW( key, file->fields[line->key_field].text )) + PARSER_string_substW( file, file->fields[line->key_field].text, buffer, ARRAY_SIZE(buffer) ); + if (!strcmpiW( key, buffer )) { if (context_out != context_in) *context_out = *context_in; context_out->Line = i; diff --git a/dlls/setupapi/tests/parser.c b/dlls/setupapi/tests/parser.c index 07dcaaf..06c674a 100644 --- a/dlls/setupapi/tests/parser.c +++ b/dlls/setupapi/tests/parser.c @@ -428,6 +428,16 @@ static void test_key_names(void) ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %u\n", i, GetLastError() ); if (hinf == INVALID_HANDLE_VALUE) continue;
+ ret = SetupFindFirstLineA( hinf, "Test", key_names[i].key, &context ); + ok(ret, "Test %d: failed to find key %s\n", i, key_names[i].key); + + if (!strncmp( key_names[i].data, "%foo%", strlen( "%foo%" ) )) + { + ret = SetupFindFirstLineA( hinf, "Test", "%foo%", &context ); + ok(!ret, "SetupFindFirstLine() should not match unsubstituted keys\n"); + ok(GetLastError() == ERROR_LINE_NOT_FOUND, "got wrong error %u\n", GetLastError()); + } + ret = SetupFindFirstLineA( hinf, "Test", 0, &context ); ok(ret, "SetupFindFirstLineA failed: le=%u\n", GetLastError()); if (!ret)