Sebastian Lackner : hidclass.sys: Do not return last error / HRESULT values in NTSTATUS functions.

Alexandre Julliard julliard at winehq.org
Mon Sep 12 10:14:09 CDT 2016


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

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Mon Sep 12 15:47:36 2016 +0200

hidclass.sys: Do not return last error / HRESULT values in NTSTATUS functions.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hidclass.sys/device.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index b90e701..d2a4710 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -77,7 +77,7 @@ NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRAT
 
     IoAttachDeviceToDeviceStack(*device, native_device);
 
-    return S_OK;
+    return STATUS_SUCCESS;
 }
 
 NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
@@ -118,7 +118,7 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
     if (!devinfo)
     {
         FIXME( "failed to get ClassDevs %x\n", GetLastError());
-        return GetLastError();
+        return STATUS_UNSUCCESSFUL;
     }
     Data.cbSize = sizeof(Data);
     if (!SetupDiCreateDeviceInfoW(devinfo, ext->instance_id, &GUID_DEVCLASS_HIDCLASS, NULL, NULL, DICD_INHERIT_CLASSDRVS, &Data))
@@ -126,24 +126,28 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
         if (GetLastError() == ERROR_DEVINST_ALREADY_EXISTS)
         {
             SetupDiDestroyDeviceInfoList(devinfo);
-            return ERROR_SUCCESS;
+            return STATUS_SUCCESS;
         }
         FIXME( "failed to Create Device Info %x\n", GetLastError());
-        return GetLastError();
+        goto error;
     }
     if (!SetupDiRegisterDeviceInfo( devinfo, &Data, 0, NULL, NULL, NULL ))
     {
         FIXME( "failed to Register Device Info %x\n", GetLastError());
-        return GetLastError();
+        goto error;
     }
     if (!SetupDiCreateDeviceInterfaceW( devinfo, &Data,  &hidGuid, NULL, 0, NULL))
     {
         FIXME( "failed to Create Device Interface %x\n", GetLastError());
-        return GetLastError();
+        goto error;
     }
+
     SetupDiDestroyDeviceInfoList(devinfo);
+    return STATUS_SUCCESS;
 
-    return S_OK;
+error:
+    SetupDiDestroyDeviceInfoList(devinfo);
+    return STATUS_UNSUCCESSFUL;
 }
 
 void HID_DeleteDevice(HID_MINIDRIVER_REGISTRATION *driver, DEVICE_OBJECT *device)




More information about the wine-cvs mailing list