Interrupt 21h Function 71A8h

Generates an alias (a filename in the 8.3 format) for the specified long filename.

mov ax, 71a8h               ; generate short name
mov si, seg LongFilename    ; see below 
mov ds, si
mov si, offset LongFilename
mov di, seg ShortFilename   ; see below 
mov es, di 
mov di, offset ShortFilename
mov dh, ShortNameFormat     ; see below
mov dl, CharSet             ; see below
int 21h
 

Parameters

LongFilename
Address of null-terminated string that names the long filename to generate an alias for. This string must contain only a filename, not a path.
ShortFilename
Address of null-terminated string that receives the generated alias.
ShortNameFormat
Format for the returned alias (0 is specified for an 11 character directory entry format or 1 for an 8.3 format).
CharSet
Character set of both the long filename and alias. This parameter is a packed 8-bit value with the following form:
Bits Contents
0–3 Specifies the character set of the source long filename.
4–7 Specifies the character set of the destination alias.

One of the following values is specified to indicate the character set for the long filename and alias:
BCS_WANSI (0) Windows ANSI character set
BCS_OEM (1) Current OEM character set
BCS_UNICODE (2) Unicode character set

Return Value

Returns the generated alias in the specified buffer if successful.

Remarks

This function generates the alias using the same algorithm that the system uses with the exception that the returned alias will never have a numeric tail. A numeric tail is appended to the end of an alias and consists of the tilde character (~) followed a number. When the system generates an alias, it may attach a numeric tail if the default alias already exists in the current directory. Because this function does not check the current directory to see if the alias already exists, the returned alias will never have a numeric tail. This service is useful for disk utilities that are trying to establish whether the alias, which seems to be associated with a long filename, is correctly associated.