- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
(extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
BT game source (never mixed into CODE/). Round 1-3 state:
* 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
(BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
since 1996.
* BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
its binary-recorded line 400 exactly.
* BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
(Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
TeamScore=12 flagged [T4]).
* MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
(VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
the period compiler is the drift detector).
* Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
(per-TU verification sweep under authentic OPT.MAK flags).
* README: corrected roadmap - MECH.HPP is the capstone grown with the mech
TU reconstructions; BTREG.CPP green = the header-family milestone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
147 lines
5.0 KiB
ObjectPascal
147 lines
5.0 KiB
ObjectPascal
{ session.pas }
|
|
program Session;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
|
|
SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
{=====================================================================
|
|
Code: SessionIO();
|
|
|
|
Input: None.
|
|
|
|
Return: None.
|
|
|
|
Description:
|
|
This example will demonstrate how to start more than one
|
|
one session. The example also shows how to case between
|
|
sessions.
|
|
===================================================================== }
|
|
|
|
var
|
|
rslt: DBIResult; { Value returned from IDAPI functions }
|
|
i: UINT16; { Loop variable }
|
|
const
|
|
phSession: ^hDBISes = nil; { Handle to the session }
|
|
pSesInf: pSESInfo = nil; { Session descriptor }
|
|
uNumOfSessions: UINT16 = 4; { The number of sessions to open }
|
|
|
|
begin
|
|
{ Inform user that the example is running }
|
|
Screen('*** Session I/O Example ***');
|
|
|
|
Screen(' Initializing IDAPI...');
|
|
InitOutput;
|
|
rslt := ChkRslt(DbiInit(nil), DBIERR_NONE, ' Error - Init');
|
|
if (rslt <> DBIERR_NONE) then { Check if successfull }
|
|
begin
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
CloseOutput;
|
|
exit;
|
|
end;
|
|
|
|
{ Allocate memory for the uNumOfSessions amount of sessions. These
|
|
will be pointers to sessions once we start them. }
|
|
GetMem(phSession, uNumOfSessions * sizeof(hDBISes));
|
|
if not Assigned (phSession) then
|
|
begin
|
|
Screen(' Error - Out of memory.');
|
|
ChkRslt(DbiExit, DBIERR_NONE, ' Error - Exit.');
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
CloseOutput;
|
|
exit;
|
|
end;
|
|
|
|
{ Allocate memory for the session info pointers. }
|
|
GetMem(pSesInf, uNumOfSessions * sizeof(SESInfo));
|
|
if not Assigned (pSesInf) then
|
|
begin
|
|
Screen(' Error - Out of memory.');
|
|
ChkRslt(DbiExit, DBIERR_NONE, ' Error - Exit.');
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
CloseOutput;
|
|
exit;
|
|
end;
|
|
|
|
{ Acquire the initial session handle. A session is started for
|
|
you when the engine is initialized. }
|
|
Screen(' Getting session #1 (opened automatically by DbiInit)...');
|
|
ChkRslt(DbiGetCurrSession((phSession^)), DBIERR_NONE,
|
|
' Error - GetCurrSession.');
|
|
|
|
{ Starts new sessions and display the number of open sessions on the
|
|
screen. Having already opened the first one, start the second
|
|
session through the uNumOfSessions - 1 session. }
|
|
for i := 1 to (uNumOfSessions - 1) do
|
|
begin
|
|
Inc(phSession);
|
|
Screen('');
|
|
Screen(' Opening session #'+IntToStr(i+1));
|
|
ChkRslt(DbiStartSession('', phSession^, nil), DBIERR_NONE,
|
|
' Error - StartSession.');
|
|
end;
|
|
Dec(phSession,i);
|
|
|
|
{ Now itterate through each of the sessions and will get the current
|
|
settings. The settings include the session number, the number of
|
|
open databases and the number of open cursors among other things. }
|
|
for i := 1 to uNumOfSessions do
|
|
begin
|
|
Screen('');
|
|
Screen(' Setting session #'+IntToStr(i)+
|
|
' as the current session...');
|
|
ChkRslt(DbiSetCurrSession(phSession^), DBIERR_NONE,
|
|
' Error - SetCurrSession.');
|
|
Screen(' Getting Session information...');
|
|
ChkRslt(DbiGetSesInfo(pSesInf^), DBIERR_NONE,
|
|
' Error - GetSesInfo.');
|
|
Screen(' Open databases: '+IntToStr(pSesInf^.iDatabases)+
|
|
', Open Cursors: '+IntToStr(pSesInf^.iCursors));
|
|
Inc(phSession);
|
|
end;
|
|
Dec(phSession,i);
|
|
|
|
{ Close all the session and then close IDAPI. }
|
|
Screen('');
|
|
Screen(' We cannot yet close session #1 as it is the default'+
|
|
' session.');
|
|
Screen(' We will therefore close all other sessions and then close'+
|
|
' session #1.');
|
|
for i := 1 to (uNumOfSessions-1) do
|
|
begin
|
|
{ We cannot close Session #1 so we will close session #2
|
|
and on. We cannot close session #1 because it is the
|
|
default session (created with DbiInit.) }
|
|
Inc(phSession);
|
|
Screen('');
|
|
Screen(' Closing session #'+IntToStr(i+1)+'...');
|
|
ChkRslt(DbiCloseSession(phSession^), DBIERR_NONE,
|
|
' Error - CloseSession.');
|
|
end;
|
|
|
|
{ Release the memory used to hold the session handles. }
|
|
FreeMem(phSession, uNumOfSessions * sizeof(hDBISes));
|
|
|
|
{ Release the memory used to store information about the }
|
|
FreeMem(pSesInf, uNumOfSessions * sizeof(SESInfo));
|
|
|
|
Screen('');
|
|
Screen(' Closing session #1 (done during DbiExit)');
|
|
Screen('');
|
|
Screen(' Clean up IDAPI...');
|
|
ChkRslt(DbiExit, DBIERR_NONE, ' Error - Exit.');
|
|
|
|
Screen('');
|
|
CloseOutput;
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
|
|
end.
|