From cca75cc147cbca74003ab78dde41441c070417e9 Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Wed, 28 Jan 2009 11:43:30 +0100 Subject: [PATCH] kernel32/tests: Don't crash when run as a normal user. --- dlls/kernel32/tests/profile.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c index e07ece3309a..59f9c2bc73e 100644 --- a/dlls/kernel32/tests/profile.c +++ b/dlls/kernel32/tests/profile.c @@ -681,7 +681,14 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ok(!lstrcmpA(buf, "default"), "Expected \"default\", got \"%s\"\n", buf); GetWindowsDirectoryA(windir, MAX_PATH); - GetTempFileNameA(windir, "pre", 0, path); + SetLastError(0xdeadbeef); + ret = GetTempFileNameA(windir, "pre", 0, path); + if (!ret && GetLastError() == ERROR_ACCESS_DENIED) + { + skip("Not allowed to create a file in the Windows directory\n"); + DeleteFileA(filename); + return; + } tempfile = strrchr(path, '\\') + 1; create_test_file(path, content, lstrlenA(content));