Bruno Jesus : bcrypt/tests: Workaround RegGetValueW not being present in XP.

Alexandre Julliard julliard at winehq.org
Tue Dec 6 16:27:45 CST 2016


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Fri Dec  2 18:36:39 2016 -0200

bcrypt/tests: Workaround RegGetValueW not being present in XP.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/bcrypt/tests/bcrypt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 5cdb065..4466179 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -75,18 +75,19 @@ static void test_BCryptGetFipsAlgorithmMode(void)
         'L','s','a',0};
     static const WCHAR policyValueXPW[] = {
         'F','I','P','S','A','l','g','o','r','i','t','h','m','P','o','l','i','c','y',0};
+    HKEY hkey = NULL;
     BOOLEAN expected;
     BOOLEAN enabled;
     DWORD value, count[2] = {sizeof(value), sizeof(value)};
     NTSTATUS ret;
 
-    if (!RegGetValueW(HKEY_LOCAL_MACHINE, policyKeyVistaW, policyValueVistaW,
-        RRF_RT_REG_DWORD, NULL, &value, &count[0]))
+    if (RegOpenKeyW(HKEY_LOCAL_MACHINE, policyKeyVistaW, &hkey) == ERROR_SUCCESS &&
+        RegQueryValueExW(hkey, policyValueVistaW, NULL, NULL, (void *)&value, &count[0]) == ERROR_SUCCESS)
     {
         expected = !!value;
     }
-    else if (!RegGetValueW(HKEY_LOCAL_MACHINE, policyKeyXPW, policyValueXPW,
-             RRF_RT_REG_DWORD, NULL, &value, &count[1]))
+      else if (RegOpenKeyW(HKEY_LOCAL_MACHINE, policyKeyXPW, &hkey) == ERROR_SUCCESS &&
+               RegQueryValueExW(hkey, policyValueXPW, NULL, NULL, (void *)&value, &count[0]) == ERROR_SUCCESS)
     {
         expected = !!value;
     }
@@ -96,6 +97,7 @@ static void test_BCryptGetFipsAlgorithmMode(void)
 todo_wine
         ok(0, "Neither XP or Vista key is present\n");
     }
+    RegCloseKey(hkey);
 
     ret = BCryptGetFipsAlgorithmMode(&enabled);
     ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret);




More information about the wine-cvs mailing list