guy 6d14e30178 Migliorato server delle chiavi di rete
git-svn-id: svn://10.65.10.50/trunk@6600 c028cbd2-c16b-5b4b-a496-9718f37d4682
1998-05-04 10:09:51 +00:00

54 lines
1.1 KiB
C++
Executable File

#include "StdAfx.h"
#include "connect.h"
#include "server.h"
int f_DongleHasModule(TConnection& conn, void* pJolly)
{
BOOL ok = FALSE;
CStringArray& argv = *(CStringArray*)pJolly;
const int argc = argv.GetSize();
if (argc > 0)
{
const int n = atoi(argv[0]) - 1;
if (n >= 0)
{
unsigned short nSize;
const unsigned short* int_tab = GetServer().Authorizations(nSize);
if (int_tab)
{
const unsigned short index = n / 16;
if (index < (nSize/2))
ok = (int_tab[index] >> (n % 16)) & 0x1;
}
}
else
ok = TRUE;
}
return conn.ReturnBool(ok);
}
int f_DongleModules(TConnection& conn, void* pJolly)
{
unsigned short nSize;
const unsigned short* int_tab = GetServer().Authorizations(nSize);
if (int_tab)
{
BYTE* buff = GetServer().GetBuffer(nSize);
memcpy(buff, int_tab, nSize);
}
return int_tab != NULL;
}
int f_DongleNumber(TConnection& conn, void* pJolly)
{
int serno = GetServer().SerialNumber();
return conn.ReturnInteger(serno);
}
int f_DongleYear(TConnection& conn, void* pJolly)
{
int year = GetServer().AssistanceYear();
return conn.ReturnInteger(year);
}