home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / section5 / fxn43h.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.4 KB  |  30 lines

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;            Function 43H: Get/Set File Attributes           ;
  4.         ;                                                            ;
  5.         ;            int file_attr(pfilepath,func,attr)              ;
  6.         ;                char *pfilepath;                            ;
  7.         ;                int func,attr;                              ;
  8.         ;                                                            ;
  9.         ;            Returns -1 for all errors,                      ;
  10.         ;            otherwise returns file attribute.               ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   file_attr,PUBLIC,ds
  15. parmDP  pfilepath
  16. parmB   func
  17. parmW   attr
  18. cBegin
  19.         loadDP  ds,dx,pfilepath ; Get pointer to pathname.
  20.         mov     al,func         ; Get/set flag into AL.
  21.         mov     cx,attr         ; Get new attr (if present).
  22.         mov     ah,43h          ; Set code function.
  23.         int     21h             ; Call MS-DOS.
  24.         jnb     fa_ok           ; Branch if no error.
  25.         mov     cx,-1           ; Else return -1.
  26. fa_ok:
  27.         mov     ax,cx           ; Return this value.
  28.  
  29. cEnd
  30.