https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c5955053769e586f8de76a3f57c16388e75975f3

commit c5955053769e586f8de76a3f57c16388e75975f3
Author:     winesync <[email protected]>
AuthorDate: Sun Mar 13 23:41:12 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:28:38 2022 +0100

    [WINESYNC] msi/tests: Always explicitly test REG_MULTI_SZ strings.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 80426fdc76597768b787a38644f1c53110b26f05 by Zebediah Figura 
<[email protected]>
---
 modules/rostests/winetests/msi/action.c | 38 ++++++++++++++++++++++-----------
 sdk/include/reactos/wine/test.h         |  1 +
 2 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/modules/rostests/winetests/msi/action.c 
b/modules/rostests/winetests/msi/action.c
index 35bdeecfa1a..4ee73ec1fc1 100644
--- a/modules/rostests/winetests/msi/action.c
+++ b/modules/rostests/winetests/msi/action.c
@@ -2516,7 +2516,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, 
LPCSTR expected, BOOL bcase
     res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
 
     if (res != ERROR_SUCCESS ||
-        (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
+        (type != REG_SZ && type != REG_EXPAND_SZ))
     {
         ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
         return;
@@ -2531,9 +2531,14 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, 
LPCSTR expected, BOOL bcase
 static void check_reg_multi(HKEY prodkey, const char *name, const char 
*expect, DWORD line)
 {
     char val[MAX_PATH];
-    DWORD size, type;
+    DWORD expect_size = 0, size, type;
+    const char *p;
     LONG res;
 
+    for (p = expect; *p; p += strlen(p) + 1)
+        ;
+    expect_size = (p + 1) - expect;
+
     size = MAX_PATH;
     val[0] = '\0';
     res = RegQueryValueExA(prodkey, name, NULL, &type, (BYTE *)val, &size);
@@ -2544,7 +2549,8 @@ static void check_reg_multi(HKEY prodkey, const char 
*name, const char *expect,
         return;
     }
 
-    ok_(__FILE__, line)(!memcmp(val, expect, size), "wrong data\n");
+    ok_(__FILE__, line)(size == expect_size, "expected size %u, got %u\n", 
expect_size, size);
+    ok_(__FILE__, line)(!memcmp(val, expect, size), "got %s\n", 
debugstr_an(val, size));
 }
 
 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD 
line)
@@ -2585,6 +2591,12 @@ static void check_reg_dword(HKEY prodkey, LPCSTR name, 
DWORD expected, DWORD lin
 #define CHECK_REG_MULTI(key, name, expect) \
     check_reg_multi(key, name, expect, __LINE__);
 
+#define CHECK_DEL_REG_MULTI(key, name, expect) \
+    do { \
+        check_reg_multi(key, name, expect, __LINE__); \
+        RegDeleteValueA(key, name); \
+    } while(0)
+
 #define CHECK_REG_DWORD(prodkey, name, expected) \
     check_reg_dword(prodkey, name, expected, __LINE__);
 
@@ -3127,7 +3139,7 @@ currentuser:
     CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
     CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
     CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
-    CHECK_DEL_REG_STR(hkey, "Clients", ":");
+    CHECK_DEL_REG_MULTI(hkey, "Clients", ":\0");
 
     res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@@ -3208,7 +3220,7 @@ machprod:
     todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
     CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
     CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
-    CHECK_DEL_REG_STR(hkey, "Clients", ":");
+    CHECK_DEL_REG_MULTI(hkey, "Clients", ":\0");
 
     res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@@ -6361,24 +6373,24 @@ static void test_publish_assemblies(void)
 
     res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_dotnet, 
"rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
+    CHECK_REG_MULTI(hkey, name_dotnet, 
"rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]\0");
     RegCloseKey(hkey);
 
     path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : 
path_dotnet_local;
     res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_dotnet_local, 
"rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
+    CHECK_REG_MULTI(hkey, name_dotnet_local, 
"rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox\0");
     RegCloseKey(hkey);
 
     res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_win32, 
"rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
+    CHECK_REG_MULTI(hkey, name_win32, 
"rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%\0");
     RegCloseKey(hkey);
 
     path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
     res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_win32_local, 
"rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
+    CHECK_REG_MULTI(hkey, name_win32_local, 
"rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!\0");
     RegCloseKey(hkey);
 
     /* No registration is done for a local assembly with no matching file */
@@ -6425,24 +6437,24 @@ static void test_publish_assemblies(void)
         res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, 
&hkey);
     }
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_dotnet, 
"rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
+    CHECK_REG_MULTI(hkey, name_dotnet, 
"rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]\0");
     RegCloseKey(hkey);
 
     path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : 
classes_path_dotnet_local;
     res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_dotnet_local, 
"rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
+    CHECK_REG_MULTI(hkey, name_dotnet_local, 
"rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox\0");
     RegCloseKey(hkey);
 
     res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, 
&hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_win32, 
"rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
+    CHECK_REG_MULTI(hkey, name_win32, 
"rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%\0");
     RegCloseKey(hkey);
 
     path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : 
classes_path_win32_local;
     res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
     ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
-    CHECK_REG_STR(hkey, name_win32_local, 
"rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
+    CHECK_REG_MULTI(hkey, name_win32_local, 
"rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!\0");
     RegCloseKey(hkey);
 
     /* No registration is done for a local assembly with no matching file */
diff --git a/sdk/include/reactos/wine/test.h b/sdk/include/reactos/wine/test.h
index 423d7ac3637..45578f1a65d 100644
--- a/sdk/include/reactos/wine/test.h
+++ b/sdk/include/reactos/wine/test.h
@@ -85,6 +85,7 @@ extern const char *wine_dbgstr_rect( const RECT *rect );
 extern const char *wine_dbgstr_longlong( ULONGLONG ll );
 #endif
 static inline const char *debugstr_a( const char *s )  { return 
wine_dbgstr_an( s, -1 ); }
+static inline const char *debugstr_an( const CHAR *s, intptr_t n ) { return 
wine_dbgstr_an( s, n ); }
 static inline const char *wine_dbgstr_a( const char *s )  { return 
wine_dbgstr_an( s, -1 ); }
 static inline const char *wine_dbgstr_w( const WCHAR *s ) { return 
wine_dbgstr_wn( s, -1 ); }
 

Reply via email to