setupapi/tests: Fix two more tests on Windows 2000.

This commit is contained in:
Paul Vriens 2008-06-09 14:14:25 +02:00 committed by Alexandre Julliard
parent 02b05393c8
commit e63f4fcfbc
1 changed files with 31 additions and 26 deletions

View File

@ -183,6 +183,33 @@ cleanup:
return ret; return ret;
} }
static void clean_devclass_key(void)
{
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};
HKEY key;
DWORD subkeys;
/* Check if we have subkeys as Windows 2000 doesn't delete
* the keys under the DeviceClasses key after a SetupDiDestroyDeviceInfoList.
*/
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");
}
}
static void test_SetupDiCreateDeviceInfoListEx(void) static void test_SetupDiCreateDeviceInfoListEx(void)
{ {
@ -704,8 +731,7 @@ static void testCreateDeviceInterface(void)
/* Cleanup */ /* Cleanup */
/* FIXME: On Wine we still have the bogus entry in Enum\Root and /* FIXME: On Wine we still have the bogus entry in Enum\Root and
* subkeys, as well as the deviceclass key with subkeys. * subkeys, as well as the deviceclass key with subkeys.
* Only do the RegDeleteKey (and RegDeleteTree on Windows 2000), * Only clean the deviceclass key once Wine if fixed.
* once Wine is fixed.
*/ */
if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key)) if (!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key))
{ {
@ -716,23 +742,7 @@ static void testCreateDeviceInterface(void)
} }
else else
{ {
DWORD subkeys; clean_devclass_key();
/* 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");
}
} }
} }
} }
@ -865,8 +875,7 @@ static void testGetDeviceInterfaceDetail(void)
} }
else else
{ {
ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, devclass), clean_devclass_key();
"Couldn't delete deviceclass key\n");
} }
} }
} }
@ -1125,11 +1134,7 @@ static void testRegisterAndGetDetail(void)
} }
else else
{ {
/* There should only be a class key entry, so a simple clean_devclass_key();
* RegDeleteKey should work
*/
ok(!RegDeleteKeyW(HKEY_LOCAL_MACHINE, devclass),
"Couldn't delete classkey\n");
} }
} }