[ntdll] Move file attribute logic to new function DIR_get_attributes()

Juan Lang juan.lang at gmail.com
Sun Oct 4 11:21:45 CDT 2009


Hi Dan,

in patch 2/3,

+    TRACE("fd %d, name %s, attrib %x\n", fd, debugstr_a(unix_fname), *pattrib);
+    *pattrib = attributes;

Any reason you're tracing *pattrib before you set it?

+ * If unix_fname is not NULL, DIR_is_hidden_file is called to do .dotfile check
This is a change from the existing code, and I don't know whether it's
intended or not:

@@ -1575,17 +1575,9 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE
hFile, PIO_STATUS_BLOCK io,
     case FileBasicInformation:
         {
             FILE_BASIC_INFORMATION *info = ptr;
-
-            if (fstat( fd, &st ) == -1)
-                io->u.Status = FILE_GetNtStatus();
-            else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode))
-                io->u.Status = STATUS_INVALID_INFO_CLASS;
-            else
+            io->u.Status = DIR_get_attributes(fd, NULL,
&info->FileAttributes, &st);

Neither this case, nor the FileAllInformation case, were checking
show_dot_files before.

Also, I'm not sure if this is a useful comment or not, but patch 2/3
is the hardest to review, as every path that was changed needs to be
checked for consistency.  I know that for patch 3, it makes the most
sense for the attribute setting code to be in one location, so I
understand that you want to get there.  Still, it seems possible to
break this one up further.  Part of the patch deals with getting a
struct stat for a file, and the other part deals with deciding a
file's attributes based on a combination of its name and a struct
stat.
--Juan



More information about the wine-devel mailing list