From 9828509db3f0086a33e44b7103e195ee44f9abbf Mon Sep 17 00:00:00 2001 From: winesync Date: Thu, 14 Sep 2023 19:40:55 +0200 Subject: [PATCH] [WINESYNC] setupapi: Search for substituted strings in SetupFindNextMatchLine(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard wine commit id bb4a6da373d7fdb4a61743ee0632298f6a2f333f by Zebediah Figura --- dll/win32/setupapi/parser.c | 4 +++- modules/rostests/winetests/setupapi/parser.c | 10 ++++++++++ sdk/tools/winesync/setupapi.cfg | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dll/win32/setupapi/parser.c b/dll/win32/setupapi/parser.c index c38d62c1f5c..fb2ffa5cf19 100644 --- a/dll/win32/setupapi/parser.c +++ b/dll/win32/setupapi/parser.c @@ -1696,6 +1696,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; @@ -1709,7 +1710,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/modules/rostests/winetests/setupapi/parser.c b/modules/rostests/winetests/setupapi/parser.c index 07dcaafd558..06c674aa16e 100644 --- a/modules/rostests/winetests/setupapi/parser.c +++ b/modules/rostests/winetests/setupapi/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) diff --git a/sdk/tools/winesync/setupapi.cfg b/sdk/tools/winesync/setupapi.cfg index 1890d5e5f0b..51bd819bc37 100644 --- a/sdk/tools/winesync/setupapi.cfg +++ b/sdk/tools/winesync/setupapi.cfg @@ -8,4 +8,4 @@ files: dlls/setupapi/setupcab.c: dll/win32/setupapi/setupcab.c dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable_wine.c tags: - wine: f703c7f22d5da5596c9abc91400191d3e12c3cbc + wine: bb4a6da373d7fdb4a61743ee0632298f6a2f333f