43 lines
		
	
	
		
			934 B
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			934 B
		
	
	
	
		
			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;
 | 
						|
		const unsigned short* int_tab = GetServer().Authorizations();
 | 
						|
		if (int_tab)
 | 
						|
			ok = (int_tab[n / 16] >> (n % 16)) & 0x1;
 | 
						|
	}
 | 
						|
	return conn.ReturnBool(ok);
 | 
						|
}
 | 
						|
 | 
						|
int f_DongleModules(TConnection& conn, void* pJolly)
 | 
						|
{
 | 
						|
	const unsigned short* int_tab = GetServer().Authorizations();
 | 
						|
	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().SerialNumber();
 | 
						|
	return conn.ReturnInteger(serno);
 | 
						|
}
 | 
						|
 | 
						|
int f_DongleYear(TConnection& conn, void* pJolly)
 | 
						|
{
 | 
						|
    int year = GetServer().AssistanceYear();
 | 
						|
    return conn.ReturnInteger(year);
 | 
						|
}
 |