54 lines
1.1 KiB
C++
Executable File
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);
|
|
}
|