
                                   Star LFN

  WARNING: This is far from being a complete program or documentation! This is
a test release, use it with great care! Keep visiting the Star LFN homepage at
http://sta.c64.org/starlfn.html for further releases.

  Currently, the program has only experimental read-only support for VFAT, the
way file names are stored by Windows 95/98! This means that, if  VFAT  support
is enabled and you're writing files with long names onto the  disk,  the  long
names will be destroyed because the program can't write VFAT yet!



  1. Introduction

  This program is being designed to emulate the long file name functions  that
are present in the DOS shells of Windows 95/98 but  under  plain  DOS  4.0  or
above.

  Because of the intensive disk access, a disk cache  in  write-back  mode  is
highly recommended!

  Programs similar to this one are the following:

  - DOSLFN, by Henrik Haftmann, is the best you  can  get  (download  it  from
    http://www-user.tu-chemnitz.de/~heha/hs_freeware/freew.html). If you  want
    support for VFAT, FAT32 and national code pages, this is the  program  you
    need!

  - LFNDOS, by Chris Jones, was the one in the lead before (the  old  homepage
    at  http://saturn.spaceports.com/~dosuser/dosutils.htm  is  not  available
    anymore) but it is obsolete now because it has inferior functionality  and
    it contains some apparent bugs that may cause data loss and which, as  the
    program is abandoned and its source not released, will, probably, be never
    fixed.

    A proven bug is that, two directories  with  potentially  the  same  short
    alias - except for the numeric tail - will, eventually, get the same short
    alias. E.g. if you create "LONGNAMEDIR1" and "LONGNAMEDIR2"  in  an  empty
    directory, both will get the short alias "LONGNA~1" which confuses DOS and
    CHKDSK will destroy one of the directories!

  - LONGNAME, in Caldera OpenDOS, refuses to run under original MS-DOS or  DOS
    clones other than OpenDOS - unless patched - and  contains  some  annoying
    bugs.

  - DOSLFN, in Nuts & Bolts 2.0, runs under DOS 7.x (the DOS of Windows 95/98)
    only, has several bugs and locks up quite often.

  There is a collection of such programs at http://sta.c64.org/lfnemu.html.

  This program has initially been tested in a less risky environment (see  the
file access mode below), therefore its core  is,  probably,  more  robust  and
stable than any of the programs mentioned above.  In  this  program,  you  can
choose between two operational modes:

  1. File access: Long file names are stored in a hidden  system  file  called
     "longname.dat" in each directory. This is  the  default  mode,  which  is
     compatible with any operating system that has an able DOS  shell  because
     it involves significantly less hacking.

  2. Disk access: Long file names are stored in the disk  area  allocated  for
     the directory. This is VFAT, the method Windows uses. In VFAT mode,  this
     program supports uncompressed FAT12 and FAT16  partitions  only  and  has
     been reported to fail on SCSI hard disks. WARNING: This mode is currently
     experimental and read-only!

  Both modes work with ASSIGN'ed, JOIN'ed and  SUBST'ed  drives.  Disk  access
mode refuses to show long file names on CD drives and network  drives  because
these are stored with a completely different method, not VFAT.

  The only way to exchange long file names between these two modes is  putting
the files into an archive, with a LFN-aware archiver, in one operational  mode
and extracting the files in the other mode.



  2. Usage

  The parameter syntax is the following:

  STARLFN [-|/]<options>

  <options>:

  - I: Installs the program. As a secondary  parameter, you  can  specify  the
       operational mode: D for disk access (VFAT), F for file  access  (hidden
       system file, default).

  - U: Uninstalls the program.

  Without any options specified, the program will show usage information.



  3. Technical background

  The following INT 21h functions have already been implemented:

  - Flush buffers and cache (AX=710Dh and CX=0/1).

  - Make directory (AX=7139h). Uses and updates data base.

  - Remove directory (AX=713Ah). Uses and updates data base.

  - Change directory (AX=713Bh). Uses data base.

  - Delete file (AX=7141h or AH=41h). Uses and updates data base.

  - Get/set file attributes (AX=7143h and BL=0/1). Uses data base.

  - Get current directory (AX=7147h). Uses data base.

  - Find first matching file (AX=714Eh). Uses data base.

  - Find next matching file (AX=714Fh). Uses data base.

  - Rename file (AX=7156h or AH=56h). Uses and updates data base.

  - Get true name of file (AX=7160h and CL=0). Uses data base.

  - Get short name of file (AX=7160h and CL=1). Uses data base.

  - Get long name of file (AX=7160h and CL=2). Uses data base.

  - Create or open file (AX=716Ch). Uses and updates data base.

  - Get volume info (AX=71A0h).

  - Close file search (AX=71A1h).

  - Generate short alias (AX=71A8h).

  Fake INT 21h functions:

  - Convert date stamps (AX=71A7h and BL=0/1). Does no conversion at all.

  Some nice features worth mentioning:

  - For certain programs, the emulators returns a false DOS version number  of
    7 and a false Windows version number of 4 because they refuse to use  long
    file names otherwise (currently, 4DOS and ARJ).

  - The data base looks just like the DESCRIPT.ION files  of  4DOS,  the  file
    name was only changed to avoid confusion.

  - The data base is hidden from the directory list if the client program uses
    long file name functions to read the directory.

  - The ordinary "remove directory", "delete file" and "rename file" functions
    are redirected to their long file name counterparts so that  no  redundant
    long file name entry remains when a LFN-unaware program deletes or renames
    files or directories using their short file name.

  - Several other DOS functions, such as "make directory", "change directory",
    "create file", "open file", "get/set file attributes"  and  "extended open
    file" are also redirected so that several  LFN-unaware  programs  will  be
    able to use long file names without any modification.

  - The search handles used by a process are  automatically  closed  when  the
    process exits.

  - The end-of-line mark in the data base can be any combination  of  carriage
    returns and line feeds.

  The following features still have to be implemented:

  - Support for 64-bit date stamps in "find first  matching  file"  and  "find
    next matching file".

  - A true "convert date stamps" function (AX=71A7h and BL=0/1). Until this is
    finished, running the program under Windows 95/98 will mess up date stamps
    in the directory list and also when files are touched.

  Some features that do not follow the behavior of Windows 95/98  exactly  and
are unlikely to change (they would be either hard or useless to change):

  - "Flush buffers and cache" flushes buffers for all drives, can  only  flush
    SmartDrive, Norton Cache or compatible cache programs and  cannot  remount
    DriveSpace volumes (AX=710Dh and CX=2).

  - "Get/set file attributes" can't get compressed  file  size  (AX=7143h  and
    BL=2).

  - "Get current directory" always returns a full long form path.

  - "Get true file name" always returns a full long form absolute  file  name,
    actually, it is done by the "get long file name" function.

  - None of the file name conversion routines return any error code,  even  if
    only a drive letter or a bad path is given or the drive letter is invalid.

  - The  functions  "get file info"  (AX=71A6h),  "server create or open file"
    (AX=71A9h) and "create/terminate/query SUBST" (AX=71AAh  and  BH=0-2)  are
    not implemented at all.

  Some problems that are solved when VFAT support is enabled:

  - The data base is easy to tamper, there are no checksums  in  it,  you  can
    even create multiple files with the same long file name.

  - Short file names may not contain spaces because the first space on a  line
    of the data base separates the short and long file names.

  - The line feed inserted into the data base is always  CR/LF,  independently
    from the end-of-line mark actually used.

  Some problems that will be solved when VFAT support is finished:

  - "Get/set file attributes" can't get or  set  Windows  95/98-specific  file
    date stamps (AX=7143h and BL=3-8).

  - "Find first matching file" and "find next matching file" can  only  return
    DOS-style file date stamps and know nothing about Unicode either.

  A problem which is probably impossible to overcome is that the original  DOS
COMMAND.COM and external DOS commands cannot handle long  file  names  so  you
won't be able to pass long file names as parameters to them. By the way,  this
is the reason why Caldera included a modified OpenDOS COMMAND.COM  along  with
their long file name support program: to smarten up, at  least,  the  internal
DOS commands. A good solution is using 4DOS or booting DOS 7, which comes with
Windows 95/98, because their internal DOS commands are also capable  of  using
long file names, when available.

  However, with this program and a DOS-based LFN-aware file manager, you'll be
able to copy, rename, delete files and directories with long names under plain
DOS. You may even backup and restore your entire Windows 95/98 partition, file
by file, easily. Just, please, be patient until VFAT support is finished.



  4. Compatibility

  The following programs have been tested and seem to work fine,  without  any
changes, in file access mode:

  - 4DOS 7.01

  - ARJ 2.71

  - Info-ZIP 2.2 and 2.3, 32-bit DOS version

  - OpenDOS 7.01 COMMAND.COM

  - PKUNZIP 2.04g

  - The Star Commander 0.82

  - The Volkov Commander 4.99 alphas

  The following programs have been tested but they have to be  forced  to  use
Windows 95/98 long file name functions even under plain DOS:

  - 4DOS 6.0x: Specifying "Win95LFN=Yes"  in  4DOS.INI  doesn't  help  because
    "dir", which is correctly aliased to "dir *",  only  lists  files  without
    extension, as if 4DOS were running under plain DOS!  Note:  This  bug  has
    been fixed in 4DOS 7.0.

  - ARJ 2.60: It has to be fooled to be running under DOS 7.0 and Windows 4.0,
    otherwise it won't use long file names at all. Note:  This  bug  has  been
    fixed in ARJ 2.61.

  The following programs have severe problems:

  - HVSC_2 for Windows 95/98 (High Voltage SID Collection 1.6 -> 2.0  update):
    It keeps opening several hundred directory search records without  closing
    any of them. This is a bug in DJGPP: although opendir() and readdir() both
    close the LFN search handle automatically when there are no more directory
    entries to read, closedir() never does.

  I haven't tested the programs above extensively, please, tell me if you find
