2009/1/26 Alexandre Julliard <julliard(a)winehq.org>:
hr = StringFromCLSID(&CLSID_WineTest, &pszClsid); ok_ole_success(hr, "StringFromCLSID"); - strcpy(buffer, "CLSID\\"); + strcpy(buffer, "Software\\Classes\\CLSID\\"); WideCharToMultiByte(CP_ACP, 0, pszClsid, -1, buffer + strlen(buffer), sizeof(buffer) - strlen(buffer), NULL, NULL); CoTaskMemFree(pszClsid); strcat(buffer, "\\InprocHandler32"); - error = RegCreateKeyEx(HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &dwDisposition); - ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error); - error = RegSetValueEx(hkey, NULL, 0, REG_SZ, (const unsigned char *)"ole32.dll", strlen("ole32.dll") + 1); - ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error); - RegCloseKey(hkey); + if (Register) + { + error = RegCreateKeyEx(HKEY_CURRENT_USER, buffer, 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &dwDisposition); + ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error); + error = RegSetValueEx(hkey, NULL, 0, REG_SZ, (const unsigned char *)"ole32.dll", strlen("ole32.dll") + 1); + ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error); + RegCloseKey(hkey); + } + else + { + RegDeleteKey(HKEY_CURRENT_USER, buffer); + *strrchr(buffer, '\\') = '\0'; + RegDeleteKey(HKEY_CURRENT_USER, buffer); + } +}
Ge, This appears to have caused some regressions in running the tests on older versions of Windows: http://test.winehq.org/data/d0e77f8a47016c6f69e3a6b5a8bed8f620f1a8f1/nt4_cw-... versus before: http://test.winehq.org/data/f63d950df75bdebbad3278790c6c9d11bfe1b226/nt4_cw-... While I can see how using HKEY_CURRENT_USER instead of HKEY_CLASSES_ROOT can help developers using a standard user rather than Admin on Windows, I don't see it as useful in general as a lot of the tests emulate what installers do and hence depend on having full access to the system. -- Rob Shearman