- 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>
127 lines
4.5 KiB
C++
127 lines
4.5 KiB
C++
// BDE - (C) Copyright 1995 by Borland International
|
|
|
|
// session.c
|
|
#include "snipit.h"
|
|
|
|
//=====================================================================
|
|
// Function:
|
|
// SessionIO();
|
|
//
|
|
// Description:
|
|
// This example will demonstrate how to start more than one
|
|
// session. The example also shows how to switch between
|
|
// sessions.
|
|
//=====================================================================
|
|
void
|
|
SessionIO (void)
|
|
{
|
|
DBIResult rslt; // Value returned from IDAPI functions
|
|
phDBISes phSession = NULL; // Handle to the session
|
|
pSESInfo pSesInfo = NULL; // Session descriptor
|
|
UINT16 i; // Loop variable
|
|
const UINT uNumOfSessions = 4 ; // The number of sessions to open
|
|
|
|
Screen("*** Session I/O Example ***\r\n");
|
|
|
|
BREAK_IN_DEBUGGER();
|
|
|
|
Screen(" Initializing IDAPI...\r\n");
|
|
|
|
rslt = DbiInit(NULL);
|
|
if (ChkRslt(rslt, "Init") != DBIERR_NONE)
|
|
{
|
|
Screen("\r\n*** End of Example ***");
|
|
return;
|
|
}
|
|
|
|
// Turn on trace information if the debug layer is anabled (DLLSWAP.EXE).
|
|
DbiDebugLayerOptions(DEBUGON | OUTPUTTOFILE, "SNIPIT.INF");
|
|
|
|
// Specify where temporary files are placed.
|
|
rslt = DbiSetPrivateDir(szPrivDirectory);
|
|
ChkRslt(rslt, "SetPrivateDir");
|
|
|
|
// Allocate memory for uNumOfSessions sessions. These
|
|
// will be pointers to sessions once we start them.
|
|
phSession = (phDBISes) malloc(uNumOfSessions * sizeof(hDBISes));
|
|
// Allocate memory for the session information pointers.
|
|
pSesInfo = (pSESInfo) malloc(uNumOfSessions * sizeof(SESInfo));
|
|
if ((phSession == NULL) || (pSesInfo == NULL))
|
|
{
|
|
if (phSession) free(phSession);
|
|
if (pSesInfo) free(pSesInfo);
|
|
Screen(" Error - Out of memory");
|
|
DbiDebugLayerOptions(0, NULL);
|
|
rslt = DbiExit();
|
|
ChkRslt(rslt, "Exit");
|
|
Screen("\r\n*** End of Example ***");
|
|
return;
|
|
}
|
|
|
|
// Acquire the initial session handle. A session is started for you
|
|
// when the engine is initialized.
|
|
Screen(" Getting session #1 (opened automatically by DbiInit)...");
|
|
|
|
rslt = DbiGetCurrSession( &(phSession[0]) );
|
|
ChkRslt(rslt, "GetCurrSession");
|
|
|
|
// Start 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=0; i<(uNumOfSessions - 1); i++)
|
|
{
|
|
Screen("\r\n Opening session #%d...",i+2);
|
|
rslt = DbiStartSession("", &(phSession[i+1]), NULL);
|
|
ChkRslt(rslt, "StartSession");
|
|
}
|
|
|
|
// Now iterate through each of the sessions and 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=0; i<uNumOfSessions; i++)
|
|
{
|
|
Screen("\r\n Setting session #%d as the current session...",i+1);
|
|
rslt = DbiSetCurrSession(phSession[i]);
|
|
ChkRslt(rslt, "SetCurrSession");
|
|
|
|
Screen(" Getting session information...");
|
|
rslt = DbiGetSesInfo( &(pSesInfo[i]) );
|
|
ChkRslt(rslt, "GetSesInfo");
|
|
|
|
Screen(" Open databases: %d, Open cursors: %d",
|
|
pSesInfo[i].iDatabases, pSesInfo[i].iCursors);
|
|
}
|
|
|
|
// Close the sessions.
|
|
Screen("\r\n 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=0; i<(uNumOfSessions-1); i++)
|
|
{
|
|
// 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.)
|
|
Screen("\r\n Closing session #%d...",i+2);
|
|
|
|
rslt = DbiCloseSession(phSession[i+1]);
|
|
ChkRslt(rslt, "CloseSession");
|
|
}
|
|
|
|
// Release the memory used to hold the session handles.
|
|
free(phSession);
|
|
|
|
// Release the memory used to store information about the session.
|
|
free(pSesInfo);
|
|
|
|
// Turn off trace information.
|
|
DbiDebugLayerOptions(0, NULL);
|
|
|
|
Screen("\r\n Closing session #1 (done during DbiExit)");
|
|
Screen("\r\n Clean up IDAPI...");
|
|
rslt = DbiExit();
|
|
ChkRslt(rslt, "Exit");
|
|
|
|
Screen("\r\n*** End of Example ***");
|
|
}
|