'===========================================================================
' Subject: DETECT IF SHARE IS LOADED          Date: 04-11-96 (17:59)       
'  Author: Robert Fortune                     Code: QB, PDS                
'  Origin: FidoNet QUIK_BAS Echo            Packet: DOS.ABC
'===========================================================================
'>2. Is there anyone who has experience writing multi-node doors?  Now,
'>here I am referring both to the ability for the game to be playing
'>simultaneously on multiple nodes (which DFrame does automatically), and
'>ALSO to the ability for users on multiple nodes to be playing against
'>each other.

'   I have experience writing BBS game doors that can be play simultaneously
'   on multiple nodes but they cannot play each other. I don't imagine it
'   would be very difficult to write a door that allows players to play
'   against each other while on different BBS nodes. I believe some people
'   write player's commands\incoming data to a file which the other nodes
'   can than read and act upon in real time. Does that help?
'     To determine if the BBS is multinode you can use the following
'   function to determine if DOS's TSR program SHARE is loaded and if it
'   is then your program will know that it has to lock and unlock its
'   data file(s). Some people just lock all their door's data files no
'   matter if the host BBS is multinode or not. That is up to you.

DEFINT A-Z   ' untyped variables default to type integer
' $INCLUDE: 'QB.BI'
DECLARE FUNCTION IsShare% ()
DIM SHARED InReg AS RegType, OutReg AS RegType
PRINT "The DOS Utility SHARE is ";
IF IsShare% THEN
   PRINT "loaded. Lock/Unlock your file(s) as needed."
ELSE
   PRINT "is NOT loaded. No need to lock your file(s)."
END IF
FUNCTION IsShare% STATIC
  IsShare% = -1                           ' assume Share is loaded
  RegType.ax = &H1000                     ' service 10h
  CALL Interrupt(&H2F, InReg, OutReg)     ' check for presence of SHARE
  AL = RegType.ax AND 255                 ' isolate the result in AL
  IF AL <> &HFF THEN IsShare% = 0         ' SHARE not found
END FUNCTION
