Mail Archives: djgpp-workers/2002/01/09/21:02:39
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 -