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

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;        Function 44H, Subfunction 09H:                      ;
  4.         ;                      IOCTL Remote Block Device Query       ;
  5.         ;                                                            ;
  6.         ;        int ioctl_block_redir(drive_ltr)                    ;
  7.         ;            int drive_ltr;                                  ;
  8.         ;                                                            ;
  9.         ;        Returns -1 for all errors, 1 if disk is remote      ;
  10.         ;        (redirected), 0 if disk is local.                   ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   ioctl_block_redir,PUBLIC
  15. parmB   drive_ltr
  16. cBegin
  17.         mov     bl,drive_ltr    ; Get drive letter.
  18.         or      bl,bl           ; Leave 0 alone.
  19.         jz      ibr
  20.         and     bl,not 20h      ; Convert letter to uppercase.
  21.         sub     bl,'A'-1        ; Convert to drive number: 'A' = 1,
  22.                                 ; 'B' = 2, etc.
  23. ibr:
  24.         mov     ax,4409h        ; Set function code, Subfunction 09H.
  25.         int     21h             ; Call MS-DOS.
  26.         mov     ax,-1           ; Assume error.
  27.         jc      ibrx            ; Branch if error, returning -1.
  28.         inc     ax              ; Set AX = 0.
  29.         test    dh,10h          ; Is bit 12 set?
  30.         jz      ibrx            ; If not, disk is local: Return 0.
  31.         inc     ax              ; Return 1 for remote disk.
  32. ibrx:
  33. cEnd
  34.