Patch level : 2.2
Files correlati : installa.exe Ricompilazione Demo : [ ] Commento : Supportate chiavi di eutron di sviluppo git-svn-id: svn://10.65.10.50/trunk@13938 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b771db4b41
commit
b01b5d7a1c
111
ba/autorun.cpp
111
ba/autorun.cpp
@ -17,6 +17,10 @@ extern "C"
|
||||
static HINSTANCE _hInstance = NULL;
|
||||
static int _dongle_type = 0;
|
||||
|
||||
/****************************/
|
||||
/* Utility */
|
||||
/****************************/
|
||||
|
||||
void ErrorBox(LPCSTR str)
|
||||
{
|
||||
MessageBox(GetFocus(), str, "Installazione", MB_ICONSTOP|MB_OK);
|
||||
@ -27,6 +31,19 @@ void WarningBox(LPCSTR str)
|
||||
MessageBox(GetFocus(), str, "Installazione", MB_ICONEXCLAMATION|MB_OK);
|
||||
}
|
||||
|
||||
int ThisYear()
|
||||
{
|
||||
int anno = 2006;
|
||||
time_t lt;
|
||||
if (time(<) == 0)
|
||||
{
|
||||
struct tm* timeloc = localtime(<) ;
|
||||
if (timeloc != NULL)
|
||||
anno = timeloc->tm_year + 1900;
|
||||
}
|
||||
return anno;
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* Gestione chiave Hardlock */
|
||||
/****************************/
|
||||
@ -79,39 +96,50 @@ unsigned short EutronLogin(int& year)
|
||||
{
|
||||
unsigned short serno = 0xFFFF;
|
||||
|
||||
KEY_NET eutron_key;
|
||||
memset(&eutron_key, 0, sizeof(KEY_NET));
|
||||
eutron_key.net_command = NET_KEY_OPEN;
|
||||
eutron_key.command = LOCATING_MODE;
|
||||
|
||||
const char* chiaro = "AGA.CAMPO";
|
||||
char cifrato[16];
|
||||
strcpy(cifrato, chiaro);
|
||||
EncodeEutronPassword(cifrato);
|
||||
|
||||
memset(eutron_key.label, 0, LABEL_LENGTH);
|
||||
strcpy((char*)eutron_key.label, chiaro);
|
||||
memset(eutron_key.password, 0, PASSWORD_LENGTH);
|
||||
strcpy((char*)eutron_key.password, cifrato);
|
||||
|
||||
smartlink(&eutron_key);
|
||||
if (eutron_key.status == ST_OK)
|
||||
const char* const login[2] = { "AGA.CAMPO", "25EBAI" };
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
eutron_key.net_command = NET_KEY_ACCESS;
|
||||
eutron_key.command = BLOCK_READING_MODE;
|
||||
short* pointer = (short*)(&eutron_key.data[0]);
|
||||
short* number = (short*)(&eutron_key.data[2]);
|
||||
*pointer = 0; // Posizione in cui leggere
|
||||
*number = 8; // Words da leggere
|
||||
KEY_NET eutron_key;
|
||||
memset(&eutron_key, 0, sizeof(KEY_NET));
|
||||
eutron_key.net_command = NET_KEY_OPEN;
|
||||
eutron_key.command = LOCATING_MODE;
|
||||
|
||||
const char* const chiaro = login[i];
|
||||
char cifrato[16];
|
||||
strcpy(cifrato, chiaro);
|
||||
EncodeEutronPassword(cifrato);
|
||||
|
||||
memset(eutron_key.label, 0, LABEL_LENGTH);
|
||||
strcpy((char*)eutron_key.label, chiaro);
|
||||
memset(eutron_key.password, 0, PASSWORD_LENGTH);
|
||||
strcpy((char*)eutron_key.password, cifrato);
|
||||
|
||||
smartlink(&eutron_key);
|
||||
if (eutron_key.status == ST_OK)
|
||||
{
|
||||
serno = (unsigned short)atol((const char*)eutron_key.data+4);
|
||||
const unsigned short y = *(unsigned short*)(eutron_key.data+12);
|
||||
if (y > 2000 && y < 3000)
|
||||
year = y;
|
||||
eutron_key.net_command = NET_KEY_ACCESS;
|
||||
eutron_key.command = BLOCK_READING_MODE;
|
||||
short* pointer = (short*)(&eutron_key.data[0]);
|
||||
short* number = (short*)(&eutron_key.data[2]);
|
||||
*pointer = 0; // Posizione in cui leggere
|
||||
*number = 8; // Words da leggere
|
||||
smartlink(&eutron_key);
|
||||
if (eutron_key.status == ST_OK)
|
||||
{
|
||||
serno = (unsigned short)atol((const char*)eutron_key.data+4);
|
||||
if (i == 0)
|
||||
{
|
||||
const unsigned short y = *(unsigned short*)(eutron_key.data+12);
|
||||
if (y > 2000 && y < 3000)
|
||||
year = y;
|
||||
}
|
||||
else
|
||||
year = ThisYear();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return serno;
|
||||
}
|
||||
@ -120,9 +148,7 @@ unsigned short EutronLogin(int& year)
|
||||
/* Gestione cifratura lista codici */
|
||||
/***********************************/
|
||||
|
||||
static char key[16] = "";
|
||||
|
||||
void BuildKey()
|
||||
void BuildKey(char* key)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
key[i] = 'A'+ rand()%26;
|
||||
@ -130,27 +156,16 @@ void BuildKey()
|
||||
|
||||
void DecodeString(char* data)
|
||||
{
|
||||
char key[8] = "";
|
||||
BuildKey(key);
|
||||
|
||||
char tmp[256];
|
||||
BuildKey();
|
||||
for (int i = 0; data[i]; i++)
|
||||
tmp[i] = data[i] - (i < 8 ? key[i] : tmp[i - 8]);
|
||||
tmp[i] = '\0';
|
||||
strcpy(data, tmp);
|
||||
}
|
||||
|
||||
int ThisYear()
|
||||
{
|
||||
int anno = 2003;
|
||||
time_t lt;
|
||||
if (time(<) == 0)
|
||||
{
|
||||
struct tm* timeloc = localtime(<) ;
|
||||
if (timeloc != NULL)
|
||||
anno = timeloc->tm_year + 1900;
|
||||
}
|
||||
return anno;
|
||||
}
|
||||
|
||||
int VersionYear()
|
||||
{
|
||||
char ver[32];
|
||||
@ -496,9 +511,7 @@ BOOL InitApplication (HINSTANCE hinst)
|
||||
*/
|
||||
|
||||
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
{
|
||||
if (!InitApplication(hInst)) // Register window class
|
||||
return 0;
|
||||
|
||||
@ -532,10 +545,10 @@ int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nC
|
||||
CreateWindow("BUTTON", prompt, dwFlags,
|
||||
offx, offy+80, 300, 32, hwndDlg , (HMENU)1001, hInst, NULL );
|
||||
|
||||
|
||||
CreateWindow("BUTTON","Uscita",
|
||||
WS_CHILD| WS_VISIBLE,offx,offy+160,300,32, hwndDlg ,(HMENU)2,hInst,NULL );
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user