Paul Vriens : advapi32/tests: Make sure NT4 and W2K tests don't fail.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 10 14:58:04 CDT 2007


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

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Tue Apr 10 11:29:10 2007 +0200

advapi32/tests: Make sure NT4 and W2K tests don't fail.

---

 dlls/advapi32/tests/registry.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index 1d9fab6..0b6a25a 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -657,10 +657,22 @@ static void test_reg_delete_key(void)
     DWORD ret;
 
     ret = RegDeleteKey(hkey_main, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER ||
-       ret == ERROR_ACCESS_DENIED ||
-       ret == ERROR_BADKEY, /* Win95 */
-       "ret=%d\n", ret);
+
+    /* There is a bug in NT4 and W2K that doesn't check if the subkey is NULL. If
+     * there are also no subkeys available it will delete the key pointed to by hkey_main.
+     * Not re-creating will make some next tests fail.
+     */
+    if (ret == ERROR_SUCCESS)
+    {
+        trace("We are probably running on NT4 or W2K as the main key is deleted,"
+            " re-creating the main key\n");
+        setup_main_key();
+    }
+    else
+        ok(ret == ERROR_INVALID_PARAMETER ||
+           ret == ERROR_ACCESS_DENIED ||
+           ret == ERROR_BADKEY, /* Win95 */
+           "ret=%d\n", ret);
 }
 
 static void test_reg_save_key(void)




More information about the wine-cvs mailing list