Alexandre Julliard : advapi32/tests: Add some tests for creation of volatile keys.

Alexandre Julliard julliard at winehq.org
Fri Nov 20 10:48:02 CST 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Nov 20 11:40:07 2009 +0100

advapi32/tests: Add some tests for creation of volatile keys.

---

 dlls/advapi32/tests/registry.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index abc2eb4..dee7664 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -956,6 +956,28 @@ static void test_reg_create_key(void)
     /* clean up */
     RegDeleteKey(hkey2, "");
     RegDeleteKey(hkey1, "");
+    RegCloseKey(hkey2);
+    RegCloseKey(hkey1);
+
+    /* test creation of volatile keys */
+    ret = RegCreateKeyExA(hkey_main, "Volatile", 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey1, NULL);
+    ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
+    ret = RegCreateKeyExA(hkey1, "Subkey2", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey2, NULL);
+    ok(ret == ERROR_CHILD_MUST_BE_VOLATILE || broken(!ret), /* win9x */
+       "RegCreateKeyExA failed with error %d\n", ret);
+    if (!ret) RegCloseKey( hkey2 );
+    ret = RegCreateKeyExA(hkey1, "Subkey2", 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey2, NULL);
+    ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
+    RegCloseKey(hkey2);
+    /* should succeed if the key already exists */
+    ret = RegCreateKeyExA(hkey1, "Subkey2", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey2, NULL);
+    ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
+
+    /* clean up */
+    RegDeleteKey(hkey2, "");
+    RegDeleteKey(hkey1, "");
+    RegCloseKey(hkey2);
+    RegCloseKey(hkey1);
 
     /*  beginning backslash character */
     ret = RegCreateKeyExA(hkey_main, "\\Subkey3", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL);
@@ -964,6 +986,7 @@ static void test_reg_create_key(void)
     else {
         ok(!ret, "RegCreateKeyExA failed with error %d\n", ret);
         RegDeleteKey(hkey1, NULL);
+        RegCloseKey(hkey1);
     }
 
     /* WOW64 flags - open an existing key */




More information about the wine-cvs mailing list