setupapi/tests: Make tests pass on Vista and W2K8.

This commit is contained in:
Ge van Geldorp 2009-01-26 01:26:52 +01:00 committed by Alexandre Julliard
parent b7ac6cb01d
commit 115805f12e
1 changed files with 30 additions and 22 deletions

View File

@ -271,7 +271,7 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
error = GetLastError(); error = GetLastError();
ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE); ok(devlist == INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected %p)\n", devlist, error, INVALID_HANDLE_VALUE);
ok(error == ERROR_INVALID_MACHINENAME, "GetLastError returned wrong value : %d, (expected %d)\n", error, ERROR_INVALID_MACHINENAME); ok(error == ERROR_INVALID_MACHINENAME || error == ERROR_MACHINE_UNAVAILABLE, "GetLastError returned wrong value : %d, (expected %d or %d)\n", error, ERROR_INVALID_MACHINENAME, ERROR_MACHINE_UNAVAILABLE);
/* create empty DeviceInfoList */ /* create empty DeviceInfoList */
devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL); devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL);
@ -887,6 +887,7 @@ static void testDevRegKey(void)
BOOL ret; BOOL ret;
HDEVINFO set; HDEVINFO set;
HKEY key = NULL; HKEY key = NULL;
BOOL classKeyCreated;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
key = pSetupDiCreateDevRegKeyW(NULL, NULL, 0, 0, 0, NULL, NULL); key = pSetupDiCreateDevRegKeyW(NULL, NULL, 0, 0, 0, NULL, NULL);
@ -974,8 +975,12 @@ static void testDevRegKey(void)
/* Create the device reg key */ /* Create the device reg key */
key = pSetupDiCreateDevRegKeyW(set, &devInfo, DICS_FLAG_GLOBAL, 0, key = pSetupDiCreateDevRegKeyW(set, &devInfo, DICS_FLAG_GLOBAL, 0,
DIREG_DRV, NULL, NULL); DIREG_DRV, NULL, NULL);
ok(key != INVALID_HANDLE_VALUE, "SetupDiCreateDevRegKey failed: %08x\n", /* Vista and higher don't actually create the key */
GetLastError()); ok(key != INVALID_HANDLE_VALUE || GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
"SetupDiCreateDevRegKey failed: %08x\n", GetLastError());
if (key != INVALID_HANDLE_VALUE)
{
classKeyCreated = TRUE;
RegCloseKey(key); RegCloseKey(key);
/* The class key should have been created */ /* The class key should have been created */
ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key), ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key),
@ -994,6 +999,9 @@ static void testDevRegKey(void)
ok(key != INVALID_HANDLE_VALUE, "SetupDiOpenDevRegKey failed: %08x\n", ok(key != INVALID_HANDLE_VALUE, "SetupDiOpenDevRegKey failed: %08x\n",
GetLastError()); GetLastError());
pSetupDiDestroyDeviceInfoList(set); pSetupDiDestroyDeviceInfoList(set);
}
else
classKeyCreated = FALSE;
/* Cleanup */ /* Cleanup */
ret = remove_device(); ret = remove_device();
@ -1008,7 +1016,7 @@ static void testDevRegKey(void)
devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus); devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, bogus);
devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey); devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey);
} }
else else if (classKeyCreated)
{ {
/* There should only be a class key entry, so a simple /* There should only be a class key entry, so a simple
* RegDeleteKey should work * RegDeleteKey should work