gethostid and GetDiskFreeSpaceEx on NT4

Brian Ford ford@vss.fsi.com
Tue Sep 16 19:58:00 GMT 2003


The attached patch fixes the Cygwin testsuite failure I mentioned here:

http://www.cygwin.com/ml/cygwin-developers/2003-09/msg00019.html

2003-09-16  Brian Ford <ford@vss.fsi.com>

	* syscalls.cc (gethostid): GetDiskFreeSpaceEx call on NT4
	requires lpFreeBytesAvailable argument.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444
-------------- next part --------------
Index: syscalls.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/syscalls.cc,v
retrieving revision 1.289
diff -u -p -u -w -p -r1.289 syscalls.cc
--- syscalls.cc	16 Sep 2003 00:45:50 -0000	1.289
+++ syscalls.cc	16 Sep 2003 19:46:03 -0000
@@ -2884,7 +2884,10 @@ long gethostid(void)
   key.get_string ("ProductId", (char *)&data[6], 24, "00000-000-0000000-00000");
   debug_printf ("Windows Product ID: %s", (char *)&data[6]);
 
-  GetDiskFreeSpaceEx ("C:\\", NULL, (PULARGE_INTEGER) &data[11], NULL);
+  /* Contrary to MSDN, NT4 requires the second argument
+     or a STATUS_ACCESS_VIOLATION is generated */
+  ULARGE_INTEGER availb;
+  GetDiskFreeSpaceEx ("C:\\", &availb, (PULARGE_INTEGER) &data[11], NULL);
   if (GetLastError () == ERROR_PROC_NOT_FOUND)
     GetDiskFreeSpace ("C:\\", NULL, NULL, NULL, (DWORD *)&data[11]);
 


More information about the Cygwin-patches mailing list