Module: wine Branch: master Commit: 02b05393c8717478d585922f13f3b4c9e04f191a URL: http://source.winehq.org/git/wine.git/?a=commit;h=02b05393c8717478d585922f13...
Author: Paul Vriens paul.vriens.wine@gmail.com Date: Mon Jun 9 13:04:58 2008 +0200
setupapi/tests: Fix a test on Windows 2000.
---
dlls/setupapi/tests/devinst.c | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index cd72db4..a47460c 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -698,12 +698,14 @@ static void testCreateDeviceInterface(void) ok(i == 2, "expected 2 interfaces, got %d\n", i); ok(GetLastError() == ERROR_NO_MORE_ITEMS, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); - pSetupDiDestroyDeviceInfoList(set); + ret = pSetupDiDestroyDeviceInfoList(set); + ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError());
/* Cleanup */ /* FIXME: On Wine we still have the bogus entry in Enum\Root and * subkeys, as well as the deviceclass key with subkeys. - * Only do the RegDeleteKey, once Wine is fixed. + * Only do the RegDeleteKey (and RegDeleteTree on Windows 2000), + * once Wine is fixed. */ if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key)) { @@ -714,8 +716,23 @@ static void testCreateDeviceInterface(void) } else { - ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, devclass), - "Couldn't delete deviceclass key\n"); + DWORD subkeys; + + /* Check if we have subkeys as Windows 2000 doesn't delete + * the keys under the DeviceClasses key + */ + RegOpenKeyW(HKEY_LOCAL_MACHINE, devclass, &key); + RegQueryInfoKey(key, NULL, NULL, NULL, &subkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + if (subkeys > 0) + { + trace("We are most likely on Windows 2000\n"); + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); + } + else + { + ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, devclass), + "Couldn't delete deviceclass key\n"); + } } } }