58 lines
1.2 KiB
C++
Executable File
58 lines
1.2 KiB
C++
Executable File
#include "wxinc.h"
|
|
|
|
#include "key.h"
|
|
#include "utils.h"
|
|
|
|
///////////////////////////////
|
|
// Utilities //
|
|
///////////////////////////////
|
|
static int ThisYear()
|
|
{
|
|
return wxDateTime::Now().GetYear();
|
|
}
|
|
|
|
///////////////////////////////
|
|
// Gestione chiave remota //
|
|
///////////////////////////////
|
|
|
|
|
|
unsigned short ServerLogin(int& year, const wxString& strSrvName)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
///////////////////////////////
|
|
// Gestione chiave SSA //
|
|
///////////////////////////////
|
|
|
|
unsigned short DongleLogin(int& year)
|
|
{
|
|
unsigned short serno = 0xFFFF;
|
|
bool good = true;
|
|
for (int i = 1; good; i++)
|
|
{
|
|
wxString strGroup; strGroup << i;
|
|
const CampoIniFile CampoStp("C:\\campo.stp", strGroup);
|
|
wxString strPath = CampoStp.Get("Program");
|
|
if (strPath.IsEmpty())
|
|
{
|
|
strPath = "C:\\*.ssax";
|
|
good = false;
|
|
}
|
|
else
|
|
strPath += "\\*.ssa";
|
|
if (wxDirExists(strPath.BeforeLast('\\')))
|
|
{
|
|
const wxString strSSAX = wxFindFirstFile(strPath);
|
|
const int n = strSSAX.IsEmpty() ? -1 : wxAtoi(strSSAX.AfterLast('\\'));
|
|
if (n > 1000 && n < 65000)
|
|
{
|
|
serno = n;
|
|
year = 2121;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return serno;
|
|
}
|