=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: setupapi/tests: Try to delete pre-existing key.

Alexandre Julliard julliard at winehq.org
Tue Sep 13 11:33:56 CDT 2016


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Mon Sep 12 19:29:15 2016 +0200

setupapi/tests: Try to delete pre-existing key.

Signed-off-by: André Hentschel <nerv at dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/tests/devinst.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index b6439d5..4c2fd58 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -451,7 +451,6 @@ static void testCreateDeviceInfo(void)
         DWORD i;
         static GUID deadbeef =
          {0xdeadbeef, 0xdead, 0xbeef, {0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
-        LONG res;
         HKEY key;
         static const WCHAR bogus0000[] = {'S','y','s','t','e','m','\\',
          'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
@@ -459,8 +458,13 @@ static void testCreateDeviceInfo(void)
          'L','E','G','A','C','Y','_','B','O','G','U','S','\\','0','0','0','0',0};
 
         /* So we know we have a clean start */
-        res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus0000, &key);
-        ok(res != ERROR_SUCCESS, "Expected key to not exist\n");
+        if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus0000, &key))
+        {
+            trace("Expected LEGACY_BOGUS\\0000 key to not exist, will be removed now\n");
+            change_reg_permissions(bogus0000);
+            ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus0000), "Could not delete LEGACY_BOGUS\\0000 key\n");
+        }
+
         /* No GUID given */
         SetLastError(0xdeadbeef);
         ret = pSetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", NULL,




More information about the wine-cvs mailing list