2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
/// ===========================================================
|
|
|
|
|
|
|
|
|
|
int script_check(char file[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
kol_struct70 k70;
|
|
|
|
|
char buf[4];
|
|
|
|
|
|
|
|
|
|
k70.p00 = 0;
|
|
|
|
|
k70.p04 = 0;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
//k70.p08 = 0;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p12 = 4; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4 <20><><EFBFBD><EFBFBD><EFBFBD>
|
2013-02-16 12:25:37 +01:00
|
|
|
|
k70.p16 = (unsigned) buf;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p20 = 0;
|
|
|
|
|
k70.p21 = file;
|
|
|
|
|
|
|
|
|
|
kol_file_70(&k70);
|
|
|
|
|
|
|
|
|
|
if ( !strcmp(buf, script_sign) )
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// ===========================================================
|
|
|
|
|
|
|
|
|
|
int script_run(char exec[], char args[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
kol_struct70 k70;
|
|
|
|
|
kol_struct_BDVK bdvk;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
unsigned result, i;
|
|
|
|
|
unsigned long long filesize, pos;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
char *buf; //<2F><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
k70.p00 = 5;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
k70.p04 = k70.p12 = 0;
|
|
|
|
|
//k70.p08 = 0;
|
2013-02-16 12:25:37 +01:00
|
|
|
|
k70.p16 = (unsigned) &bdvk;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p20 = 0;
|
|
|
|
|
k70.p21 = exec;
|
|
|
|
|
|
|
|
|
|
result = kol_file_70(&k70); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if ( 0 != result )
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-02-06 13:35:58 +01:00
|
|
|
|
filesize = bdvk.p32; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
|
2017-02-06 13:35:58 +01:00
|
|
|
|
buf = malloc(filesize+256); // may fail for over 4Gb file, but impossible case
|
2010-10-17 21:50:55 +02:00
|
|
|
|
if (NULL == buf)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
buf[filesize]=0;
|
|
|
|
|
|
|
|
|
|
k70.p00 = 0;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
k70.p04 = 0;
|
|
|
|
|
//k70.p08 = 0;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p12 = filesize;
|
2013-02-16 12:25:37 +01:00
|
|
|
|
k70.p16 = (unsigned) buf;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p20 = 0;
|
|
|
|
|
k70.p21 = exec;
|
|
|
|
|
|
|
|
|
|
result = kol_file_70(&k70); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if ( 0 != result )
|
|
|
|
|
{
|
|
|
|
|
free(buf);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos = 0;
|
|
|
|
|
|
|
|
|
|
for (;;) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (pos > filesize)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
for (i=0;;i++) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if ((0x0A == buf[pos])||(0x0D == buf[pos])||(0 == buf[pos]))
|
|
|
|
|
{
|
|
|
|
|
pos++;
|
|
|
|
|
CMD[i] = '\0';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
CMD[i] = buf[pos];
|
|
|
|
|
pos++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( 0 == strlen(CMD) ) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if ('#' == CMD[0]) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
command_execute();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(buf);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// ===========================================================
|
2013-02-17 16:22:51 +01:00
|
|
|
|
|