From 057c92db54b7404a08ac704f1a2e280344cd5b8d Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Wed, 28 May 2008 18:17:19 +0200 Subject: [PATCH] setupapi/tests: Remove leftovers from old tests. --- dlls/setupapi/tests/devinst.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index ec1542dcc0b..cd72db42168 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -459,15 +459,41 @@ static void testCreateDeviceInfo(void) pSetupDiDestroyDeviceInfoList(set); } + /* The bogus registry key shouldn't be there after this test. The only + * reasons this key would still be present: + * + * - We are running on Wine which has to be fixed + * - We have leftovers from old tests + */ res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); - /* FIXME: Remove when Wine is fixed */ if (res == ERROR_SUCCESS) { - /* Wine doesn't delete the information currently */ - trace("We are most likely on Wine\n"); - RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus); + DWORD subkeys; + + /* Check if we have subkeys */ + RegQueryInfoKey(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + if (subkeys > 0) + { + int i; + + /* Leftovers from old tests */ + trace("Going to remove %d devices\n", subkeys); + for (i = 0; i < subkeys; i++) + { + BOOL ret; + + ret = remove_device(); + ok(ret, "Expected a device to be removed\n"); + } + } + else + { + /* Wine doesn't delete the bogus key itself currently */ + trace("We are most likely on Wine\n"); + RegDeleteKeyW(HKEY_LOCAL_MACHINE, bogus); + } } } -- 2.11.4.GIT