faultrep/tests: Fix a test failure when the user has limited access rights.
This commit is contained in:
parent
b9b6b0585f
commit
c1f9129d7b
|
@ -53,14 +53,13 @@ static const WCHAR SZ_EXCLUSIONLIST_KEY[] = {
|
|||
* Wine doesn't use this data but stores it in the registry (in the same place
|
||||
* as Windows would) in case it will be useful in a future version
|
||||
*
|
||||
* According to MSDN this function should succeed even if the user has no write
|
||||
* access to HKLM. This probably means that there is no error checking.
|
||||
*/
|
||||
BOOL WINAPI AddERExcludedApplicationW(LPCWSTR lpAppFileName)
|
||||
{
|
||||
WCHAR *bslash;
|
||||
DWORD value = 1;
|
||||
HKEY hkey;
|
||||
LONG res;
|
||||
|
||||
TRACE("(%s)\n", wine_dbgstr_w(lpAppFileName));
|
||||
bslash = strrchrW(lpAppFileName, '\\');
|
||||
|
@ -72,13 +71,14 @@ BOOL WINAPI AddERExcludedApplicationW(LPCWSTR lpAppFileName)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!RegCreateKeyW(HKEY_LOCAL_MACHINE, SZ_EXCLUSIONLIST_KEY, &hkey))
|
||||
res = RegCreateKeyW(HKEY_LOCAL_MACHINE, SZ_EXCLUSIONLIST_KEY, &hkey);
|
||||
if (!res)
|
||||
{
|
||||
RegSetValueExW(hkey, lpAppFileName, 0, REG_DWORD, (LPBYTE)&value, sizeof(value));
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return !res;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
|
|
@ -43,7 +43,12 @@ static void test_AddERExcludedApplicationA(void)
|
|||
HKEY hexclude = 0;
|
||||
|
||||
/* clean state */
|
||||
lres = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regpath_root, 0, KEY_WRITE, &hroot);
|
||||
lres = RegCreateKeyA(HKEY_LOCAL_MACHINE, regpath_root, &hroot);
|
||||
if (lres == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
skip("Not enough access rights\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!lres)
|
||||
lres = RegOpenKeyA(hroot, regpath_exclude, &hexclude);
|
||||
|
@ -61,8 +66,7 @@ static void test_AddERExcludedApplicationA(void)
|
|||
ok(!res, "got %d and 0x%x (expected FALSE)\n", res, GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
/* access rights to HKLM or existence of the path doesn't matter
|
||||
this function succeeded */
|
||||
/* existence of the path doesn't matter this function succeeded */
|
||||
res = AddERExcludedApplicationA("winetest_faultrep.exe");
|
||||
ok(res, "got %d and 0x%x (expected TRUE)\n", res, GetLastError());
|
||||
|
||||
|
|
Loading…
Reference in New Issue