X-Authentication-Warning: new-smtp1.ihug.com.au: Host p217-tnt3.syd.ihug.com.au [203.173.132.217] claimed to be acceleron Message-ID: <004001c122c7$6d28a0e0$0a02a8c0@acceleron> From: "Andrew Cottrell" To: , "Charles Sandmann" References: <000501c122c2$9a082770$13032c0a AT seti> Subject: Re: Fstat.c patch Date: Sun, 12 Aug 2001 10:40:45 +1000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_003D_01C1231B.3DCABAF0" 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_003D_01C1231B.3DCABAF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit From: "Charles Sandmann" > Why are we checking the dos version when _USE_LFN is set? This breaks using > a LFN TSR under any other version of DOS. No idea, I just added the condition so that under Win NT/2000/XP if LFN is specified the call to 0x71A6 would also be done. Analysing the code a bit closer I agree with you as there is no penalty if we do call 0x71A6 and it fails, except fot the time taken to make the call. I have changed the patch attached as outlined below and then the solution will work on other versions of DOS with a LFN TSR and future versions of Windows if they change the dos version number. Original code: if (dos_major >= 7 && _USE_LFN) ..... __dpmi_regs r; r.x.ax = 0x71a6; /* file info by handle */ Try #1: if ((_USE_LFN) && ((dos_major >= 7) || (_osmajor == 5 && (_get_dos_version(1) == 0x532)))) /* LFN and NT (or 2000 or XP) */ ..... __dpmi_regs r; r.x.ax = 0x71a6; /* file info by handle */ Try #2: if (_USE_LFN) ..... __dpmi_regs r; r.x.ax = 0x71a6; /* file info by handle */ Andrew ------=_NextPart_000_003D_01C1231B.3DCABAF0 Content-Type: application/octet-stream; name="fstat_2.dif" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fstat_2.dif" *** fstatorg.c Sun Aug 12 10:32:36 2001 --- fstat.c Sun Aug 12 10:36:48 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 */ *************** *** 815,828 **** stat_buf->st_mode |=3D (S_IFREG | READ_ACCESS); 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 */ --- 816,829 ---- stat_buf->st_mode |=3D (S_IFREG | READ_ACCESS); if (_djstat_flags & _STAT_ACCESS) _djstat_fail_bits |=3D _STFAIL_WRITEBIT; !=20 ! /* Only call this is LFN is set. ! 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) ! { __dpmi_regs r; =20 r.x.ax =3D 0x71a6; /* file info by handle */ ------=_NextPart_000_003D_01C1231B.3DCABAF0--