NtQueryFullAttributesFile: FILE_ATTRIBUTE_READONLY

Ulrich Czekalla ulrich.czekalla at utoronto.ca
Mon Mar 14 16:44:07 CST 2005


The FILE_ATTRIBUTE_READONLY flag isn't being set correctly. It should depend
on the files permission bits as well as the process uid and gid.

ChangeLog:
    Ulrich Czekalla <ulrich at codeweavers.com>
    Fix check for FILE_ATTRIBUTE_READONLY
-------------- next part --------------
Index: dlls/ntdll/file.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/file.c,v
retrieving revision 1.76
diff -u -p -r1.76 file.c
--- dlls/ntdll/file.c	2 Mar 2005 12:23:22 -0000	1.76
+++ dlls/ntdll/file.c	14 Mar 2005 22:44:00 -0000
@@ -1249,7 +1249,20 @@ NTSTATUS WINAPI NtQueryFullAttributesFil
                 info->AllocationSize.QuadPart = (ULONGLONG)st.st_blocks * 512;
                 info->EndOfFile.QuadPart      = st.st_size;
             }
-            if (!(st.st_mode & S_IWUSR)) info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
+
+            if (geteuid() == st.st_uid)
+            {
+                if (!(st.st_mode & S_IWUSR))
+                    info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
+            }
+            else if ((getegid() == st.st_gid))
+            {
+                if (!(st.st_mode & S_IWGRP))
+                    info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
+            }
+            else if (!(st.st_mode & S_IWOTH))
+                info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
+
             RtlSecondsSince1970ToTime( st.st_mtime, &info->CreationTime );
             RtlSecondsSince1970ToTime( st.st_mtime, &info->LastWriteTime );
             RtlSecondsSince1970ToTime( st.st_ctime, &info->ChangeTime );


More information about the wine-patches mailing list