home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
spoolit
/
lock.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-02-15
|
3KB
|
58 lines
{ These routines are designed for use with version 3.x of Turbo Pascal
running under DOS 3.x. These routines can be used with any typed file
(e.g. var CustFile: file of CustRec) but not with untyped or text files.
These routines may be used on Borland Database Toolbox files of type
DataFile.
Scott Bussinger
Professional Practice Systems
110 South 131st Street
Tacoma, WA 98444
Compuserve [72247,2671] }
function LockRec(var Fyle; RecNum:integer): boolean;
{ Lock record RecNum in Fyle using DOS 3.x function call. Returns
true if lock successful, false if error was detected. }
begin
inline(
$C4/$9E/>Fyle/ { LES BX,[BP][>Fyle] ; Get pointer to Turbo FIB }
$BE/$00/$00/ { MOV SI,0 ; High word of length always 0 }
$26/$8B/$47/$02/ { ES: MOV AX,[BX][2] ; Get low word of record length }
$89/$C7/ { MOV DI,AX ; Length of lock now in SI:DI }
$8B/$96/>RecNum/ { MOV DX,[BP][>RecNum] }
$F7/$E2/ { MUL DX ; RecLen times RecNum is offset }
$89/$D1/ { MOV CX,DX ; Move 32 bit result into CX:DX }
$89/$C2/ { MOV DX,AX }
$26/$8B/$1F/ { ES: MOV BX,[BX] ; Grab the file handle from FIB }
$B8/$00/$5C/ { MOV AX,$5C00 ; Record Lock function }
$CD/$21/ { INT $21 ; Call DOS }
$B0/$00/ { MOV AL,0 ; Convert carry flag to Pascal }
$72/$02/ { JC Done ; true/false }
$FE/$C0/ { INC AL}
{ Done: }
$88/$46/$0A) { MOV [BP][10],AL ; Stuff into function result }
end;
function UnlockRec(var Fyle; RecNum:integer): boolean;
{ Unlock previously locked record RecNum in Fyle using DOS 3.x function
call. Returns true if unlock successful, false if error was detected. }
begin
inline(
$C4/$9E/>Fyle/ { LES BX,[BP][>Fyle] ; Get pointer to Turbo FIB }
$BE/$00/$00/ { MOV SI,0 ; High word of length always 0 }
$26/$8B/$47/$02/ { ES: MOV AX,[BX][2] ; Get low word of record length }
$89/$C7/ { MOV DI,AX ; Length of lock now in SI:DI }
$8B/$96/>RecNum/ { MOV DX,[BP][>RecNum] }
$F7/$E2/ { MUL DX ; RecLen times RecNum is offset }
$89/$D1/ { MOV CX,DX ; Move 32 bit result into CX:DX }
$89/$C2/ { MOV DX,AX }
$26/$8B/$1F/ { ES: MOV BX,[BX] ; Grab the file handle from FIB }
$B8/$01/$5C/ { MOV AX,$5C01 ; Record Unlock function }
$CD/$21/ { INT $21 ; Call DOS }
$B0/$00/ { MOV AL,0 ; Convert carry flag to Pascal }
$72/$02/ { JC Done ; true/false }
$FE/$C0/ { INC AL}
{ Done: }
$88/$46/$0A) { MOV [BP][10],AL ; Stuff into function result }
end;