[PATCH v2 4/4] setupapi: Also remove the driver key in remove_device().

Zebediah Figura z.figura12 at gmail.com
Tue Jan 22 22:10:32 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/setupapi/devinst.c       | 2 ++
 dlls/setupapi/tests/devinst.c | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index e577f832b6..36c1854654 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -656,6 +656,8 @@ static void remove_device(struct device *device)
     struct device_iface *iface;
     HKEY enum_key;
 
+    delete_driver_key(device);
+
     LIST_FOR_EACH_ENTRY(iface, &device->interfaces, struct device_iface, entry)
     {
         remove_device_iface(iface);
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index ca29a3f7e0..74fa545029 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -828,15 +828,22 @@ todo_wine {
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
     ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
 
-    RegCloseKey(class_key);
+    key = SetupDiCreateDevRegKeyW(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
+    ok(key != INVALID_HANDLE_VALUE, "Failed to create device key, error %#x.\n", GetLastError());
+    RegCloseKey(key);
 
     ret = SetupDiRemoveDevice(set, &device);
     ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
     SetupDiDestroyDeviceInfoList(set);
 
+    res = RegOpenKeyA(class_key, driver_path, &key);
+    ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
+
     /* Vista+ deletes the key automatically. */
     res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, class_key_path);
     ok(!res || res == ERROR_FILE_NOT_FOUND, "Failed to delete class key, error %u.\n", res);
+
+    RegCloseKey(class_key);
 }
 
 static void test_register_device_iface(void)
-- 
2.17.1




More information about the wine-devel mailing list