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

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;            Function 5CH: Lock/Unlock File Region           ;
  4.         ;                                                            ;
  5.         ;            int locks(handle,onoff,start,length)            ;
  6.         ;                int handle,onoff;                           ;
  7.         ;                long start,length;                          ;
  8.         ;                                                            ;
  9.         ;            Returns 0 if operation was successful,          ;
  10.         ;            otherwise returns error code.                   ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   locks,PUBLIC,<si,di>
  15. parmW   handle
  16. parmB   onoff
  17. parmD   start
  18. parmD   length
  19. cBegin
  20.         mov     al,onoff        ; Get lock/unlock flag.
  21.         mov     bx,handle       ; Get file handle.
  22.         les     dx,start        ; Get low word of start.
  23.         mov     cx,es           ; Get high word of start.
  24.         les     di,length       ; Get low word of length.
  25.         mov     si,es           ; Get high word of length.
  26.         mov     ah,5ch          ; Set function code.
  27.         int     21h             ; Make lock/unlock request.
  28.         jb      lk_err          ; Branch on error.
  29.         xor     ax,ax           ; Return 0 if no error.
  30. lk_err:
  31. cEnd
  32.