Sven Baars : msvcp140/tests: Test _Stat() against the actual permissions of the system directory.

Alexandre Julliard julliard at winehq.org
Mon Nov 18 16:19:18 CST 2019


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

Author: Sven Baars <sven.wine at gmail.com>
Date:   Fri Nov 15 20:30:46 2019 +0100

msvcp140/tests: Test _Stat() against the actual permissions of the system directory.

Signed-off-by: Sven Baars <sven.wine at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcp140/tests/msvcp140.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c
index 8ad172495d..751b1beed8 100644
--- a/dlls/msvcp140/tests/msvcp140.c
+++ b/dlls/msvcp140/tests/msvcp140.c
@@ -786,8 +786,9 @@ static void test_Current_set(void)
 
 static void test_Stat(void)
 {
-    int i, perms, ret;
+    int i, perms, expected_perms, ret;
     HANDLE file;
+    DWORD attr;
     enum file_type val;
     WCHAR test_dirW[] = {'w','i','n','e','_','t','e','s','t','_','d','i','r',0};
     WCHAR test_f1W[] = {'w','i','n','e','_','t','e','s','t','_','d','i','r','/','f','1',0};
@@ -889,10 +890,12 @@ static void test_Stat(void)
     }
 
     GetSystemDirectoryW(sys_path, MAX_PATH);
+    attr = GetFileAttributesW(sys_path);
+    expected_perms = (attr & FILE_ATTRIBUTE_READONLY) ? 0555 : 0777;
     perms = 0xdeadbeef;
     val = p_Stat(sys_path, &perms);
     ok(directory_file == val, "_Stat(): expect: regular, got %d\n", val);
-    ok(0777 == perms, "_Stat(): perms expect: 0777, got 0%o\n", perms);
+    ok(perms == expected_perms, "_Stat(): perms expect: 0%o, got 0%o\n", expected_perms, perms);
 
     if(ret) {
         todo_wine ok(DeleteFileW(test_f1_linkW), "expect wine_test_dir/f1_link to exist\n");




More information about the wine-cvs mailing list