Zebediah Figura : setupapi: Handle error translation in SetupDiDeleteDevRegKey().

Alexandre Julliard julliard at winehq.org
Mon Feb 25 15:10:33 CST 2019


Module: wine
Branch: master
Commit: 922bc932c8f4a98c29f5ace7804e52dbbd65147a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=922bc932c8f4a98c29f5ace7804e52dbbd65147a

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Feb 24 22:08:19 2019 -0600

setupapi: Handle error translation in SetupDiDeleteDevRegKey().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/devinst.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index d8ae778..93a623a 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -586,7 +586,7 @@ static HKEY create_driver_key(struct device *device)
     return INVALID_HANDLE_VALUE;
 }
 
-static BOOL delete_driver_key(struct device *device)
+static LONG delete_driver_key(struct device *device)
 {
     HKEY key;
     LONG l;
@@ -597,8 +597,7 @@ static BOOL delete_driver_key(struct device *device)
         RegCloseKey(key);
     }
 
-    SetLastError(l);
-    return !l;
+    return l;
 }
 
 struct PropertyMapEntry
@@ -3571,7 +3570,6 @@ BOOL WINAPI SetupDiDeleteDevRegKey(HDEVINFO devinfo, SP_DEVINFO_DATA *device_dat
         DWORD Scope, DWORD HwProfile, DWORD KeyType)
 {
     struct device *device;
-    BOOL ret = FALSE;
     LONG l;
 
     TRACE("devinfo %p, device_data %p, scope %d, profile %d, type %d.\n",
@@ -3601,21 +3599,21 @@ BOOL WINAPI SetupDiDeleteDevRegKey(HDEVINFO devinfo, SP_DEVINFO_DATA *device_dat
     switch (KeyType)
     {
         case DIREG_DRV:
-            ret = delete_driver_key(device);
+            l = delete_driver_key(device);
             break;
         case DIREG_BOTH:
-            if (!(ret = delete_driver_key(device)))
+            if ((l = delete_driver_key(device)))
                 break;
             /* fall through */
         case DIREG_DEV:
             l = RegDeleteKeyW(device->key, DeviceParameters);
-            SetLastError(l);
-            ret = !l;
             break;
         default:
-            WARN("unknown KeyType %d\n", KeyType);
+            FIXME("Unhandled type %#x.\n", KeyType);
+            l = ERROR_CALL_NOT_IMPLEMENTED;
     }
-    return ret;
+    SetLastError(l);
+    return !l;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list