applicat.cpp Aggiunta gestione chiave di protezione di rete
codeb.c Corretta creazione nome tag delle chiavi isam.h Aggiunta put dei long double relation.cpp Corretta rewrite delle relazioni stack.cpp Aggiunto metodo remove_base stack.h Cambita derivazione da TArray a TObject stdtypes.cpp Aggiunto supporto per chiave di rete stdtypes.h Aggiunta chiamata get_serial_number(const char* ) git-svn-id: svn://10.65.10.50/trunk@4500 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fcba93ac94
commit
f9b9e70dbd
@ -393,8 +393,7 @@ const char* TApplication::get_module_name() const
|
||||
|
||||
|
||||
void TApplication::set_perms()
|
||||
{
|
||||
CGetAut(1);
|
||||
{
|
||||
_dongle_aut.set(0, TRUE);
|
||||
for (int i = 1 ; i < ENDAUT; i++)
|
||||
{
|
||||
@ -485,18 +484,18 @@ void TApplication::run(
|
||||
addbar = 0;
|
||||
_name = cmd2name(argv[0]);
|
||||
}
|
||||
|
||||
const int sn = get_serial_number();
|
||||
if (sn < 0)
|
||||
{
|
||||
error_box("Perhaps you forgot to connect the dongle");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (use_files())
|
||||
init_global_vars();
|
||||
else
|
||||
CGetPref();
|
||||
CGetPref();
|
||||
|
||||
const int sn = get_serial_number(firm_change_enabled() ? _name : "ba0100");
|
||||
if (sn < 0)
|
||||
{
|
||||
error_box("Perhaps you forgot to connect the dongle");
|
||||
return;
|
||||
}
|
||||
|
||||
set_perms();
|
||||
|
||||
|
@ -360,10 +360,12 @@ int DB_bof(int handle)
|
||||
/*-------------------------------------------------------------------------
|
||||
legge un record per numero record
|
||||
--------------------------------------------------------------------------*/
|
||||
int DB_go(int handle,long int recno)
|
||||
int DB_go(int handle,long recno)
|
||||
{
|
||||
if(dbdata[handle]==0) return(-1);
|
||||
return(x4go(&xdb[handle],recno));
|
||||
if (dbdata[handle] == 0)
|
||||
return(-1);
|
||||
// return x4go(&xdb[handle],recno);
|
||||
return d4go(dbdata[handle], recno);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -567,8 +569,11 @@ HIDDEN void do_key(char *fname, RecDes *r, TAG4INFO *tag_info, int n_keys)
|
||||
{
|
||||
int i,j;
|
||||
char tiname[9]; /* Tag name, max 8 characters long! */
|
||||
char* dot;
|
||||
|
||||
strcpy(tiname,fname);
|
||||
dot = strchr(tiname, '.');
|
||||
if (dot) *dot = '\0';
|
||||
CUpString(tiname);
|
||||
for (i=0; ((i < MaxKeys) && (i < n_keys)); i++)
|
||||
{
|
||||
|
@ -213,6 +213,12 @@ public:
|
||||
void put(const char* fieldname, TTextfile& txt);
|
||||
// @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
|
||||
void put(const char* fieldname, const char* val) { put_str(fieldname, val); }
|
||||
#endif
|
||||
|
||||
#ifdef __LONGDOUBLE__
|
||||
// @cmember Setta il contenuto del campo <p fieldname> in formato reale
|
||||
void put(const char* fieldname, long double val)
|
||||
{ put(fieldname, real(val)); }
|
||||
#endif
|
||||
|
||||
// @cmember Vuota il campo puntato da <p fieldname>
|
||||
@ -510,6 +516,12 @@ public:
|
||||
// @cmember Ritorna una stringa con il contenuto del campo <p fieldname>
|
||||
const char* get_str(const char* fieldname) const
|
||||
{ return (const char *) curr().get_str(fieldname);}
|
||||
#endif
|
||||
|
||||
#ifdef __LONGDOUBLE__
|
||||
// @cmember Setta il contenuto del campo <p fieldname> in formato reale
|
||||
void put(const char* fieldname, long double val)
|
||||
{ curr().put(fieldname, real(val)); }
|
||||
#endif
|
||||
|
||||
// @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
|
||||
|
@ -849,16 +849,17 @@ int TRelation::rewrite(bool force)
|
||||
|
||||
for (int i = 0; i < _reldefs.items(); i++)
|
||||
{
|
||||
TRelationdef& rd = reldef(i);
|
||||
TRelationdef& rd = reldef(i);
|
||||
TLocalisamfile& lf = file(rd.num());
|
||||
|
||||
if (!rd.write_enable() || lf.curr().empty())
|
||||
continue;
|
||||
|
||||
int res = lf.rewrite();
|
||||
if (force && res == _iskeynotfound)
|
||||
if (force && (res == _iskeynotfound || res == _iseof || res == _isemptyfile))
|
||||
res = lf.write();
|
||||
if (_errors == NOERR) _errors = res;
|
||||
if (_errors == NOERR)
|
||||
_errors = res;
|
||||
}
|
||||
|
||||
return _errors;
|
||||
|
@ -1,26 +1,31 @@
|
||||
#include <stack.h>
|
||||
|
||||
TStack::TStack(int size) : TArray(size), _sp(0)
|
||||
TStack::TStack(int size) : _data(size), _sp(0)
|
||||
{}
|
||||
|
||||
void TStack::push(const TObject& o)
|
||||
{
|
||||
add(o, _sp++);
|
||||
_data.add(o, _sp++);
|
||||
}
|
||||
|
||||
void TStack::push(TObject* o)
|
||||
{
|
||||
add(o, _sp++);
|
||||
_data.add(o, _sp++);
|
||||
}
|
||||
|
||||
TObject& TStack::pop()
|
||||
{
|
||||
CHECK(_sp > 0, "Stack underflow!");
|
||||
return (*this)[--_sp];
|
||||
return _data[--_sp];
|
||||
}
|
||||
|
||||
TObject& TStack::peek(int depth) const
|
||||
{
|
||||
CHECKD(depth >= 0 && depth < _sp, "Stack depth error: ", depth);
|
||||
return (*this)[_sp-depth-1];
|
||||
return _data[_sp-depth-1];
|
||||
}
|
||||
|
||||
bool TStack::destroy_base()
|
||||
{
|
||||
return _data.destroy(0, TRUE);
|
||||
}
|
||||
|
@ -9,13 +9,15 @@
|
||||
|
||||
// @class TStack | Classe per la gestione dello stack a basso livello
|
||||
//
|
||||
// @base public | TArray
|
||||
class TStack : private TArray
|
||||
// @base public | TObject
|
||||
class TStack : public TObject
|
||||
|
||||
// @author:(INTERNAL) Alex
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
{
|
||||
{
|
||||
// @cmember:(INTERNAL) Dati dello stack
|
||||
TArray _data;
|
||||
// @cmember:(INTERNAL) Puntatore alla cima dello stack
|
||||
int _sp;
|
||||
|
||||
@ -31,7 +33,9 @@ public:
|
||||
// @cmember Ritorna il primo oggetto sulla cima dello stack
|
||||
TObject& pop();
|
||||
// @cmember Ritorna l'oggetto ad una data profondita' nello stack
|
||||
TObject& peek(int depth = 0) const;
|
||||
TObject& peek(int depth = 0) const;
|
||||
// @cmember Distrugge l'oggetto alla base dello stack
|
||||
bool destroy_base();
|
||||
// @cmember Costruttore. Chiama il costruttore di <c TArray>
|
||||
TStack(int size = 16);
|
||||
// @cmember Distruttore. Chiama il distruttore di <c TArray>
|
||||
|
@ -6,13 +6,14 @@
|
||||
#include <extcdecl.h>
|
||||
#include <conf.h>
|
||||
#include <modaut.h>
|
||||
#include <isamrpc.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
#include <dos.h>
|
||||
#include <hlapi_c.h>
|
||||
#endif
|
||||
|
||||
#include <checks.h>
|
||||
#include <applicat.h>
|
||||
#include <isam.h>
|
||||
#include <prefix.h>
|
||||
#include <codeb.h>
|
||||
@ -28,17 +29,51 @@ long get_std_level()
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
static int _login_status = 0;
|
||||
|
||||
// @func Ritorna il numero di serie della chiave
|
||||
//
|
||||
// @rdesc Numero di serie della chiave
|
||||
int get_serial_number()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
|
||||
if (status != STATUS_OK)
|
||||
return -1;
|
||||
#endif
|
||||
return getser();
|
||||
int get_serial_number(const char* appname)
|
||||
{
|
||||
if (_login_status == 0)
|
||||
{
|
||||
if (HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY) == STATUS_OK)
|
||||
{
|
||||
_login_status = 1;
|
||||
getser();
|
||||
}
|
||||
}
|
||||
if (_login_status != 1)
|
||||
{
|
||||
if (_login_status == 2)
|
||||
{
|
||||
rpc_UserLogout();
|
||||
SerNo = 0xFFFF;
|
||||
}
|
||||
|
||||
TConfig ini(CONFIG_STUDIO, "Server");
|
||||
const char* server = ini.get("Name");
|
||||
const char* guest = "******";
|
||||
const char* utente = (!xvt_running() && !stricmp(appname, "ba0100")) ? guest : user();
|
||||
|
||||
if (rpc_UserLogin(server, utente, guest, appname))
|
||||
{
|
||||
_login_status = 2;
|
||||
SerNo = rpc_DongleNumber();
|
||||
}
|
||||
else
|
||||
_login_status = 0;
|
||||
}
|
||||
|
||||
switch(_login_status)
|
||||
{
|
||||
case 1 : CGetAut(1) != 0; break;
|
||||
case 2 : rpc_DongleModules(_int_tab0); break;
|
||||
default: memset(_int_tab0, 0, sizeof(_int_tab0)); break;
|
||||
}
|
||||
|
||||
return SerNo;
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -70,11 +105,6 @@ void init_global_vars()
|
||||
openrec[i] = NULL;
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
const bool muflag = CGetAut(MUAUT);
|
||||
if (SerNo && !muflag)
|
||||
fatal_box("Abnormal termination: check protection or serial number\n");
|
||||
#endif
|
||||
DB_init();
|
||||
}
|
||||
// @doc INTERNAL
|
||||
@ -83,8 +113,12 @@ void init_global_vars()
|
||||
void free_global_vars()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
HL_LOGOUT();
|
||||
if (_login_status == 2)
|
||||
rpc_UserLogout();
|
||||
else
|
||||
HL_LOGOUT();
|
||||
#endif
|
||||
|
||||
if (openf != NULL)
|
||||
{
|
||||
delete openf;
|
||||
|
@ -29,7 +29,7 @@ typedef unsigned char UINT8;
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @type UINT16 | Altro nome di assegnazione per gli unsigned short (se compilato a 32bit)
|
||||
// oppure unsigned int (se non definito M_I386)
|
||||
// oppure unsigned int (se non definito M_I386)
|
||||
typedef unsigned short UINT16;
|
||||
#else
|
||||
typedef unsigned int UINT16;
|
||||
@ -44,7 +44,7 @@ typedef unsigned long UINT32;
|
||||
typedef char INT8;
|
||||
#ifdef M_I386
|
||||
// @type INT16 | Altro nome di assegnazione per gli short (se compilato a 32bit)
|
||||
// oppure int (se non definito M_I386)
|
||||
// oppure int (se non definito M_I386)
|
||||
typedef short INT16;
|
||||
#else
|
||||
typedef int INT16;
|
||||
@ -56,7 +56,7 @@ typedef long INT32;
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @type bool | Tipo booleano che puo' assumere i valori TRUE (definito come 1)
|
||||
// e FALSE (definito come 0).
|
||||
// e FALSE (definito come 0).
|
||||
typedef UINT8 bool;
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -73,14 +73,15 @@ typedef UINT8 byte;
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @type KEY | Tipo per la definizione di variabili destinati a contenere i caratteri
|
||||
// immessi da tastiera
|
||||
// immessi da tastiera
|
||||
typedef UINT16 KEY;
|
||||
|
||||
#define UNDEFINED -32767
|
||||
|
||||
#undef _SVID
|
||||
|
||||
int get_serial_number();
|
||||
int get_serial_number(const char* appname);
|
||||
|
||||
long get_std_level();
|
||||
void init_global_vars();
|
||||
void free_global_vars();
|
||||
|
Loading…
x
Reference in New Issue
Block a user