home *** CD-ROM | disk | FTP | other *** search
- ;/*
- ;** lockfile.asm
- ;** contains: LockFile(), unlkfile()
- ;*/
-
- LOCKUNLOCK equ 05ch ;Lock/Unlock Dos Function number
- FLOCK equ 0 ;Lock Subfunction (AL)
- UNLOCK equ 1 ;Unlock Subfunction (AL)
- DOSCALL equ 021h ;DOS Software Interrupt
-
- include model.h
- include prologue.h
-
- pseg cLockUnlock
-
- ;/*
- ;** int
- ;** LockFile(int filehandle, long offset, long length)
- ;**
- ;** ARGUMENT(s)
- ;** filehandle - dos file handle
- ;** offset - starting offset of locked region
- ;** length - length of locked region
- ;**
- ;** DESCRIPTION
- ;** Locks range of bytes in an opened file.
- ;**
- ;**
- ;** RETURNS
- ;** 0 if successful else a dos error code
- ;**
- ;** AUTHOR
- ;** "" Fri 11-Nov-1988 15:51:51
- ;** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- ;**
- ;** MODIFICATIONS
- ;**
- ;*/
- cproc LockFile
- mov ax,LOCKUNLOCK*256+FLOCK ;DOS function number
- mov bx,parm1_ ;BX=File handle
- mov dx,parm2_ ;DX=low word of offset
- mov cx,parm3_ ;CX=high word of offset
- mov di,parm4_ ;DI=low word of lengtgh
- mov si,parm5_ ;SI=high word of length
- int DOSCALL
- jc lockexit
- xor ax,ax
- lockexit:
- cproce
-
-
-
- ;/*
- ;** int
- ;** unlkfile(int filehandle, long offset, long length)
- ;**
- ;** ARGUMENT(s)
- ;** filehandle - dos file handle
- ;** offset - starting offset of locked region
- ;** length - length of locked region
- ;**
- ;** DESCRIPTION
- ;** Unlocks a range of bytes in an opened file.
- ;**
- ;**
- ;** RETURNS
- ;** 0 if successful else a dos error code
- ;**
- ;** AUTHOR
- ;** "" Fri 11-Nov-1988 15:51:51
- ;** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- ;**
- ;** MODIFICATIONS
- ;**
- ;*/
- cproc unlkfile
- mov ax,LOCKUNLOCK*256+UNLOCK ;DOS function number
- mov bx,parm1_ ;BX=File handle
- mov dx,parm2_ ;DX=low word of offset
- mov cx,parm3_ ;CX=high word of offset
- mov di,parm4_ ;DI=low word of lengtgh
- mov si,parm5_ ;SI=high word of length
- int DOSCALL
- jc unlockexit
- xor ax,ax
- unlockexit:
- cproce
- endps
- end
-