setupapi: Implement SetupDiRemoveDeviceInterface().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-11-30 16:42:10 -06:00 committed by Alexandre Julliard
parent 0cc68cf82a
commit 3ff9874034
2 changed files with 24 additions and 6 deletions

View File

@ -556,6 +556,19 @@ static BOOL SETUPDI_SetDeviceRegistryPropertyW(struct device *device,
return FALSE; 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) static void SETUPDI_RemoveDevice(struct device *device)
{ {
struct device_iface *iface, *next; struct device_iface *iface, *next;
@ -1537,11 +1550,18 @@ BOOL WINAPI SetupDiRemoveDevice(
/*********************************************************************** /***********************************************************************
* SetupDiRemoveDeviceInterface (SETUPAPI.@) * 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); struct device_iface *iface;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
TRACE("devinfo %p, iface_data %p.\n", devinfo, iface_data);
if (!(iface = get_device_iface(devinfo, iface_data)))
return FALSE; return FALSE;
remove_device_iface(iface);
return TRUE;
} }
/*********************************************************************** /***********************************************************************

View File

@ -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)(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
ok_(__FILE__, line)(IsEqualGUID(&iface.InterfaceClassGuid, class), ok_(__FILE__, line)(IsEqualGUID(&iface.InterfaceClassGuid, class),
"Got unexpected class %s.\n", wine_dbgstr_guid(&iface.InterfaceClassGuid)); "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); ok_(__FILE__, line)(iface.Flags == flags, "Got unexpected flags %#x.\n", iface.Flags);
ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL); ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL);
ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#x.\n", GetLastError()); 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); ret = SetupDiEnumDeviceInterfaces(set, &device, &guid2, 0, &iface);
ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError()); ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
ret = SetupDiRemoveDeviceInterface(set, &iface); ret = SetupDiRemoveDeviceInterface(set, &iface);
todo_wine
ok(ret, "Failed to remove interface, error %#x.\n", GetLastError()); 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}"); check_device_iface(set, &device, &guid2, 0, SPINT_REMOVED, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A5-3F65-11DB-B704-0011955C2BDB}");