[PATCH 2/2] setupapi: Treat trailing \0 in field values same way as trailing spaces.

Dmitry Timoshkov dmitry at baikal.ru
Fri Sep 11 03:33:58 CDT 2020


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/setupapi/parser.c       | 4 ++--
 dlls/setupapi/tests/parser.c | 3 ---
 2 files changed, 2 insertions(+), 5 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 418b896302..08fb6c110d 100644
--- a/dlls/setupapi/tests/parser.c
+++ b/dlls/setupapi/tests/parser.c
@@ -824,21 +824,18 @@ static void test_SetupGetStringField(void)
     ok(ret, "SetupFindFirstLine error %u\n", GetLastError());
     ret = SetupGetStringFieldA(&context, 1, buf, sizeof(buf), NULL);
     ok(ret, "SetupGetStringField error %u\n", GetLastError());
-todo_wine
     ok(!strcmp(buf, "Company Name.Admin\\InstallerData\\Product Name\\1.2.3.45678_{11111111-1234-5678-1234-567812345678}\\Sources\\Setup.msi"), "got %s\n", wine_dbgstr_a(buf));
 
     ret = SetupFindFirstLineA(hinf, "MSIinstaller", "Name2", &context);
     ok(ret, "SetupFindFirstLine error %u\n", GetLastError());
     ret = SetupGetStringFieldA(&context, 1, buf, sizeof(buf), NULL);
     ok(ret, "SetupGetStringField error %u\n", GetLastError());
-todo_wine
     ok(!strcmp(buf, "Company Name.Admin\\InstallerData\\Product Name\\1.2.3.45678_{22222222-1234-5678-1234 -567812345678}\\Sources\\Setup.msi"), "got %s\n", wine_dbgstr_a(buf));
 
     ret = SetupFindFirstLineA(hinf, "MSIinstaller", "Name3", &context);
     ok(ret, "SetupFindFirstLine error %u\n", GetLastError());
     ret = SetupGetStringFieldA(&context, 1, buf, sizeof(buf), NULL);
     ok(ret, "SetupGetStringField error %u\n", GetLastError());
-todo_wine
     ok(!strcmp(buf, "Company Name.Admin\\InstallerData\\Product Name\\1.2.3.45678_{33333333-1234-5678-1234-567812345678}\\Sources\\Setup.msi"), "got %s\n", wine_dbgstr_a(buf));
 
     ret = SetupFindFirstLineA(hinf, "MSIinstaller", "Name4", &context);
-- 
2.26.2




More information about the wine-devel mailing list