Module: wine Branch: master Commit: 8253824669c98162ae7894f9fda1da4ead80a738 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8253824669c98162ae7894f9fd...
Author: Paul Vriens paul.vriens.wine@gmail.com Date: Mon May 26 20:03:00 2008 +0200
setupapi/tests: Cleanup after testCreateDeviceInterface.
---
dlls/setupapi/tests/devinst.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 07497d4..6bf82f7 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -572,6 +572,17 @@ static void testCreateDeviceInterface(void) { BOOL ret; HDEVINFO set; + HKEY key; + static const WCHAR bogus[] = {'S','y','s','t','e','m','\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\', + 'E','n','u','m','\','R','o','o','t','\', + 'L','E','G','A','C','Y','_','B','O','G','U','S',0}; + static const WCHAR devclass[] = {'S','y','s','t','e','m','\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\', + 'C','o','n','t','r','o','l','\','D','e','v','i','c','e','C','l','a','s','s','e','s','\', + '{','6','a','5','5','b','5','a','4','-','3','f','6','5','-', + '1','1','d','b','-','b','7','0','4','-', + '0','0','1','1','9','5','5','c','2','b','d','b','}',0};
if (!pSetupDiCreateDeviceInfoList || !pSetupDiDestroyDeviceInfoList || !pSetupDiCreateDeviceInfoA || !pSetupDiCreateDeviceInterfaceA || @@ -636,6 +647,24 @@ static void testCreateDeviceInterface(void) ok(GetLastError() == ERROR_NO_MORE_ITEMS, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); pSetupDiDestroyDeviceInfoList(set); + + /* 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. + */ + if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key)) + { + /* Wine doesn't delete the information currently */ + trace("We are most likely on Wine\n"); + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); + devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, devclass); + } + else + { + ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, devclass), + "Couldn't delete deviceclass key\n"); + } } }