[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 1/4] setupapi: Implement SetupDiRemoveDeviceInterface().
From:       Zebediah Figura <z.figura12 () gmail ! com>
Date:       2018-11-30 22:42:10
Message-ID: 20181130224213.18606-1-z.figura12 () gmail ! com
[Download RAW message or body]

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
 dlls/setupapi/devinst.c       | 28 ++++++++++++++++++++++++----
 dlls/setupapi/tests/devinst.c |  2 --
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 55fca897c3..479b8297b0 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -556,6 +556,19 @@ static BOOL SETUPDI_SetDeviceRegistryPropertyW(struct device \
*device,  return FALSE;
 }
 
+static void remove_device_iface(struct device_iface *iface)
+{
+    RegDeleteTreeW(iface->refstr_key, NULL);
+    RegDeleteKeyW(iface->refstr_key, emptyW);
+    RegCloseKey(iface->refstr_key);
+    iface->refstr_key = NULL;
+    /* Also remove the class key if it's empty. */
+    RegDeleteKeyW(iface->class_key, emptyW);
+    RegCloseKey(iface->class_key);
+    iface->class_key = NULL;
+    iface->flags |= SPINT_REMOVED;
+}
+
 static void SETUPDI_RemoveDevice(struct device *device)
 {
     struct device_iface *iface, *next;
@@ -1537,11 +1550,18 @@ BOOL WINAPI SetupDiRemoveDevice(
 /***********************************************************************
  *              SetupDiRemoveDeviceInterface (SETUPAPI.@)
  */
-BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO info, PSP_DEVICE_INTERFACE_DATA \
data) +BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO devinfo, \
SP_DEVICE_INTERFACE_DATA *iface_data)  {
-    FIXME("(%p, %p): stub\n", info, data);
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+    struct device_iface *iface;
+
+    TRACE("devinfo %p, iface_data %p.\n", devinfo, iface_data);
+
+    if (!(iface = get_device_iface(devinfo, iface_data)))
+        return FALSE;
+
+    remove_device_iface(iface);
+
+    return TRUE;
 }
 
 /***********************************************************************
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 338393e5f2..fbc62dcbb9 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -552,7 +552,6 @@ static void check_device_iface_(int line, HDEVINFO set, \
                SP_DEVINFO_DATA *device,
         ok_(__FILE__, line)(ret, "Failed to enumerate interfaces, error %#x.\n", \
                GetLastError());
         ok_(__FILE__, line)(IsEqualGUID(&iface.InterfaceClassGuid, class),
                 "Got unexpected class %s.\n", \
                wine_dbgstr_guid(&iface.InterfaceClassGuid));
-todo_wine_if(flags & SPINT_REMOVED)
         ok_(__FILE__, line)(iface.Flags == flags, "Got unexpected flags %#x.\n", \
                iface.Flags);
         ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), \
                NULL, NULL);
         ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#x.\n", \
GetLastError()); @@ -656,7 +655,6 @@ static void test_device_iface(void)
     ret = SetupDiEnumDeviceInterfaces(set, &device, &guid2, 0, &iface);
     ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
     ret = SetupDiRemoveDeviceInterface(set, &iface);
-todo_wine
     ok(ret, "Failed to remove interface, error %#x.\n", GetLastError());
 
     check_device_iface(set, &device, &guid2, 0, SPINT_REMOVED, \
                "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A5-3F65-11DB-B704-0011955C2BDB}");
                
-- 
2.14.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic