NtQueryFullAttributesFile: FILE_ATTRIBUTE_READONLY
Ulrich Czekalla
ulrich.czekalla at utoronto.ca
Wed Mar 16 09:30:17 CST 2005
Here is an updated patch that implements this differently.
As per Alexandre's suggestion, this patch broadens the heuristic used to
determine if a file or directory is readonly.
ChangeLog:
Ulrich Czekalla <ulrich at codeweavers.com>
Don't mark a file as readonly if it has any write bit set
-------------- next part --------------
Index: dlls/ntdll/directory.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/directory.c,v
retrieving revision 1.23
diff -u -p -r1.23 directory.c
--- dlls/ntdll/directory.c 9 Feb 2005 13:32:12 -0000 1.23
+++ dlls/ntdll/directory.c 16 Mar 2005 15:22:00 -0000
@@ -628,7 +628,7 @@ static FILE_BOTH_DIR_INFORMATION *append
info->FileAttributes = FILE_ATTRIBUTE_ARCHIVE;
}
- if (!(st.st_mode & S_IWUSR))
+ if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
if (!show_dot_files && long_name[0] == '.' && long_name[1] && (long_name[1] != '.' || long_name[2]))
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 16 Mar 2005 15:22:00 -0000
@@ -966,7 +966,8 @@ NTSTATUS WINAPI NtQueryInformationFile(
{
if (S_ISDIR(st.st_mode)) info->FileAttributes = FILE_ATTRIBUTE_DIRECTORY;
else info->FileAttributes = FILE_ATTRIBUTE_ARCHIVE;
- if (!(st.st_mode & S_IWUSR)) info->FileAttributes |= FILE_ATTRIBUTE_READONLY;
+ if (!(st.st_mode & (S_IWUSR | S_IWGRP | 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);
@@ -1053,7 +1054,7 @@ NTSTATUS WINAPI NtQueryInformationFile(
info->StandardInformation.NumberOfLinks = st.st_nlink;
info->StandardInformation.DeletePending = FALSE; /* FIXME */
}
- if (!(st.st_mode & S_IWUSR))
+ if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
info->BasicInformation.FileAttributes |= FILE_ATTRIBUTE_READONLY;
RtlSecondsSince1970ToTime( st.st_mtime, &info->BasicInformation.CreationTime);
RtlSecondsSince1970ToTime( st.st_mtime, &info->BasicInformation.LastWriteTime);
@@ -1249,7 +1250,8 @@ 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 (!(st.st_mode & (S_IWUSR | S_IWGRP | 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