Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
GetAttribute
◄Example► ◄Back► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
;* GetAttribute - Gets the attribute(s) of a specified file.
;*
;* Shows: DOS Function - 43h (Get or Set File Attributes)
;*
;* Params: fspec - Pointer to ASCIIZ file specification
;*
;* Return: Short integer with file attribute bits set as follows:
;* bit 0 = read-only bit 3 = volume label
;* bit 1 = hidden bit 4 = subdirectory
;* bit 2 = system bit 5 = archive
;* 0 indicates normal data file
;* -1 indicates error
GetAttribute PROC \
USES ds, \
fspec:PTR BYTE
LoadPtr ds, dx, fspec ; DS:DX = file specification
mov ax, 4300h ; AH = function #
; AL = 0 (return attribute)
int 21h ; Get File Attributes
mov ax, -1 ; Set code, keep flags
jc exit ; If read error, exit
mov ax, cx ; Else return with
exit: ret ; file attribute bits
GetAttribute ENDP
-♦-