Commit 03e9ef38 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

setupapi: Implement SetupDiDeleteDeviceInfo().

parent ac1d89fa
...@@ -1575,6 +1575,23 @@ BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data) ...@@ -1575,6 +1575,23 @@ BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
} }
/*********************************************************************** /***********************************************************************
* 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.@)
*/ */
BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO devinfo, SP_DEVICE_INTERFACE_DATA *iface_data) BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO devinfo, SP_DEVICE_INTERFACE_DATA *iface_data)
......
...@@ -612,18 +612,6 @@ BOOL WINAPI SetupDiDestroyDriverInfoList(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DAT ...@@ -612,18 +612,6 @@ BOOL WINAPI SetupDiDestroyDriverInfoList(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DAT
} }
/*********************************************************************** /***********************************************************************
* 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.@)
*/ */
INT WINAPI SetupDiDrawMiniIcon(HDC hdc, RECT rc, INT MiniIconIndex, DWORD Flags) INT WINAPI SetupDiDrawMiniIcon(HDC hdc, RECT rc, INT MiniIconIndex, DWORD Flags)
......
...@@ -337,13 +337,21 @@ static void test_device_info(void) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
while (SetupDiEnumDeviceInfo(set, i++, &device))
{
ret = SetupDiRemoveDevice(set, &device); ret = SetupDiRemoveDevice(set, &device);
ok(ret, "Failed to remove device, error %#x.\n", GetLastError()); ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
}
ret = SetupDiEnumDeviceInfo(set, 1, &device);
ok(!ret, "Expected failure.\n");
ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
SetupDiDestroyDeviceInfoList(set); SetupDiDestroyDeviceInfoList(set);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment