DGI LFN Support for DOSEmu Page
 

LFN Support for DOSEmu

LFN was introduced to DOS by windows 95, and is a big form to communicate with other file systems as well (on unix there is not limitation for the file length). 

The interface for LFN is done from interrupt 21h (the ms-dos interrupt), AH = 0x71, AL function number. Here is a description of each LFN functions and how to implement it. For emulating LFN calls we need to have the FAT file system mounted under Linux with file system VFAT. This is how it is done. We use the Linux Kernel to generate LFN calls. For the first step I only will implement using $_hdimage ='bootdir". That means booting from a directory, not using a hd-image.That means that LFN support is available from DOSEmu v0.98 and above only.
 
Function
 Name and description
0Dh
Reset drive
  • Description

  • This function flushes the file system buffers and cache. 
  • Registers

  •  AX = 710Dh
     CX = action 
     DX = drive number
     Values for drive reset action:
     0000h flush file system buffers for drive, and reset drive
     0001h flush filesystem buffers and cache for drive, and reset drive
     0002h remount DriveSpace volume
  • How to implement

  • We could call function 0Dh of interrupt 21h that does the same. (what is the difference between those two?). Action 2 will not be implemented.
39h
Create directory
  • Description

  • Writes a directory to the file system.
  • Registers

  • DS:DX -> ASCIZ long directory name (including path)
  • How to implement

  • We need to know where to find the directory under UNIX . Then  we call the Kernel to generate the LFN directory under that file system.
3Ah
Remove directory
  • Description

  • Deletes a directory from the file system.
  • Registers

  • DS:DX -> ASCIZ long name of directory to remove
  • How to implement

  • Look at function 39h.  Another good way could be to get the SFN of the directory and then call dos function 3Ah. This will remove a SFN directory (this directory is actually the one the user wants to delete). The latest sounds better, because the DOS itself should handle it as he wishes.
3Bh
Set current directory 
  • Description

  • Changes the current directory.
  • Registers

  • DS:DX -> ASCIZ long name of directory to make current
  • How to implement

  • The easiest way to do it, is getting the SFN of the directory and then calling AL=3Bh which is the SFN change directory. One problem could be that standard DOS supports only a 64 byte directory size. 
41h
Delete file 
  • Description

  • Delete a group of files.
    Registers
    DS:DX -> ASCIZ long name of file to delete
     SI = wild card and attributes flag
      0000h wildcards are not allowed, and search attributes are 
            ignored
      0001h wildcards are allowed, and only files with matching 
            names and attributes are deleted
     CL = search attributes (?)
     CH = must-match attributes (?)
  • How to implement

  • Deleting a single file is easy, I do it the easy way, transform it to SFN and then pass it back to function 41h. 
    When  the calling program wants to delete a few files, it would be easy to do it from Linux, but if I really wanted to do it from DOS then  I would use functions 4Eh and 4Fh to find the files, and then pass each file to function 7141h (recursive interrupts).
43h
get/set file attributes 
  • Description

  • Set/change the attributes of a file.
  • Registers

  • DS:DX -> ASCIZ long file name
    BL = action
    (CX,DI,SI)
  • How to implement

  • action 0-2:  (get normal attributes), by calling AX=7143h)
    all others  :  calling the Kernel.
47h
get current directory 
  • Description

  • Get current working directory.
  • Registers

  • DL = drive (0=current, 1=A:, 2=B: etc.)
    DS:DI -> Buffer for ASCIZ
  • How to implement

  • Check if the drive is mounted under Linux. DOS Attributes of SFN current drive. If drive is mounted under Linux, find a directory with the same attributes.
4Eh
find first file 
  • Description

  • Start the search of a list of files.
  • Registers

  •  AX = 714Eh
     CL = allowable-attributes mask 
          (bits 0 and 5 ignored)
     CH = required-attributes mask 
     SI = date/time format 
     DS:DX -> ASCIZ filespec (both "*" and "*.*" match any filename)
     ES:DI -> FindData record 
  • How to implement

  • Find the mounted directory under Linux and use Kernel commands.
4Fh
find next file 
  • Description

  • After calling function 4Eh  to continue should call this function.
  • Registers

  •  AX = 714Fh
     BX = filefind handle 
     SI = date/time format 
     ES:DI -> buffer for FindData record 
  • How to implement

  • The same a function 4Eh
56h
Rename file
  • Description

  • Long file name rename.
  • Registers

  •  DS:DX -> ASCIZ old file or directory name (long names allowed)
     ES:DI -> ASCIZ new name (long names allowed)
  • How to implement

  • Find the source name in Linux , and use Kernel functions.
60h
TrueName functions
  • Description

  • Get the short file name for a drive or a network connection(?).
  • Registers

  •  CX = sub-function
     DS:SI -> ASCIZ short filename or path
     ES:DI -> 261-byte buffer for canonicalized long name
  • How to implement

  • Find the directory in the Linux tree, get information about the file (from Linux), find a file that starts with the 5 firsts chars as the wanted file and has the same attributes as found in Linux.
6Ch
Create/open file
  • Description

  • Create/Open/Truncate a file.
  • Registers

  •  BX = access mode and sharing flags (see #01782,also AX=6C00h)
     CX = attributes
     DX = action (see #01781)
     DS:SI -> ASCIZ filename
     DI = alias hint (number to append to short filename for disambiguation)
  • How to implement

  • Get the SFN for the file, and call function 6Ch, or others to implement this using SFN.
A0h
Get volume information 
  • Description

  • Gets information about a drive.
  • Registers

  •  AX = 71A0h
     DS:DX -> ASCIZ root name (e.g. "C:\")
     ES:DI -> buffer for file system name
     CX = size of ES:DI buffer
  • How to implement

  • Most of the field could be filled by hand. If the file system is not mounted on the Linux tree, it would report that there is no0t LFN support. On Unix drives or directories, should report that searches are case sensitive.
A1h
Terminate FindFirst/FindNext 
  • Description

  • When a FindFirst/FindNext functions are called, they should be terminated using this function.
  • Registers

  • BX  =  FileHandle get from the FindFirst
  • How to implement

  • Using Kernel functions.
A6h
Get file information 
  • Description
  • Registers
  • How to implement
A7h
Time conversion Description
  • Description
  • Registers
  • How to implement
A8h
Generate short filename 
  • Description

  • Generate a SFN from a LFN.
  • Registers

  •  AX = 71A8h
     DS:SI -> ASCIZ long filename (no path allowed!)
     ES:DI -> buffer for ASCIZ short filename
     DH = short name's format
         00h 11-char directory entry/FCB filename format
         01h DOS 8.3
     DL = character sets
         bits 7-4: short name's character set 
         bits 3-0: long name's character set 
  • How to implement

  • See TrueName functions.
A9h
Server create/open file 
  • Description
  • Registers
  • How to implement
AAh
create/terminate SUBST 
  • Description
  • Registers
  • How to implement

 
DownLoad the patches
There are not patches available yet.


[Back]
 
  Webmaster :
dgi_il@hotmail.com
Last modified: 1-9-2000.