42 lines
841 B
C++
42 lines
841 B
C++
|
#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)
|
||
|
{
|
||
|
const WORD* int_tab = GetServer().DongleAuthorizations();
|
||
|
if (int_tab)
|
||
|
ok = (int_tab[n / 16] >> (n % 16)) & 0x1;
|
||
|
}
|
||
|
else
|
||
|
ok = TRUE;
|
||
|
}
|
||
|
return conn.ReturnBool(ok);
|
||
|
}
|
||
|
|
||
|
int f_DongleModules(TConnection& conn, void* pJolly)
|
||
|
{
|
||
|
const WORD* int_tab = GetServer().DongleAuthorizations();
|
||
|
if (int_tab)
|
||
|
{
|
||
|
BYTE* buff = GetServer().GetBuffer(8);
|
||
|
memcpy(buff, int_tab, 8);
|
||
|
}
|
||
|
return int_tab != NULL;
|
||
|
}
|
||
|
|
||
|
int f_DongleNumber(TConnection& conn, void* pJolly)
|
||
|
{
|
||
|
int serno = GetServer().DongleSerialNumber();
|
||
|
return conn.ReturnInteger(serno);
|
||
|
}
|