Patch level : 10.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Supporto protezione software SSA git-svn-id: svn://10.65.10.50/branches/R_10_00@22586 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
565cb6c0a7
commit
b267e999d7
@ -1959,9 +1959,7 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest)
|
||||
if (input != NULL && output != NULL)
|
||||
{
|
||||
input->Read(*output);
|
||||
|
||||
wxStreamError err = output->GetLastError();
|
||||
|
||||
ok = (err == wxSTREAM_NO_ERROR);
|
||||
}
|
||||
if (input != NULL)
|
||||
|
@ -97,12 +97,18 @@ XVTDLL BOOLEAN xvt_dongle_hl_logout();
|
||||
XVTDLL BOOLEAN xvt_dongle_hl_read(unsigned short reg, unsigned short* data);
|
||||
XVTDLL BOOLEAN xvt_dongle_hl_read_block(unsigned char* data);
|
||||
XVTDLL BOOLEAN xvt_dongle_hl_write(unsigned short reg, unsigned short data);
|
||||
|
||||
XVTDLL BOOLEAN xvt_dongle_sl_crypt(unsigned short* data);
|
||||
XVTDLL BOOLEAN xvt_dongle_sl_login(const unsigned char* label, const unsigned char* password);
|
||||
XVTDLL BOOLEAN xvt_dongle_sl_logout();
|
||||
XVTDLL BOOLEAN xvt_dongle_sl_read_block(unsigned short reg, unsigned short size, unsigned short* data);
|
||||
XVTDLL BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size, const unsigned short* data);
|
||||
|
||||
XVTDLL int xvt_dongle_sa_crypt(unsigned short* data);
|
||||
XVTDLL int xvt_dongle_sa_login(const char* module);
|
||||
XVTDLL int xvt_dongle_sa_logout(const char* module);
|
||||
XVTDLL int xvt_dongle_sa_test(const char* module);
|
||||
|
||||
XVTDLL void xvt_dwin_clear(WINDOW win, COLOR col);
|
||||
XVTDLL void xvt_dwin_draw_arc(WINDOW win, const RCT* r, int sx, int sy, int ex, int ey);
|
||||
XVTDLL void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid);
|
||||
|
97
xvaga/xvt_ssa.cpp
Normal file
97
xvaga/xvt_ssa.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
#include "wxinc.h"
|
||||
#include "xvt.h"
|
||||
#include "../../ssa/h/ssadll.h"
|
||||
|
||||
#define SSA_MOD_NOTFOUND -201
|
||||
#define SSA_NO_LOGIN -301
|
||||
|
||||
static int _ssa_serial = SSA_NO_LOGIN;
|
||||
static wxString _ssa_module;
|
||||
|
||||
static const char* xvt_dongle_sa_id()
|
||||
{
|
||||
static char id[80];
|
||||
if (!*id)
|
||||
{
|
||||
char user[32], host[32];
|
||||
const int sess = xvt_sys_get_session_id();
|
||||
xvt_sys_get_user_name(user, sizeof(user));
|
||||
xvt_sys_get_host_name(host, sizeof(host));
|
||||
sprintf(id, "%s@%s:%d", user, host, sess);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
int xvt_dongle_sa_login(const char* module)
|
||||
{
|
||||
int err = _ssa_serial;
|
||||
|
||||
if (_ssa_serial < 0)
|
||||
{
|
||||
err = SSA_Login(xvt_dongle_sa_id(), "Campo");
|
||||
if (err == 0)
|
||||
err = _ssa_serial = SSA_GetNumeroSerie("Campo");
|
||||
}
|
||||
|
||||
if (_ssa_serial >= 0 && module && *module)
|
||||
{
|
||||
err = SSA_ApriModulo(xvt_dongle_sa_id(), module);
|
||||
if (err == 0)
|
||||
{
|
||||
if (!_ssa_module.IsEmpty())
|
||||
xvt_dongle_sa_logout(_ssa_module);
|
||||
_ssa_module = module;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int xvt_dongle_sa_crypt(unsigned short* data)
|
||||
{
|
||||
if (_ssa_serial < 0)
|
||||
return SSA_NO_LOGIN;
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
data[0] ^= 0xDEAD;
|
||||
data[1] ^= 0xBEEF;
|
||||
data[2] ^= 0xDEAD;
|
||||
data[3] ^= 0xBEEF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xvt_dongle_sa_logout(const char* module)
|
||||
{
|
||||
int err = SSA_NO_LOGIN;
|
||||
if (_ssa_serial >= 0)
|
||||
{
|
||||
if (module && *module)
|
||||
{
|
||||
if (_ssa_module == module)
|
||||
{
|
||||
err = SSA_ChiudiModulo(xvt_dongle_sa_id(), _ssa_module);
|
||||
_ssa_module.Empty();
|
||||
}
|
||||
else
|
||||
err = SSA_MOD_NOTFOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = SSA_Logout(xvt_dongle_sa_id(), "Campo");
|
||||
if (err == 0)
|
||||
{
|
||||
_ssa_serial = SSA_NO_LOGIN;
|
||||
_ssa_module.Empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int xvt_dongle_sa_test(const char* module)
|
||||
{
|
||||
int err = _ssa_serial;
|
||||
if (err >= 0 && module && *module)
|
||||
err = SSA_VerificaModulo("Campo", module);
|
||||
return err;
|
||||
}
|
@ -60,7 +60,7 @@ void Image2Colors(const wxImage& img, wxColour& mean, wxColour& dark, wxColour&
|
||||
light = *wxBLACK;
|
||||
double r=0, g=0, b=0;
|
||||
|
||||
const int h = img.GetHeight();
|
||||
const int h = min(img.GetWidth(), img.GetHeight());
|
||||
for (int i = 0; i < h; i++)
|
||||
{
|
||||
const wxColourBase::ChannelType cr = img.GetRed(i,i);
|
||||
|
@ -84,9 +84,9 @@ XVT_ODBC xvt_odbc_get_connection(const char* dsn, const char* usr, const char* p
|
||||
wxDb* db = new wxDb(ci->GetHenv(), true);
|
||||
|
||||
if (strDsn.Find(';') > 0)
|
||||
bSuccess = db->Open(strDsn, NULL, true);
|
||||
bSuccess = db->Open(strDsn); // Use connection string
|
||||
else
|
||||
bSuccess = db->Open(strDsn, strUsr, strPwd, true);
|
||||
bSuccess = db->Open(strDsn, strUsr, strPwd, true); // Use DSN, user and password
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user