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
107
ba/autorun.cpp
107
ba/autorun.cpp
@ -17,6 +17,10 @@ extern "C"
|
|||||||
static HINSTANCE _hInstance = NULL;
|
static HINSTANCE _hInstance = NULL;
|
||||||
static int _dongle_type = 0;
|
static int _dongle_type = 0;
|
||||||
|
|
||||||
|
/****************************/
|
||||||
|
/* Utility */
|
||||||
|
/****************************/
|
||||||
|
|
||||||
void ErrorBox(LPCSTR str)
|
void ErrorBox(LPCSTR str)
|
||||||
{
|
{
|
||||||
MessageBox(GetFocus(), str, "Installazione", MB_ICONSTOP|MB_OK);
|
MessageBox(GetFocus(), str, "Installazione", MB_ICONSTOP|MB_OK);
|
||||||
@ -27,6 +31,19 @@ void WarningBox(LPCSTR str)
|
|||||||
MessageBox(GetFocus(), str, "Installazione", MB_ICONEXCLAMATION|MB_OK);
|
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 */
|
/* Gestione chiave Hardlock */
|
||||||
/****************************/
|
/****************************/
|
||||||
@ -79,37 +96,48 @@ unsigned short EutronLogin(int& year)
|
|||||||
{
|
{
|
||||||
unsigned short serno = 0xFFFF;
|
unsigned short serno = 0xFFFF;
|
||||||
|
|
||||||
KEY_NET eutron_key;
|
const char* const login[2] = { "AGA.CAMPO", "25EBAI" };
|
||||||
memset(&eutron_key, 0, sizeof(KEY_NET));
|
for (int i = 0; i < 2; i++)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
eutron_key.net_command = NET_KEY_ACCESS;
|
KEY_NET eutron_key;
|
||||||
eutron_key.command = BLOCK_READING_MODE;
|
memset(&eutron_key, 0, sizeof(KEY_NET));
|
||||||
short* pointer = (short*)(&eutron_key.data[0]);
|
eutron_key.net_command = NET_KEY_OPEN;
|
||||||
short* number = (short*)(&eutron_key.data[2]);
|
eutron_key.command = LOCATING_MODE;
|
||||||
*pointer = 0; // Posizione in cui leggere
|
|
||||||
*number = 8; // Words da leggere
|
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);
|
smartlink(&eutron_key);
|
||||||
if (eutron_key.status == ST_OK)
|
if (eutron_key.status == ST_OK)
|
||||||
{
|
{
|
||||||
serno = (unsigned short)atol((const char*)eutron_key.data+4);
|
eutron_key.net_command = NET_KEY_ACCESS;
|
||||||
const unsigned short y = *(unsigned short*)(eutron_key.data+12);
|
eutron_key.command = BLOCK_READING_MODE;
|
||||||
if (y > 2000 && y < 3000)
|
short* pointer = (short*)(&eutron_key.data[0]);
|
||||||
year = y;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,9 +148,7 @@ unsigned short EutronLogin(int& year)
|
|||||||
/* Gestione cifratura lista codici */
|
/* Gestione cifratura lista codici */
|
||||||
/***********************************/
|
/***********************************/
|
||||||
|
|
||||||
static char key[16] = "";
|
void BuildKey(char* key)
|
||||||
|
|
||||||
void BuildKey()
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
key[i] = 'A'+ rand()%26;
|
key[i] = 'A'+ rand()%26;
|
||||||
@ -130,27 +156,16 @@ void BuildKey()
|
|||||||
|
|
||||||
void DecodeString(char* data)
|
void DecodeString(char* data)
|
||||||
{
|
{
|
||||||
|
char key[8] = "";
|
||||||
|
BuildKey(key);
|
||||||
|
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
BuildKey();
|
|
||||||
for (int i = 0; data[i]; i++)
|
for (int i = 0; data[i]; i++)
|
||||||
tmp[i] = data[i] - (i < 8 ? key[i] : tmp[i - 8]);
|
tmp[i] = data[i] - (i < 8 ? key[i] : tmp[i - 8]);
|
||||||
tmp[i] = '\0';
|
tmp[i] = '\0';
|
||||||
strcpy(data, tmp);
|
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()
|
int VersionYear()
|
||||||
{
|
{
|
||||||
char ver[32];
|
char ver[32];
|
||||||
@ -497,8 +512,6 @@ BOOL InitApplication (HINSTANCE hinst)
|
|||||||
|
|
||||||
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow)
|
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
if (!InitApplication(hInst)) // Register window class
|
if (!InitApplication(hInst)) // Register window class
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -532,10 +545,10 @@ int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nC
|
|||||||
CreateWindow("BUTTON", prompt, dwFlags,
|
CreateWindow("BUTTON", prompt, dwFlags,
|
||||||
offx, offy+80, 300, 32, hwndDlg , (HMENU)1001, hInst, NULL );
|
offx, offy+80, 300, 32, hwndDlg , (HMENU)1001, hInst, NULL );
|
||||||
|
|
||||||
|
|
||||||
CreateWindow("BUTTON","Uscita",
|
CreateWindow("BUTTON","Uscita",
|
||||||
WS_CHILD| WS_VISIBLE,offx,offy+160,300,32, hwndDlg ,(HMENU)2,hInst,NULL );
|
WS_CHILD| WS_VISIBLE,offx,offy+160,300,32, hwndDlg ,(HMENU)2,hInst,NULL );
|
||||||
|
|
||||||
|
MSG msg;
|
||||||
while (GetMessage(&msg, NULL, 0, 0))
|
while (GetMessage(&msg, NULL, 0, 0))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user