www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/01/09/21:02:39

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10201100202.AA16147@clio.rice.edu>
Subject: Re: LFN32 optimizations [was: Re: Proposed lstat.c patch for Win2000/XP device bit fix
To: djgpp-workers AT delorie DOT com
Date: Wed, 9 Jan 2002 20:02:37 -0600 (CST)
Cc: ams AT ludd DOT luth DOT se
In-Reply-To: <10201100031.AA16325@clio.rice.edu> from "Charles Sandmann" at Jan 09, 2002 06:31:43 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Seemingly working example.  I would suggest moving _is_ff_LFN() macro to
dir.h and using it in access.c also.

*** lstat.c_	Tue Dec 11 21:28:06 2001
--- lstat2.c	Wed Jan  9 19:59:22 2002
*************** int __findfirst(const char *, struct ffb
*** 128,133 ****
--- 128,135 ----
  int __findnext(struct ffblk *);
  
  #define ALL_FILES   (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC|FA_ARCH)
+ #define _is_ff_LFN(ff_blk)  ( *(long *)(&(ff_blk.lfn_magic[0])) == \
+  'L'+('F'<<8)+('N'<<16)+('3'<<24) && *(short *)(&(ff_blk.lfn_magic[4])) == '2' )
  
  /* Should we bother about executables at all? */
  #define _STAT_EXECBIT       (_STAT_EXEC_EXT | _STAT_EXEC_MAGIC)
*************** stat_assist(const char *path, struct sta
*** 600,605 ****
--- 602,617 ----
        if ( !(ff_blk.ff_attrib & 0x07) )  /* no R, H or S bits set */
          statbuf->st_mode |= WRITE_ACCESS;
  
+       /* Windows 2000 and XP - devices don't set attributes correctly */
+       if( _os_trueversion == 0x532 &&
+           (_djstat_fail_bits & _STFAIL_TRUENAME) && !ff_blk.ff_fsize &&
+           !ff_blk.ff_ftime && (ff_blk.ff_fdate == 33) && 
+           !ff_blk.lfn_ctime && (ff_blk.lfn_cdate == 33) && 
+           !ff_blk.lfn_atime && (ff_blk.lfn_adate == 33) && 
+           _is_ff_LFN(ff_blk) &&
+           /* strlen(ff_blk.ff_name) == 3 && */ ff_blk.ff_attrib == 0x20)
+         ff_blk.ff_attrib = 0x40;  
+ 
        /* Sometimes `_truename' doesn't return X:/FOO for character
  	 devices.  However, FindFirst returns attribute 40h for them.  */
        if (ff_blk.ff_attrib == 0x40)
*************** stat_assist(const char *path, struct sta
*** 773,779 ****
    statbuf->st_atime = statbuf->st_mtime = statbuf->st_ctime =
      _file_time_stamp(dos_ftime);
  
!   if ( ! strcmp(ff_blk.lfn_magic,"LFN32") )
      {
        unsigned xtime;
        xtime = *(unsigned *)&ff_blk.lfn_ctime;
--- 785,791 ----
    statbuf->st_atime = statbuf->st_mtime = statbuf->st_ctime =
      _file_time_stamp(dos_ftime);
  
!   if ( _is_ff_LFN(ff_blk) )
      {
        unsigned xtime;
        xtime = *(unsigned *)&ff_blk.lfn_ctime;

- Raw text -


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