Zebediah Figura : setupapi: Implement SetupDiDeleteDeviceInfo().
Alexandre Julliard
julliard at winehq.org
Tue Dec 4 16:33:54 CST 2018
Module: wine
Branch: master
Commit: 03e9ef38a7d16920f60b6c17d711588ac25e53ea
URL: https://source.winehq.org/git/wine.git/?a=commit;h=03e9ef38a7d16920f60b6c17d711588ac25e53ea
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Mon Dec 3 23:36:16 2018 -0600
setupapi: Implement SetupDiDeleteDeviceInfo().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43211
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/setupapi/devinst.c | 17 ++++++++++++++
dlls/setupapi/stubs.c | 12 ----------
dlls/setupapi/tests/devinst.c | 52 +++++++++++++++++++++++++++++--------------
3 files changed, 52 insertions(+), 29 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index db0b72f..5685dc3 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -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.@)
*/
BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO devinfo, SP_DEVICE_INTERFACE_DATA *iface_data)
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 7c3413a..61ce005 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -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.@)
*/
INT WINAPI SetupDiDrawMiniIcon(HDC hdc, RECT rc, INT MiniIconIndex, DWORD Flags)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index edb660e..55fe104 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -337,13 +337,21 @@ static void test_device_info(void)
check_device_info(set, 2, &guid, "ROOT\\LEGACY_BOGUS\\0002");
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);
ok(ret, "Got unexpected error %#x.\n", GetLastError());
- check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
- check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0001");
+ check_device_info(set, 0, &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(IsEqualGUID(&ret_device.ClassGuid, &guid), "Got unexpected class %s.\n",
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",
device.DevInst, ret_device.DevInst);
- check_device_info(set, 3, &guid, NULL);
+ check_device_info(set, 2, &guid, NULL);
SetupDiDestroyDeviceInfoList(set);
@@ -469,7 +477,7 @@ static void test_register_device_info(void)
SP_DEVINFO_DATA device = {0};
BOOL ret;
HDEVINFO set;
- char id[30];
+ int i = 0;
SetLastError(0xdeadbeef);
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);
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 = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &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 = 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);
set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError());
- ret = SetupDiEnumDeviceInfo(set, 0, &device);
- ok(ret, "Failed to enumerate devices, error %#x.\n", GetLastError());
- ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), 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);
- ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+ check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\0000");
+ check_device_info(set, 1, &guid, "Root\\LEGACY_BOGUS\\0002");
+ check_device_info(set, 2, &guid, NULL);
- ret = SetupDiEnumDeviceInfo(set, 1, &device);
- ok(!ret, "Expected failure.\n");
- ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
+ while (SetupDiEnumDeviceInfo(set, i++, &device))
+ {
+ ret = SetupDiRemoveDevice(set, &device);
+ ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+ }
SetupDiDestroyDeviceInfoList(set);
}
More information about the wine-cvs
mailing list