some problems. Try this program with other LFN-aware programs, too,  and  tell
me about incompatibilities.



  5. History
  
  0.01 beta:

  - First release.

  0.02 beta:

  - Introducing the "rename" function, the ordinary DOS "rename"  function  is
    redirected to this function.

  - Introducing the "volume info" function.

  - Short file names are recognized in a smart way and no long file name entry
    is created for them.

  - No more strange effects when trying to read the root directory of a  drive
    under VC 4.99 alphas.

  - Improved compatibility with VC 4.99 alphas, 4DOS 6.01 and ARJ 2.60.

  0.03 beta:

  - Introducing the comparation of file names against  the  search  file  name
    pattern in "find first matching file" and  "find next matching file".  Now
    4DOS 6.01 does find external programs and ARJ 2.60 doesn't decompress  all
    files in the current directory upon startup.

  - 4DOS is not fooled to be running under Windows 95/98  because  it  has  an
    option to force the usage  of  Windows  95/98  long  file  name  functions
    anyway.

  0.10 beta:

  - First public release.

  - 4DOS is fooled again to be running under Windows 95/98,  otherwise  "dir",
    that is, "dir *" will only list files without extension, as if  4DOS  were
    running under plain DOS.

  - Now "delete file" accepts wildcards and search attributes.

  - The maximum number of search records available at a time has  been  raised
    from 4 to 16.

  - Several bugs, related to  problems  with  the  High Voltage SID Collection
    1.6 -> 2.0 update program, have been fixed.

  - If the client program uses long file name functions to read the  directory
    then the entry of the data base (the short file  name  is  "longname.dat")
    will be hidden.

  0.11 beta:

  - Introducing the redirection of several other DOS functions, such as  "make
    directory", "change directory", "create file", "open file",  "get/set file
    attributes" and "extended open file".

  - Several small bugfixes.

  0.12 beta:

  - Introducing a standalone program,  LFNDIR,  that  contains  physical  disk
    access routines and can read Windows 95/98-style long file names  off  the
    disk.

  - The tilde and number are now appended  to  short  file  names  by  default
    because leaving them caused problems with the High Voltage SID Collection.

  0.20 beta:

  - The compatibility with the Windows 95/98 alias  generation  algorithm  has
    been improved: only those aliases get a tilde and  a  number,  whose  long
    file name counterpart is too long and/or contains invalid characters.  The
    aliases of long file names conforming to the  8.3  format  but  containing
    mixed case characters are simply the uppercase form of the long file name.

  - Fully lowercase long file names can now be created.

  - Now there are no problems if you only change the case of characters  while
    renaming a file.

  - You're not allowed to create two files whose names are basically the  same
    because only the case of some of the characters are different.

  - File names that conform to the 8.3 format but  whose  name  and  extension
    part is in different case are now recognized as long file names.

  - Only the first three characters of the extension is copied from  the  long
    file name to its short equivalent.

  - The check for the validity of long file names is more thorough in LFNDIR.

  - LFNDIR displays long file names of a length of a multiple of 13 correctly.

  0.21 beta:

  - LFNDOS runs under Windows 95/98 and DOS 7.x, as well.

  - When browsing through the directory of Novell Netware drives, LFNDOS  also
    returns entries having the Shareable attribute set.

  - In  the  LFNDOS  source,  you  can  also  change  the  file  attribute  of
    LONGNAME.DAT files created by the program. Switching the system and hidden
    attributes off helps  with  getting  rid  of  "unmovable  files"  in  disk
    defragmenter programs.

  - LFNDIR shows no volume labels and deleted files anymore, it  displays  the
    short name of files in lowercase and that of directories in uppercase  and
    it displays file names starting with an E5h character correctly.

  0.22 beta:

  - Files with exactly nine characters in the name part of their file name are
    now handled correctly.

  - When a client program reads through  the  directory  using  FindFirst  and
    FindNext, LFNDOS checks for the existence of LONGNAME.DAT only once and if
    if not present, no checks are done during the remainder of the directory.

  0.23 beta:

  - Long file names starting with a space are now handled correctly.

  - Long file names that contain lowercase characters only and conform to  the
    DOS 8.3 file  naming  convention  are  not  converted  to  full  uppercase
    anymore.

  - The "get  true/short/long  name  of  file"  functions  support  the  SUBST
    expansion flag.

  - Introducing the "generate short alias" function.

  - Introducing support for the alias  hint  in  the  "create  or  open  file"
    function.

  - A problem with the "LONGNAME.DAT exists" flag, introduced  in  0.22  beta,
    that prevented Info-ZIP from archiving files with  long  names,  has  been
    fixed.

  - LFNDIR prints out no startup message anymore, only the list of files.

  - A new compilation directive in LFNDIR allows you  to  make  it  list  file
    names in the format of LONGNAME.DAT files.

  0.24 beta:

  - File accesses in the root directory of drives are now handled correctly.

  - Ctrl-Break presses are not swallowed when the resident core is active, the
    original interrupt handler is signalled upon exit from the core.

  0.25 beta:

  - Renamed the program to "Star LFN" so that its name doesn't  conflict  with
    Chris Jones' LFNDOS anymore.

  - Uninstallation is now done by specifying the option '/U'.

  - No LFN entries are created  anymore  for  file  names  that  belong  to  a
    standard device.

  - You get no more "File not  found"  error  when  opening  standard  devices
    because they are assumed to "exist" in  any  directory,  just  like  under
    plain DOS.

  0.26 beta:

  - Instead of a fixed list  of  devices,  the  chain  of  actually  installed
    devices is walked through when checking file names. As a result, the  last
    two fixes of the previous release now  apply  to  all  actually  installed
    devices rather than standard devices only.

  - LFNDIR no more compares the first non-space character  of  the  short  and
    long file names, that was an extra check to make sure the two  file  names
    belong together.

  0.27 beta:

  - LFNDIR considers all LFN entries with their first byte having the 7th  bit
    set as deleted, rather than only entries with their first byte being E5h.

  0.30 beta (2002-03-10):

  - Introducing experimental read-only VFAT support.

  - When started without any command  line  parameter,  the  program  displays
    usage information rather that installing itself at once.

  - Installation is now done by specifying the option '/I'.

  - Replaced a huge amount of  magic  numbers  with  named  constants  in  the
    source.

  0.31 beta (2002-09-08):

  - Moved the history into the main documentation.

  - Fixed the lockup that occurred in  VFAT  mode  when  copying  a  directory
    structure with long file names (the long file names are still not  written
    onto the disk though so you will get an error message anyway).

  0.32 beta (2004-01-31):

  - Updated the list about other similar programs in the documentation.



  6. Thanks to

  Thanks go to the following people:

  - Malcom Dew-Jones for his LFNUTILS package

  - Chris Jones for discussion and for his LFNDOS

  - Duncan J. Murdoch for general help with LFN's and for his LFNSORT

  - Les Williams for discussion of LFN's on CD-ROM's

  Fucks go to PC Magazine, the copyright owner of Rick Knoblaugh's LFNDir, for
having published the source along with a ridiculous license that  only  allows
others to make personal use of the source but distribute no  derivative  works
at all! This program contains nothing at  all  from  their  lame  intellectual
property!



  7. Error messages

  - This program needs DOS 4.0 or later

    The program uses several features, part of which  are  undocumented,  that
    are available only in DOS 4.0 and newer versions. You cannot use  it  with
    older DOS versions.

  - Out of memory

    The program could not allocate memory for its own purposes. Try freeing up
    memory by uninstalling some resident programs.

  - Star LFN cannot be uninstalled - you've installed some programs after it.

    One or more programs, installed afterwards,  have  hooked  onto  the  same
    interrupts, therefore the program can't uninstall itself. Uninstall  those
    other programs in a reverse order of their installation and try again.



  8. Copyright and legal issues

  The source of this program is public domain and provided here "as  is"  -  I
don't feel like commenting it more but if you have problems then feel free  to
ask me. If you derive your own program from the source or put a  part  of  the
source into your own program, please, give me a credit and send a copy to me.



  9. The author

  If you're interested in some similarly useful utilities you can  contact  me
at sta@c64.org or visit my homepage at http://sta.c64.org.

  Joe Forster/STA
  31st January, 2004
