home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / LOCKFILE.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  2.0 KB  |  91 lines

  1. ;/*
  2. ;** lockfile.asm
  3. ;** contains:    LockFile(), unlkfile()
  4. ;*/
  5.  
  6. LOCKUNLOCK        equ    05ch        ;Lock/Unlock Dos Function number
  7. FLOCK            equ    0        ;Lock Subfunction (AL)
  8. UNLOCK            equ    1        ;Unlock Subfunction (AL)
  9. DOSCALL         equ    021h        ;DOS Software Interrupt
  10.  
  11.         include model.h
  12.         include prologue.h
  13.  
  14.         pseg    cLockUnlock
  15.  
  16. ;/*
  17. ;**  int
  18. ;** LockFile(int filehandle, long offset, long length)
  19. ;**
  20. ;** ARGUMENT(s)
  21. ;**    filehandle    -    dos file handle
  22. ;**    offset        -    starting offset of locked region
  23. ;**    length        -    length of locked region
  24. ;**
  25. ;** DESCRIPTION
  26. ;**  Locks range of bytes in an opened file.
  27. ;**
  28. ;**
  29. ;** RETURNS
  30. ;**  0 if successful else a dos error code
  31. ;**
  32. ;** AUTHOR
  33. ;**  "" Fri 11-Nov-1988 15:51:51
  34. ;**   Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
  35. ;**
  36. ;** MODIFICATIONS
  37. ;**
  38. ;*/
  39.         cproc    LockFile
  40.         mov    ax,LOCKUNLOCK*256+FLOCK ;DOS function number
  41.         mov    bx,parm1_        ;BX=File handle
  42.         mov    dx,parm2_        ;DX=low word of offset
  43.         mov    cx,parm3_        ;CX=high word of offset
  44.         mov    di,parm4_        ;DI=low word of lengtgh
  45.         mov    si,parm5_        ;SI=high word of length
  46.         int    DOSCALL
  47.         jc    lockexit
  48.         xor    ax,ax
  49. lockexit:
  50.         cproce
  51.  
  52.  
  53.  
  54. ;/*
  55. ;**  int
  56. ;** unlkfile(int filehandle, long offset, long length)
  57. ;**
  58. ;** ARGUMENT(s)
  59. ;**    filehandle    -    dos file handle
  60. ;**    offset        -    starting offset of locked region
  61. ;**    length        -    length of locked region
  62. ;**
  63. ;** DESCRIPTION
  64. ;**  Unlocks a range of bytes in an opened file.
  65. ;**
  66. ;**
  67. ;** RETURNS
  68. ;**  0 if successful else a dos error code
  69. ;**
  70. ;** AUTHOR
  71. ;**  "" Fri 11-Nov-1988 15:51:51
  72. ;**   Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
  73. ;**
  74. ;** MODIFICATIONS
  75. ;**
  76. ;*/
  77.         cproc    unlkfile
  78.         mov    ax,LOCKUNLOCK*256+UNLOCK ;DOS function number
  79.         mov    bx,parm1_        ;BX=File handle
  80.         mov    dx,parm2_        ;DX=low word of offset
  81.         mov    cx,parm3_        ;CX=high word of offset
  82.         mov    di,parm4_        ;DI=low word of lengtgh
  83.         mov    si,parm5_        ;SI=high word of length
  84.         int    DOSCALL
  85.         jc    unlockexit
  86.         xor    ax,ax
  87. unlockexit:
  88.         cproce
  89.         endps
  90.         end
  91.