setupapi: Implement SetupDiDeleteDeviceInfo().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43211 Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ac1d89fa13
commit
03e9ef38a7
|
@ -1574,6 +1574,23 @@ BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetupDiDeleteDeviceInfo (SETUPAPI.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI SetupDiDeleteDeviceInfo(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
||||||
|
{
|
||||||
|
struct device *device;
|
||||||
|
|
||||||
|
TRACE("devinfo %p, device_data %p.\n", devinfo, device_data);
|
||||||
|
|
||||||
|
if (!(device = get_device(devinfo, device_data)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
delete_device(device);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiRemoveDeviceInterface (SETUPAPI.@)
|
* SetupDiRemoveDeviceInterface (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -611,18 +611,6 @@ BOOL WINAPI SetupDiDestroyDriverInfoList(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DAT
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* SetupDiDeleteDeviceInfo (SETUPAPI.@)
|
|
||||||
*/
|
|
||||||
|
|
||||||
BOOL WINAPI SetupDiDeleteDeviceInfo(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
|
|
||||||
{
|
|
||||||
FIXME(": stub %p, %p\n", DeviceInfoSet, DeviceInfoData);
|
|
||||||
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiDrawMiniIcon (SETUPAPI.@)
|
* SetupDiDrawMiniIcon (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -337,13 +337,21 @@ static void test_device_info(void)
|
||||||
check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\0002");
|
check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\0002");
|
||||||
check_device_info(set, 3, &guid, NULL);
|
check_device_info(set, 3, &guid, NULL);
|
||||||
|
|
||||||
|
ret = SetupDiEnumDeviceInfo(set, 0, &ret_device);
|
||||||
|
ok(ret, "Failed to enumerate devices, error %#x.\n", GetLastError());
|
||||||
|
ret = SetupDiDeleteDeviceInfo(set, &ret_device);
|
||||||
|
ok(ret, "Failed to delete device, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
|
check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0001");
|
||||||
|
check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0002");
|
||||||
|
check_device_info(set, 2, &guid, NULL);
|
||||||
|
|
||||||
ret = SetupDiRemoveDevice(set, &device);
|
ret = SetupDiRemoveDevice(set, &device);
|
||||||
ok(ret, "Got unexpected error %#x.\n", GetLastError());
|
ok(ret, "Got unexpected error %#x.\n", GetLastError());
|
||||||
|
|
||||||
check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
|
check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0001");
|
||||||
check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0001");
|
|
||||||
|
|
||||||
ret = SetupDiEnumDeviceInfo(set, 2, &ret_device);
|
ret = SetupDiEnumDeviceInfo(set, 1, &ret_device);
|
||||||
ok(ret, "Got unexpected error %#x.\n", GetLastError());
|
ok(ret, "Got unexpected error %#x.\n", GetLastError());
|
||||||
ok(IsEqualGUID(&ret_device.ClassGuid, &guid), "Got unexpected class %s.\n",
|
ok(IsEqualGUID(&ret_device.ClassGuid, &guid), "Got unexpected class %s.\n",
|
||||||
wine_dbgstr_guid(&ret_device.ClassGuid));
|
wine_dbgstr_guid(&ret_device.ClassGuid));
|
||||||
|
@ -353,7 +361,7 @@ static void test_device_info(void)
|
||||||
ok(ret_device.DevInst == device.DevInst, "Expected device node %#x, got %#x.\n",
|
ok(ret_device.DevInst == device.DevInst, "Expected device node %#x, got %#x.\n",
|
||||||
device.DevInst, ret_device.DevInst);
|
device.DevInst, ret_device.DevInst);
|
||||||
|
|
||||||
check_device_info(set, 3, &guid, NULL);
|
check_device_info(set, 2, &guid, NULL);
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(set);
|
SetupDiDestroyDeviceInfoList(set);
|
||||||
|
|
||||||
|
@ -469,7 +477,7 @@ static void test_register_device_info(void)
|
||||||
SP_DEVINFO_DATA device = {0};
|
SP_DEVINFO_DATA device = {0};
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
HDEVINFO set;
|
HDEVINFO set;
|
||||||
char id[30];
|
int i = 0;
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = SetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
|
ret = SetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
|
||||||
|
@ -497,30 +505,40 @@ static void test_register_device_info(void)
|
||||||
|
|
||||||
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
|
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
|
||||||
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
|
ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
|
||||||
ok(ret, "Failed to register device, error %#x.\n", GetLastError());
|
ok(ret, "Failed to register device, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device);
|
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device);
|
||||||
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
||||||
|
ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
|
||||||
|
ok(ret, "Failed to register device, error %#x.\n", GetLastError());
|
||||||
|
ret = SetupDiRemoveDevice(set, &device);
|
||||||
|
ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
|
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0002", &guid, NULL, NULL, 0, &device);
|
||||||
|
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
||||||
|
ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
|
||||||
|
ok(ret, "Failed to register device, error %#x.\n", GetLastError());
|
||||||
|
ret = SetupDiDeleteDeviceInfo(set, &device);
|
||||||
|
ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
|
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0003", &guid, NULL, NULL, 0, &device);
|
||||||
|
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(set);
|
SetupDiDestroyDeviceInfoList(set);
|
||||||
|
|
||||||
set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
|
set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
|
||||||
ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError());
|
ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError());
|
||||||
|
|
||||||
ret = SetupDiEnumDeviceInfo(set, 0, &device);
|
check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\0000");
|
||||||
ok(ret, "Failed to enumerate devices, error %#x.\n", GetLastError());
|
check_device_info(set, 1, &guid, "Root\\LEGACY_BOGUS\\0002");
|
||||||
ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
|
check_device_info(set, 2, &guid, NULL);
|
||||||
ok(ret, "Failed to get device id, error %#x.\n", GetLastError());
|
|
||||||
ok(!strcasecmp(id, "Root\\LEGACY_BOGUS\\0000"), "Got unexpected id %s.\n", id);
|
|
||||||
|
|
||||||
ret = SetupDiRemoveDevice(set, &device);
|
while (SetupDiEnumDeviceInfo(set, i++, &device))
|
||||||
ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
|
{
|
||||||
|
ret = SetupDiRemoveDevice(set, &device);
|
||||||
ret = SetupDiEnumDeviceInfo(set, 1, &device);
|
ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
|
||||||
ok(!ret, "Expected failure.\n");
|
}
|
||||||
ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
|
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(set);
|
SetupDiDestroyDeviceInfoList(set);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue