Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 110 ++++++++++++++++++---------------- dlls/setupapi/tests/devinst.c | 25 +++++++- 2 files changed, 82 insertions(+), 53 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 55746562c8..c3ba9010f8 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -492,30 +492,68 @@ static HKEY SETUPDI_CreateDevKey(struct device *device) return key; }
-static HKEY SETUPDI_CreateDrvKey(struct device *device) +static HKEY open_driver_key(struct device *device, REGSAM access) { - static const WCHAR slash[] = { '\',0 }; - WCHAR classKeyPath[MAX_PATH]; - HKEY classKey, key = INVALID_HANDLE_VALUE; + HKEY class_key, key; + WCHAR path[50]; + DWORD size = sizeof(path); LONG l;
- lstrcpyW(classKeyPath, ControlClass); - lstrcatW(classKeyPath, slash); - SETUPDI_GuidToString(&device->set->ClassGuid, - classKeyPath + lstrlenW(classKeyPath)); - l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, classKeyPath, 0, NULL, 0, - KEY_ALL_ACCESS, NULL, &classKey, NULL); - if (!l) + if ((l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, ControlClass, 0, NULL, 0, + KEY_CREATE_SUB_KEY, NULL, &class_key, NULL))) { - static const WCHAR fmt[] = { '%','0','4','u',0 }; - WCHAR devId[10]; - - sprintfW(devId, fmt, device->devnode); - RegCreateKeyExW(classKey, devId, 0, NULL, 0, KEY_READ | KEY_WRITE, - NULL, &key, NULL); - RegCloseKey(classKey); + ERR("Failed to open driver class root key, error %u.\n", l); + SetLastError(l); + return INVALID_HANDLE_VALUE; } - return key; + + if (!(l = RegGetValueW(device->key, NULL, Driver, RRF_RT_REG_SZ, NULL, path, &size))) + { + if (!(l = RegOpenKeyExW(class_key, path, 0, access, &key))) + { + RegCloseKey(class_key); + return key; + } + ERR("Failed to open driver key, error %u.\n", l); + } + + RegCloseKey(class_key); + SetLastError(ERROR_KEY_DOES_NOT_EXIST); + return INVALID_HANDLE_VALUE; +} + +static HKEY create_driver_key(struct device *device) +{ + static const WCHAR formatW[] = {'%','0','4','u',0}; + static const WCHAR slash[] = { '\',0 }; + HKEY class_key, key; + WCHAR path[50]; + LONG l; + + if ((key = open_driver_key(device, KEY_READ | KEY_WRITE)) != INVALID_HANDLE_VALUE) + return key; + + if ((l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, ControlClass, 0, NULL, 0, + KEY_CREATE_SUB_KEY, NULL, &class_key, NULL))) + { + ERR("Failed to open driver class root key, error %u.\n", l); + SetLastError(l); + return INVALID_HANDLE_VALUE; + } + + SETUPDI_GuidToString(&device->class, path); + strcatW(path, slash); + sprintfW(path + strlenW(path), formatW, device->devnode); + if (!(l = RegCreateKeyExW(class_key, path, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &key, NULL))) + { + RegSetValueExW(device->key, Driver, 0, REG_SZ, (BYTE *)path, strlenW(path) * sizeof(WCHAR)); + RegCloseKey(class_key); + return key; + } + ERR("Failed to create driver key, error %u.\n", l); + RegCloseKey(class_key); + SetLastError(l); + return INVALID_HANDLE_VALUE; }
struct PropertyMapEntry @@ -1367,7 +1405,7 @@ HKEY WINAPI SetupDiCreateDevRegKeyW(HDEVINFO devinfo, SP_DEVINFO_DATA *device_da key = SETUPDI_CreateDevKey(device); break; case DIREG_DRV: - key = SETUPDI_CreateDrvKey(device); + key = create_driver_key(device); break; default: WARN("unknown KeyType %d\n", KeyType); @@ -3358,36 +3396,6 @@ static HKEY SETUPDI_OpenDevKey(struct device *device, REGSAM samDesired) return key; }
-static HKEY SETUPDI_OpenDrvKey(struct device *device, REGSAM samDesired) -{ - static const WCHAR slash[] = { '\',0 }; - WCHAR classKeyPath[MAX_PATH]; - HKEY classKey, key = INVALID_HANDLE_VALUE; - LONG l; - - lstrcpyW(classKeyPath, ControlClass); - lstrcatW(classKeyPath, slash); - SETUPDI_GuidToString(&device->set->ClassGuid, - classKeyPath + lstrlenW(classKeyPath)); - l = RegCreateKeyExW(HKEY_LOCAL_MACHINE, classKeyPath, 0, NULL, 0, - KEY_ALL_ACCESS, NULL, &classKey, NULL); - if (!l) - { - static const WCHAR fmt[] = { '%','0','4','u',0 }; - WCHAR devId[10]; - - sprintfW(devId, fmt, device->devnode); - l = RegOpenKeyExW(classKey, devId, 0, samDesired, &key); - RegCloseKey(classKey); - if (l) - { - SetLastError(ERROR_KEY_DOES_NOT_EXIST); - return INVALID_HANDLE_VALUE; - } - } - return key; -} - /*********************************************************************** * SetupDiOpenDevRegKey (SETUPAPI.@) */ @@ -3427,7 +3435,7 @@ HKEY WINAPI SetupDiOpenDevRegKey(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data, key = SETUPDI_OpenDevKey(device, samDesired); break; case DIREG_DRV: - key = SETUPDI_OpenDrvKey(device, samDesired); + key = open_driver_key(device, samDesired); break; default: WARN("unknown KeyType %d\n", KeyType); diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 4abc188ea4..6aa5a1e277 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -776,9 +776,11 @@ static void test_device_key(void) 'E','n','u','m','\','R','o','o','t','\', 'L','E','G','A','C','Y','_','B','O','G','U','S',0}; SP_DEVINFO_DATA device = {sizeof(device)}; + char driver_path[50], data[4]; + HKEY class_key, key; + DWORD size; BOOL ret; HDEVINFO set; - HKEY key = NULL; LONG res;
SetLastError(0xdeadbeef); @@ -836,9 +838,13 @@ static void test_device_key(void) ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n"); ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
+ ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER, NULL, + (BYTE *)driver_path, sizeof(driver_path), NULL); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError()); + SetLastError(0xdeadbeef); res = RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key); -todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n"); RegCloseKey(key);
@@ -852,6 +858,17 @@ todo_wine ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, classKey, &key), "Key should exist.\n"); RegCloseKey(key);
+ ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER, NULL, + (BYTE *)driver_path, sizeof(driver_path), NULL); + ok(ret, "Failed to get driver property, error %#x.\n", GetLastError()); + res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Control\Class", &class_key); + ok(!res, "Failed to open class key, error %u.\n", res); + res = RegOpenKeyA(class_key, driver_path, &key); + ok(!res, "Failed to open driver key, error %u.\n", res); + RegSetValueExA(key, "foo", 0, REG_SZ, (BYTE *)"bar", sizeof("bar")); + RegCloseKey(key); + RegCloseKey(class_key); + SetLastError(0xdeadbeef); key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0); todo_wine { @@ -862,6 +879,10 @@ todo_wine {
key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ); ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#x.\n", GetLastError()); + size = sizeof(data); + res = RegQueryValueExA(key, "foo", NULL, NULL, (BYTE *)data, &size); + ok(!res, "Failed to get value, error %u.\n", res); + ok(!strcmp(data, "bar"), "Got wrong data %s.\n", data); RegCloseKey(key); }
The devnode is a local handle, but driver keys should be unique to the device. (Note that MSDN, confusingly, refers to this number as a "device instance ID".)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index c3ba9010f8..a16c461a47 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -527,7 +527,9 @@ static HKEY create_driver_key(struct device *device) static const WCHAR formatW[] = {'%','0','4','u',0}; static const WCHAR slash[] = { '\',0 }; HKEY class_key, key; + unsigned int i = 0; WCHAR path[50]; + DWORD dispos; LONG l;
if ((key = open_driver_key(device, KEY_READ | KEY_WRITE)) != INVALID_HANDLE_VALUE) @@ -543,12 +545,20 @@ static HKEY create_driver_key(struct device *device)
SETUPDI_GuidToString(&device->class, path); strcatW(path, slash); - sprintfW(path + strlenW(path), formatW, device->devnode); - if (!(l = RegCreateKeyExW(class_key, path, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &key, NULL))) + /* Allocate a new driver key, by finding the first integer value that's not + * already taken. */ + for (;;) { - RegSetValueExW(device->key, Driver, 0, REG_SZ, (BYTE *)path, strlenW(path) * sizeof(WCHAR)); - RegCloseKey(class_key); - return key; + sprintfW(path + 39, formatW, i++); + if ((l = RegCreateKeyExW(class_key, path, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &key, &dispos))) + break; + else if (dispos == REG_CREATED_NEW_KEY) + { + RegSetValueExW(device->key, Driver, 0, REG_SZ, (BYTE *)path, strlenW(path) * sizeof(WCHAR)); + RegCloseKey(class_key); + return key; + } + RegCloseKey(key); } ERR("Failed to create driver key, error %u.\n", l); RegCloseKey(class_key);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 9 ++++- dlls/setupapi/tests/devinst.c | 70 +---------------------------------- 2 files changed, 10 insertions(+), 69 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index a16c461a47..b16d2d7bfe 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -637,7 +637,14 @@ static void remove_device(struct device *device) { WCHAR id[MAX_DEVICE_ID_LEN], *p; struct device_iface *iface; - HKEY enum_key; + HKEY enum_key, driver_key; + + if ((driver_key = open_driver_key(device, KEY_ALL_ACCESS)) != INVALID_HANDLE_VALUE) + { + RegDeleteTreeW(driver_key, NULL); + RegDeleteKeyW(driver_key, emptyW); + RegCloseKey(driver_key); + }
LIST_FOR_EACH_ENTRY(iface, &device->interfaces, struct device_iface, entry) { diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 6aa5a1e277..c08af1659c 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -37,72 +37,6 @@ static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}}; static GUID guid2 = {0x6a55b5a5, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}};
-static LSTATUS devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) -{ - LONG ret; - DWORD dwMaxSubkeyLen, dwMaxValueLen; - DWORD dwMaxLen, dwSize; - WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf; - HKEY hSubKey = hKey; - - if(lpszSubKey) - { - ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey); - if (ret) return ret; - } - - /* Get highest length for keys, values */ - ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, - &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL); - if (ret) goto cleanup; - - dwMaxSubkeyLen++; - dwMaxValueLen++; - dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen); - if (dwMaxLen > ARRAY_SIZE(szNameBuf)) - { - /* Name too big: alloc a buffer for it */ - if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR)))) - { - ret = ERROR_NOT_ENOUGH_MEMORY; - goto cleanup; - } - } - - - /* Recursively delete all the subkeys */ - while (TRUE) - { - dwSize = dwMaxLen; - if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL, - NULL, NULL, NULL)) break; - - ret = devinst_RegDeleteTreeW(hSubKey, lpszName); - if (ret) goto cleanup; - } - - if (lpszSubKey) - ret = RegDeleteKeyW(hKey, lpszSubKey); - else - while (TRUE) - { - dwSize = dwMaxLen; - if (RegEnumValueW(hKey, 0, lpszName, &dwSize, - NULL, NULL, NULL, NULL)) break; - - ret = RegDeleteValueW(hKey, lpszName); - if (ret) goto cleanup; - } - -cleanup: - /* Free buffer if allocated */ - if (lpszName != szNameBuf) - HeapFree( GetProcessHeap(), 0, lpszName); - if(lpszSubKey) - RegCloseKey(hSubKey); - return ret; -} - static void test_create_device_list_ex(void) { static const WCHAR machine[] = { 'd','u','m','m','y',0 }; @@ -890,8 +824,8 @@ todo_wine { ok(ret, "Failed to remove device, error %#x.\n", GetLastError()); SetupDiDestroyDeviceInfoList(set);
- /* remove once Wine is fixed */ - devinst_RegDeleteTreeW(HKEY_LOCAL_MACHINE, classKey); + res = RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey); + ok(!res, "Failed to delete key, error %u.\n", res); }
static void test_register_device_iface(void)
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=46456
Your paranoid android.
=== wvistau64 (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== wvistau64_zh_CN (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== wvistau64_fr (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== wvistau64_he (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w2008s64 (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w7u (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w7pro64 (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w8 (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w864 (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w1064 (32 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== wvistau64 (64 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w2008s64 (64 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w7pro64 (64 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w864 (64 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
=== w1064 (64 bit report) ===
setupapi: devinst.c:828: Test failed: Failed to delete key, error 2.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/tests/devinst.c | 73 ++++++++++++++++------------------- 1 file changed, 34 insertions(+), 39 deletions(-)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index c08af1659c..f824f39cd4 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -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,53 +774,52 @@ 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) - { - RegCloseKey(key); + 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"); - RegCloseKey(key); + ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER, NULL, + (BYTE *)driver_path, sizeof(driver_path), NULL); + ok(ret, "Failed to get driver property, error %#x.\n", GetLastError()); + res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Control\Class", &class_key); + ok(!res, "Failed to open class key, error %u.\n", res); + res = RegOpenKeyA(class_key, driver_path, &key); + ok(!res, "Failed to open driver key, error %u.\n", res); + RegSetValueExA(key, "foo", 0, REG_SZ, (BYTE *)"bar", sizeof("bar")); + RegCloseKey(key); + RegCloseKey(class_key);
- ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER, NULL, - (BYTE *)driver_path, sizeof(driver_path), NULL); - ok(ret, "Failed to get driver property, error %#x.\n", GetLastError()); - res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Control\Class", &class_key); - ok(!res, "Failed to open class key, error %u.\n", res); - res = RegOpenKeyA(class_key, driver_path, &key); - ok(!res, "Failed to open driver key, error %u.\n", res); - RegSetValueExA(key, "foo", 0, REG_SZ, (BYTE *)"bar", sizeof("bar")); - RegCloseKey(key); - RegCloseKey(class_key); - - SetLastError(0xdeadbeef); - key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0); + SetLastError(0xdeadbeef); + key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0); todo_wine { - ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n"); - ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_ACCESS_DENIED, /* win2k3 */ - "Got unexpected error %#x.\n", GetLastError()); + ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n"); + ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_ACCESS_DENIED, /* win2k3 */ + "Got unexpected error %#x.\n", GetLastError()); }
- key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ); - ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#x.\n", GetLastError()); - size = sizeof(data); - res = RegQueryValueExA(key, "foo", NULL, NULL, (BYTE *)data, &size); - ok(!res, "Failed to get value, error %u.\n", res); - ok(!strcmp(data, "bar"), "Got wrong data %s.\n", data); - RegCloseKey(key); - } + key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ); + ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#x.\n", GetLastError()); + size = sizeof(data); + res = RegQueryValueExA(key, "foo", NULL, NULL, (BYTE *)data, &size); + ok(!res, "Failed to get value, error %u.\n", res); + ok(!strcmp(data, "bar"), "Got wrong data %s.\n", data); + RegCloseKey(key);
ret = SetupDiRemoveDevice(set, &device); ok(ret, "Failed to remove device, error %#x.\n", GetLastError()); SetupDiDestroyDeviceInfoList(set);
- res = RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey); + res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, class_key_path); ok(!res, "Failed to delete key, error %u.\n", res); }