This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

csih: Patch getVolInfo.c


Hi Chuck,

today I found a filesystem, HGFS, which is sensible against using just
the READ_CONTROL flag in calls to NtOpenFile.  The result is a
STATUS_INVALID_PARAMETER status code.

However, for access to the filesystem information, the READ_CONTROL
isn't necessary.  A desired access of 0 is sufficient in every case
I could lay my hands on (NTFS, NFS, Samba, FAT32, HGFS).

So I just applied a patch to Cygwin to fetch filesystem information
with access set to 0.

The same patch should go into getVolInfo in csih.  Patch below.

	* cygwin/getVolInfo.c: Open filesystem with access set to 0.

Index: cygwin/getVolInfo.c
===================================================================
RCS file: /sourceware/projects/cygwin-apps-home/cvsfiles/csih/cygwin/getVolInfo.c,v
retrieving revision 1.1
diff -u -p -r1.1 getVolInfo.c
--- cygwin/getVolInfo.c	7 Aug 2008 23:17:32 -0000	1.1
+++ cygwin/getVolInfo.c	22 Jul 2009 18:52:42 -0000
@@ -84,12 +84,12 @@ main (int argc, char **argv)
       return 1;
     }
   InitializeObjectAttributes (&attr, &upath, OBJ_CASE_INSENSITIVE, NULL, NULL);
-  stat = ZwOpenFile (&h, READ_CONTROL, &attr, &io, FILE_SHARE_VALID_FLAGS,
+  stat = ZwOpenFile (&h, 0, &attr, &io, FILE_SHARE_VALID_FLAGS,
 		     FILE_OPEN_FOR_BACKUP_INTENT);
   if (!NT_SUCCESS (stat) && stat == STATUS_NO_MEDIA_IN_DEVICE)
     {
       upath.Length = 6 * sizeof (WCHAR);
-      stat = ZwOpenFile (&h, READ_CONTROL, &attr, &io, FILE_SHARE_VALID_FLAGS, 0);
+      stat = ZwOpenFile (&h, 0, &attr, &io, FILE_SHARE_VALID_FLAGS, 0);
     }
   if (!NT_SUCCESS (stat))
     {


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]