delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/11/07:15:26

X-Authentication-Warning: smtp3.ihug.com.au: Host p45-max18.syd.ihug.com.au [203.173.153.45] claimed to be acceleron
Message-ID: <007401c12256$36616950$0a02a8c0@acceleron>
From: "Andrew Cottrell" <acottrel AT ihug DOT com DOT au>
To: <djgpp-workers AT delorie DOT com>
Cc: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>,
"Charles Sandmann" <sandmann AT clio DOT rice DOT edu>
Subject: Fstat.c patch for Windows 2000
Date: Sat, 11 Aug 2001 21:10:20 +1000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
Reply-To: djgpp-workers AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0071_01C122AA.070CAB20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Please find attached a patch for fstat.c that allows 0x71A6 to be used on
Windows NT/2000/XP if LFN is also enabled.

I hope I can explain the not not logic correctly.

The original stat code would return the value 0x124 for a file that only had
the attribute set. It should have returned a value of 0x1A4 wich indicates
thet the file has the read bit set (under dos the bit the corresponding bit
is the read only bit which was not set). Becasue of this issue on Win 2K
various issues would arrise, the main one is that when the link() function
was called the resulting file was read only!!!!

Another one bites the dust.

Andrew

------=_NextPart_000_0071_01C122AA.070CAB20
Content-Type: application/octet-stream;
	name="fstat.dif"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="fstat.dif"

*** fstatorig.c	Sat Aug 11 20:47:22 2001
--- fstat.c	Sat Aug 11 21:03:54 2001
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
***************
*** 816,828 ****
                if (_djstat_flags & _STAT_ACCESS)
                  _djstat_fail_bits |=3D _STFAIL_WRITEBIT;
     =20
!               /* If we run on Windows 9X, and LFN is enabled, try =
harder.
!                  Note that we deliberately do NOT use this call when =
LFN is
!                  disabled, even if we are on Windows 9X, because then =
we
!                  open the file with function 3Ch, and such handles =
aren't
!                  supported by 71A6h call we use here.  */
!               if (dos_major >=3D 7 && _USE_LFN)
!                 {
                    __dpmi_regs r;
     =20
                    r.x.ax =3D 0x71a6;	/* file info by handle */
--- 817,831 ----
                if (_djstat_flags & _STAT_ACCESS)
                  _djstat_fail_bits |=3D _STFAIL_WRITEBIT;
     =20
! 	      /* If we run on Windows 9X or NT/2000/XP, and LFN is enabled, =
try harder.
! 		 Note that we deliberately do NOT use this call when LFN is
! 		 disabled, even if we are on Windows 9X or NT/2000/XP, because then =
we
! 		 open the file with function 3Ch, and such handles aren't
! 		 supported by 71A6h call we use here.  */
! 	      if ((_USE_LFN) &&
! 		  ((dos_major >=3D 7) ||
! 		   (_osmajor =3D=3D 5 && (_get_dos_version(1) =3D=3D 0x532)))) /* =
LFN and NT (or 2000 or XP) */
! 		{
                    __dpmi_regs r;
     =20
                    r.x.ax =3D 0x71a6;	/* file info by handle */

------=_NextPart_000_0071_01C122AA.070CAB20--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019