Commit bb4a6da3 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

setupapi: Search for substituted strings in SetupFindNextMatchLine().

parent 32b6ccb9
......@@ -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 = &section->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;
......
......@@ -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)
......
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