Francois Gouget : kernel32/tests: Skip some profile tests if not allowed to create files in the Windows directory.

Alexandre Julliard julliard at winehq.org
Tue Mar 4 14:08:51 CST 2014


Module: wine
Branch: master
Commit: f1087d865b8aa0c4dde43060def21d2d09dc1f92
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f1087d865b8aa0c4dde43060def21d2d09dc1f92

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Mar  4 15:21:56 2014 +0100

kernel32/tests: Skip some profile tests if not allowed to create files in the Windows directory.

---

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

diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index ca3a07e..2eb90a8 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -1019,18 +1019,22 @@ static void test_WritePrivateProfileString(void)
        broken(GetLastError() == ERROR_PATH_NOT_FOUND), /* Win9x and WinME */
        "Expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
 
-    /* The resulting file will be  X:\\%WINDIR%\\win1.tmp */
+    /* Relative paths are relative to X:\\%WINDIR% */
     GetWindowsDirectoryA(temp, MAX_PATH);
     GetTempFileNameA(temp, "win", 1, path);
-    DeleteFileA(path);
+    if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES)
+        skip("Not allowed to create a file in the Windows directory\n");
+    else
+    {
+        DeleteFileA(path);
 
-    /* relative path in lpFileName */
-    data = "[App]\r\n"
-           "key=string\r\n";
-    ret = WritePrivateProfileStringA("App", "key", "string", "win1.tmp");
-    ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(check_file_data(path, data), "File doesn't match\n");
-    DeleteFileA(path);
+        data = "[App]\r\n"
+               "key=string\r\n";
+        ret = WritePrivateProfileStringA("App", "key", "string", "win1.tmp");
+        ok(ret == TRUE, "Expected TRUE, got %d, le=%u\n", ret, GetLastError());
+        ok(check_file_data(path, data), "File doesn't match\n");
+        DeleteFileA(path);
+    }
 
     GetTempPathA(MAX_PATH, temp);
     GetTempFileNameA(temp, "wine", 0, path);




More information about the wine-cvs mailing list