Commit 00c8c270 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

setupapi/tests: Create the setup class key before trying to create the driver key.

parent dca175b2
......@@ -699,12 +699,8 @@ static void test_device_iface_detail(void)
static void test_device_key(void)
{
static const WCHAR classKey[] = {'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','\\','C','l','a','s','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};
static const char class_key_path[] = "System\\CurrentControlSet\\Control\\Class"
"\\{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
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','\\',
......@@ -778,18 +774,21 @@ static void test_device_key(void)
ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
SetLastError(0xdeadbeef);
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key);
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, class_key_path, &key);
ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
RegCloseKey(key);
/* Vista+ will fail the following call to SetupDiCreateDevKeyW() if the
* class key doesn't exist. */
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, class_key_path, &key);
ok(!res, "Failed to create class key, error %u.\n", res);
RegCloseKey(key);
key = SetupDiCreateDevRegKeyW(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
ok(key != INVALID_HANDLE_VALUE || GetLastError() == ERROR_KEY_DOES_NOT_EXIST, /* Vista+ */
"Failed to create device key, error %#x.\n", GetLastError());
if (key != INVALID_HANDLE_VALUE)
{
ok(key != INVALID_HANDLE_VALUE, "Failed to create device key, error %#x.\n", GetLastError());
RegCloseKey(key);
ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key), "Key should exist.\n");
ok(!RegOpenKeyA(HKEY_LOCAL_MACHINE, class_key_path, &key), "Key should exist.\n");
RegCloseKey(key);
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Class", &class_key);
......@@ -830,14 +829,13 @@ todo_wine {
ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
RegCloseKey(class_key);
}
ret = SetupDiRemoveDevice(set, &device);
ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
SetupDiDestroyDeviceInfoList(set);
/* Vista+ deletes the key automatically. */
res = RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey);
res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, class_key_path);
ok(!res || res == ERROR_FILE_NOT_FOUND, "Failed to delete class key, error %u.\n", res);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment