1994-08-12 10:52:49 +00:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#define __STDTYPES_CPP
|
|
|
|
|
|
|
|
|
|
#include <extcdecl.h>
|
|
|
|
|
#include <conf.h>
|
|
|
|
|
#include <modaut.h>
|
|
|
|
|
|
|
|
|
|
#if XVT_OS != XVT_OS_SCOUNIX
|
|
|
|
|
#include <dos.h>
|
|
|
|
|
#include <hlapi_c.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <checks.h>
|
|
|
|
|
#include <isam.h>
|
1994-12-07 11:10:57 +00:00
|
|
|
|
#include <prefix.h>
|
1994-08-12 10:52:49 +00:00
|
|
|
|
|
|
|
|
|
#define REFKEY "CAMPOKEY"
|
|
|
|
|
#define VERKEY "<22>pو<70>c<EFBFBD><"
|
|
|
|
|
|
1994-09-27 10:12:15 +00:00
|
|
|
|
long stdlevel ;
|
1994-08-12 10:52:49 +00:00
|
|
|
|
|
1994-12-07 11:10:57 +00:00
|
|
|
|
int get_serial_number()
|
|
|
|
|
{
|
|
|
|
|
#if XVT_OS != XVT_OS_SCOUNIX
|
|
|
|
|
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
|
|
|
|
|
if (status != STATUS_OK)
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
|
|
|
|
return getser();
|
|
|
|
|
}
|
|
|
|
|
|
1994-08-12 10:52:49 +00:00
|
|
|
|
void init_global_vars()
|
|
|
|
|
{
|
|
|
|
|
CHECK(prefhndl == NULL, "Can't init global vars two times");
|
1994-09-27 10:12:15 +00:00
|
|
|
|
prefhndl = new TPrefix;
|
1994-11-15 11:23:24 +00:00
|
|
|
|
|
|
|
|
|
// prefhndl->set("DEF");
|
1994-09-27 10:12:15 +00:00
|
|
|
|
prefhndl->set("");
|
|
|
|
|
stdlevel = prefhndl->filelevel();
|
|
|
|
|
|
|
|
|
|
FileDes d;
|
|
|
|
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
|
|
|
|
|
|
|
|
|
long maxfdir = d.EOX;
|
|
|
|
|
prefhndl->set("DEF");
|
|
|
|
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
|
|
|
|
if (d.EOD > maxfdir) maxfdir = d.EOD;
|
1994-08-12 10:52:49 +00:00
|
|
|
|
|
1994-09-27 10:12:15 +00:00
|
|
|
|
// isjournal = *((bool *) CGetConf(JOURNALING));
|
1994-08-12 10:52:49 +00:00
|
|
|
|
isjournal = FALSE;
|
|
|
|
|
|
1994-09-27 10:12:15 +00:00
|
|
|
|
openf = new isfdptr[maxfdir];
|
|
|
|
|
openrec = new TRectype*[maxfdir];
|
|
|
|
|
|
|
|
|
|
for (long i = 0; i < maxfdir; i++)
|
|
|
|
|
{
|
|
|
|
|
openf[i] = NULL;
|
|
|
|
|
openrec[i] = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1994-08-12 10:52:49 +00:00
|
|
|
|
#if XVT_OS == XVT_OS_SCOUNIX
|
1994-11-07 16:32:57 +00:00
|
|
|
|
const bool muflag = CGetAut(MUAUT);
|
|
|
|
|
if (SerNo /* && fexist("net.ini") */ && !muflag)
|
1994-09-27 10:12:15 +00:00
|
|
|
|
fatal_box("Abnormal termination: check protection or serial number\n");
|
1994-08-12 10:52:49 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void free_global_vars()
|
1994-12-07 11:10:57 +00:00
|
|
|
|
{
|
1994-08-12 10:52:49 +00:00
|
|
|
|
#if XVT_OS != XVT_OS_SCOUNIX
|
1994-09-27 10:12:15 +00:00
|
|
|
|
HL_LOGOUT();
|
1994-08-12 10:52:49 +00:00
|
|
|
|
#endif
|
1994-12-07 11:10:57 +00:00
|
|
|
|
if (prefhndl != NULL)
|
|
|
|
|
{
|
|
|
|
|
delete openf;
|
|
|
|
|
delete openrec;
|
|
|
|
|
delete prefhndl;
|
|
|
|
|
}
|
1994-08-12 10:52:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FOXPRO
|
|
|
|
|
#include <xvt.h>
|
|
|
|
|
|
|
|
|
|
void* operator new(size_t size)
|
|
|
|
|
{
|
|
|
|
|
void* mem = (void*)xvt_fmalloc(size);
|
|
|
|
|
if (mem == NULL)
|
|
|
|
|
fatal_box("Out of memory: can't allocate %u bytes", size);
|
1994-09-27 10:12:15 +00:00
|
|
|
|
return mem;
|
1994-08-12 10:52:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void operator delete(void* ptr)
|
|
|
|
|
{
|
|
|
|
|
CHECK(ptr, "Can't delete a NULL pointer!");
|
|
|
|
|
xvt_ffree((char*)ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // FOXPRO
|