[PATCH] faultep/tests: Fix a test failure, when the user has limited access rights
Detlef Riekenberg
wine.dev at web.de
Sun Jul 21 16:39:02 CDT 2013
AddERExcludedApplication can fail, when the user status is not elevated.
Examples:
http://test.winehq.org/data/fa12cffa9d6c17c63caa6fb307c7bda1e4eb344f/win7_fg-win7u64-1spie9adm/faultrep:faultrep.html
http://test.winehq.org/data/fa12cffa9d6c17c63caa6fb307c7bda1e4eb344f/win7_fg-win7u64-1spie9adm/faultrep:faultrep.html
--
By by ... Detlef
---
dlls/faultrep/faultrep.c | 6 ++++--
dlls/faultrep/tests/faultrep.c | 10 +++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/faultrep/faultrep.c b/dlls/faultrep/faultrep.c
index a05dabb..2d0d0f3 100644
--- a/dlls/faultrep/faultrep.c
+++ b/dlls/faultrep/faultrep.c
@@ -61,6 +61,7 @@ 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 +73,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;
}
/*************************************************************************
diff --git a/dlls/faultrep/tests/faultrep.c b/dlls/faultrep/tests/faultrep.c
index dd52928..948310d 100644
--- a/dlls/faultrep/tests/faultrep.c
+++ b/dlls/faultrep/tests/faultrep.c
@@ -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());
--
1.7.5.4
More information about the wine-patches
mailing list