Used NtQueryFullAttributesFile instead of NtOpenFile/NtQueryInformationFile/NtClose in GetFileAttributesExW (suggested by Thomas Weidenmueller).
Modified: trunk/reactos/lib/kernel32/file/file.c

Modified: trunk/reactos/lib/kernel32/file/file.c
--- trunk/reactos/lib/kernel32/file/file.c	2005-09-24 18:04:13 UTC (rev 18028)
+++ trunk/reactos/lib/kernel32/file/file.c	2005-09-24 18:09:06 UTC (rev 18029)
@@ -835,9 +835,7 @@
 {
   FILE_NETWORK_OPEN_INFORMATION FileInformation;
   OBJECT_ATTRIBUTES ObjectAttributes;
-  IO_STATUS_BLOCK IoStatusBlock;
   UNICODE_STRING FileName;
-  HANDLE FileHandle;
   NTSTATUS Status;
   WIN32_FILE_ATTRIBUTE_DATA* FileAttributeData;
 
@@ -868,36 +866,18 @@
 			      NULL,
 			      NULL);
 
-  /* Open the file */
-  Status = NtOpenFile (&FileHandle,
-		       SYNCHRONIZE | FILE_READ_ATTRIBUTES,
-		       &ObjectAttributes,
-		       &IoStatusBlock,
-		       0,
-		       FILE_SYNCHRONOUS_IO_NONALERT);
+  /* Get file attributes */
+  Status = NtQueryFullAttributesFile(&ObjectAttributes,
+                                     &FileInformation);
+                                     
   RtlFreeUnicodeString (&FileName);
   if (!NT_SUCCESS (Status))
     {
-      DPRINT ("NtOpenFile() failed  %x (Status %lx)\n", &ObjectAttributes, Status);
+      DPRINT ("NtQueryFullAttributesFile() failed (Status %lx)\n", Status);
       SetLastErrorByStatus (Status);
       return FALSE;
     }
 
-  /* Get file attributes */
-  Status = NtQueryInformationFile (FileHandle,
-				   &IoStatusBlock,
-				   &FileInformation,
-				   sizeof(FILE_NETWORK_OPEN_INFORMATION),
-				   FileNetworkOpenInformation);
-  NtClose (FileHandle);
-
-  if (!NT_SUCCESS (Status))
-    {
-      DPRINT1 ("NtQueryInformationFile() failed (Status %lx)\n", Status);
-      SetLastErrorByStatus (Status);
-      return FALSE;
-    }
-
   FileAttributeData = (WIN32_FILE_ATTRIBUTE_DATA*)lpFileInformation;
   FileAttributeData->dwFileAttributes = FileInformation.FileAttributes;
   FileAttributeData->ftCreationTime.dwLowDateTime = FileInformation.CreationTime.u.LowPart;