Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
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.
SetAttribute
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* SetAttribute - Sets the attribute(s) of a specified file.
;*
;* Shows:   DOS Function - 43h (Get or Set File Attributes)
;*
;* Params:  Attr - 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
;*                 (Attr = 0 for normal data file)
;*          Fspec - Pointer to ASCIIZ file specification
;*
;* Return:  Short integer with error code
;*          0 if successful
;*          1 if delete error
 
SetAttribute PROC USES ds,
        Attr:WORD,
        Fspec:PBYTE
 
        LoadPtr ds, dx, Fspec           ; DS:DX = file specification
        mov     cx, Attr                ; Put attribute code in CX
        mov     ax, 4301h               ; AH = function #
                                        ; AL = 1 (set attribute)
        int     21h                     ; Set File Attributes
        mov     ax, 0                   ; Clear code, keep flags
        .IF     carry?
        inc     ax                      ; Set error code to 1
        .ENDIF
        ret
 
SetAttribute ENDP
                                    -♦-