home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
t
/
tplan6.zip
/
LAN.DOC
< prev
next >
Wrap
Text File
|
1992-04-07
|
9KB
|
282 lines
LAN5 Unit for Turbo Pascal 5.0 & 5.5
Copyright 1989 Athens Software & Computer Info., Inc.
The LAN50 & LAN55 units provide LAN-related functions and
procedures for Turbo Pascal 5.0 & 5.5.
While the LAN5 source code is available for a $7 registration
fee, you are welcome to use LAN50.TPU or LAN55.TPU in your
applications at no charge. To receive the latest source code on
diskette, send $7 to:
Athens Software &
Computer Info., Inc.
Route 2, Box 3280
Nicholson, GA 30565
(706) 549-6912
Please specify LAN5.PAS and whether you want 5.25" or 3.5"
diskettes.
If you got this program in compressed format, you should have
received five files: LAN5.DOC, LAN50.TPU, LAN55.TPU, LANSTAT.PAS,
and FISTIES.PAS. LAN5.DOC is this text file. LAN50.TPU is the
Turbo Pascal 5.0 Unit containing LAN procedures and functions.
LAN55.TPU is the Turbo Pascal 5.5 Unit containing LAN procedures
and functions. LANSTAT.PAS is the source code for a network
status program with examples of how to use LAN5x.TPU.
FISTIES.PAS is the source for the rock/sissors/paper game using
LAN5x.
The LAN procedures and functions provided are:
PROCEDURES: FUNCTIONS:
------------------- ----------------
Lock LANinstalled
Unlock NetBIOSavailable
ShowRedirList Server
FreeRedirList Redirector
GetExtendedDosError Messenger
ShowVerboseError Receiver
ShareInstalled
Machine_name
GetRedirList
IsLocked
CarryClear
The routines are described in detail on the following pages.
(**********************************************************)
Lock Procedure
Declaration: procedure lock(var f; recnum : longint);
Description: Performs a DOS LOCK on a record so that the record
can't be read without a sharing violation.
Example: lock(DATAFILE,filepos(DATAFILE));
Notes: Sets ExtendedDOSError for use with ShowVerboseError or
your own error reporting procedure.
(**********************************************************)
UnLock Procedure
Declaration:
procedure unlock(var f; recnum : longint);
Description: Performs a DOS UNLOCK on a record so that the record
can again be read without a sharing violation.
Example: unlock(DATAFILE,filepos(DATAFILE)-1);
Note: Every Lock must be paired with an Unlock and every Unlock
with a Lock. Sets ExtendedDOSError for use with ShowVerboseError
or your own error reporting procedure.
(**********************************************************)
ShowRedirList Procedure
Declaration: procedure ShowRedirList;
Description: Lists local and network names for each device
(printers & drives) connected to the network. For printers, the
"printer setup string" is shown.
Example:
if GetRedirList>0 then
begin
FreeRedirList; {paired with GetRedirList call above}
writeln('The Redirection List is as follows:');
ShowRedirList;
end
else writeln('No devices are redirected.');
Note: ShowDirList does a GetRedirList before and a FreeDirList
after the redirection list is displayed.
(**********************************************************)
FreeRedirList Procedure
Declaration: procedure FreeRedirList;
Description: The Redirection List is kept on the heap in a 176-
byte record structure. GetRedirList allocates and initializes
this record; FreeRedirList deallocates this structure.
Note: Every GetRedirList must be paired with a FreeRedirList and
vis versa.
(**********************************************************)
GetExtendedDosError Procedure
Declaration: procedure GetExtendedDosError(regs: registers);
Description: Uses DOS function 59h to set the real variable
ExtendedDosError. I opted to map the three registers (ax, bx and
cx) into a single real variable to simplify interpretation. For
example, if DOS's SHARE is not installed and you try to do a
"lock", ExtendedError will be returned as 17236993.0. A
constant, ShareNotInstalled, is declared to be equal to this
number so a statement like "if ExtendedError=ShareNotInstalled
then writeln('DOS Share is not installed.');" can be expressed.
Example: GetExtendedError(regs);
Notes: Most of the time you won't need this procedure since it is
used automatically by the LOCK and UNLOCK procedures (and
others). ShowVerboseError tests and interprets the ExtendedError
variable.
(**********************************************************)
ShowVerboseError Procedure
Declaration:
procedure ShowVerboseError(ExtendedError: real);
Description: ShowVerboseError translates the ExtendedError
variable into English.
(**********************************************************)
LANinstalled Function
Declaration: function LANinstalled : boolean;
Description: Returns true if a LAN is installed; otherwise returns false.
(**********************************************************)
NetBIOSavailable Function
Declaration: function NetBIOSavailable : boolean;
Description: Returns true if the NetBIOS functions are available;
otherwise returns false.
(**********************************************************)
Server Function
Declaration: function Server : boolean;
Description: Returns true if this station is installed as a
server; otherwise returns false.
(**********************************************************)
Redirector Function
Declaration: function Redirector : boolean;
Description: Returns true if this station is installed as a
redirector; otherwise returns false.
(**********************************************************)
Messenger Function
Declaration: function Messenger : boolean;
Description: Returns true if this station is installed as a
messenger; otherwise returns false.
(**********************************************************)
Receiver Function
Declaration: function Receiver : boolean;
Description: Returns true if this station is installed as a
receiver; otherwise returns false.
(**********************************************************)
ShareInstalled Function
Declaration: function ShareInstalled : boolean;
Description: Returns true if SHARE is installed; otherwise
returns false.
(**********************************************************)
Machine_Name Function
Declaration: function Machine_Name:string;
Description: Returns the network name for this station.
(**********************************************************)
GetRedirList Function
Declaration: function GetRedirList : byte;
Description: Returns the number of items (printers and drives) in
the redirection list. Also allocates a 176-byte record for each
item containing the local and network device names, their types
and status as shown:
RedirListPtr = ^RedirectionType;
RedirectionType = record
AssignListIndex : word;
Device_name : string[17];
Logical_name: string[128];
{type: printer,disk_drive,unknown}
Device_type : string[10];
{status: valid,invalid,unknown}
Device_valid: string[7];
prev, next : RedirListPtr;
end;
(**********************************************************)
IsLocked Function
Declaration: function IsLocked(var f; recnum:longint);
Description: Returns true if the record is able to be read by
this station; otherwise returns false.
Notes: Sets ExtendedDosError.
(**********************************************************)
IsLockedUsingLock Function
Declaration:
function IsLockedUsingLock(var f; recnum:longint);
Description: Returns true if the record is already locked. Note
that it will temporarily lock a record if the record is not
already locked.
Notes: Sets ExtendedDosError.
(**********************************************************)
CarryClear Function
Declaration: function CarryClear(regs:registers) : boolean;
Description: Used internally by many of the other functions to
determine whether an error has occurred or not. Some of Turbo's
built-in routines change the carry flag so it was important to
have a separate function.
(**********************************************************)
Keep in touch for possible future upgrades.