Huw Davies : setupapi/tests: Use RegQueryValueEx so that tests run on Win XP.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 14 11:12:51 CDT 2015


Module: wine
Branch: master
Commit: 45c987d962e18637b916057e783f864f51e90f35
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=45c987d962e18637b916057e783f864f51e90f35

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Oct 14 12:45:14 2015 +0100

setupapi/tests: Use RegQueryValueEx so that tests run on Win XP.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/tests/install.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index 10161f0..d12d683 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -732,7 +732,8 @@ static void check_dirid(int dirid, LPCSTR expected)
     char buffer[sizeof(dirid_inf)+11];
     char path[MAX_PATH], actual[MAX_PATH];
     LONG ret;
-    DWORD size;
+    DWORD size, type;
+    HKEY key;
 
     sprintf(buffer, dirid_inf, dirid);
 
@@ -742,8 +743,16 @@ static void check_dirid(int dirid, LPCSTR expected)
     run_cmdline("DefaultInstall", 128, path);
 
     size = sizeof(actual);
-    ret = RegGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest", "dirid",
-        RRF_RT_REG_SZ|RRF_ZEROONFAILURE, NULL, &actual, &size);
+    actual[0] = '\0';
+    ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest", &key);
+    if (ret == ERROR_SUCCESS)
+    {
+        ret = RegQueryValueExA(key, "dirid", NULL, &type, (BYTE*)&actual, &size);
+        RegCloseKey(key);
+        if (type != REG_SZ)
+            ret = ERROR_FILE_NOT_FOUND;
+    }
+
     ok(ret == ERROR_SUCCESS, "Failed getting value for dirid %i, err=%d\n", dirid, ret);
     ok(!strcmp(actual, expected), "Expected path for dirid %i was \"%s\", got \"%s\"\n", dirid, expected, actual);
 




More information about the wine-cvs mailing list