Zebediah Figura : kernel32/tests: Fix permission check.

Alexandre Julliard julliard at winehq.org
Mon Mar 12 17:40:25 CDT 2018


Module: wine
Branch: master
Commit: 43c5fe11cbfe8fb16f542ee17ec82e1b6ec0ccd0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=43c5fe11cbfe8fb16f542ee17ec82e1b6ec0ccd0

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Mar 11 20:03:30 2018 -0500

kernel32/tests: Fix permission check.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/profile.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index 64ffc17..c5c7702 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -956,6 +956,7 @@ static void test_WritePrivateProfileString(void)
     LPCSTR data;
     CHAR path[MAX_PATH];
     CHAR temp[MAX_PATH];
+    HANDLE file;
 
     SetLastError(0xdeadbeef);
     ret = WritePrivateProfileStringW(NULL, NULL, NULL, NULL);
@@ -1069,12 +1070,14 @@ static void test_WritePrivateProfileString(void)
        "Expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
 
     /* Relative paths are relative to X:\\%WINDIR% */
-    GetWindowsDirectoryA(temp, MAX_PATH);
-    GetTempFileNameA(temp, "win", 1, path);
-    if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)
+    GetWindowsDirectoryA(path, MAX_PATH);
+    strcat(path, "\\win1.tmp");
+    file = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
         skip("Not allowed to create a file in the Windows directory\n");
     else
     {
+        CloseHandle(file);
         DeleteFileA(path);
 
         data = "[App]\r\n"




More information about the wine-cvs mailing list