home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
t
/
tpshar20.zip
/
ABSHARE.INT
< prev
next >
Wrap
Text File
|
1992-11-23
|
2KB
|
93 lines
Unit ABShare;
{
Share & Record Locking Routines for TP 6.0, TP 7.0, & BP 7.0
Copyright (c) 1992 ABSoft - ALL RIGHTS RESERVED
1.00
1.10 Added File Mode Constants
1.11 Minor Optimizations
2.00 Updated for TP 7.0 & BP 7.0
}
{$A-,B-,D-,E-,F+,G-,I-,L-,N-,O+,R-,S-,V-,X-}
{$IFDEF VER70}
{$P-,Q-,T-,Y-}
{$ENDIF}
{$IFDEF PMODE}
{$G+}
{$ENDIF}
Interface
Const
{
FileMode Constants - use with typed or untyped files, does not affect
text files
Example:
(open a file in read only, deny none mode, without changing the
global file mode)
Var
F : File;
SaveMode : Byte;
...
Assign(F, filename);
SaveMode := FileMode;
FileMode := OnlyRead or DenyNone;
Reset(F);
FileMode := SaveMode;
...
}
OnlyRead = 0;
OnlyWrite = 1;
ReadWrite = 2;
DenyAll = 16;
DenyWrite = 32;
DenyRead = 48;
DenyNone = 64;
Function LockRec(FileHandle : Word; FilePosition, FileLength : LongInt;
UnLock : Boolean) : Word;
{
Lock or UnLock a Region of a File for exclusive access. Share must
be loaded. A call to Lock must be followed by a call to UnLock
with the same FilePosition and FileLength. Usually used with a file
opened in ReadWrite+DenyNone mode.
FileHandle - FileRec(f).Handle, f is a variable of type file
FilePosition - Offset of Region to Lock/UnLock
FileLength - Length of Region to Lock/UnLock
UnLock - True to UnLock, False to Lock
Returns:
00h - successful
01h - function number invalid
06h - invalid handle
21h - lock violation
24h - sharing buffer overflow
}
Function UpdateFile(FileHandle : Word) : Word;
{
Updates a file to disk by opening and closing a duplicate handle
FileHandle - FileRec(f).Handle, f is a variable of type file
Returns:
00h - successful
04h - too many open files (no handles available)
06h - invalid handle
}
Function ShareInstalled : Boolean;
{
Returns True if Share is Installed, otherwise False
}