2012-11-26 16:26:15 +01:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
///////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2013-08-10 19:47:40 +02:00
|
|
|
|
#ifdef LANG_RUS
|
2012-11-26 16:26:15 +01:00
|
|
|
|
char *rezult_text[]={
|
2013-08-10 19:47:40 +02:00
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ᯥ譮 <20><><EFBFBD><EFBFBD><EFBFBD>襭<EFBFBD>",
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IOCTL, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ࠧ<><E0A0A7><EFBFBD> <20>।<EFBFBD><E0A5A4>⠢<EFBFBD>塞<EFBFBD><EFA5AC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...",
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪠ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> 0 <20><> 9",
|
|
|
|
|
"ࠧ<EFBFBD><EFBFBD><EFBFBD> ᮧ<><E1AEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪠ 誮<E1ABA8> <20><><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
"ࠧ<EFBFBD><EFBFBD><EFBFBD> ᮧ<><E1AEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪠ 誮<E1ABA8> <20><><EFBFBD>",
|
|
|
|
|
"<EFBFBD>訡<EFBFBD><EFBFBD> <20>뤥<EFBFBD><EBA4A5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
|
|
|
|
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭠<EFBFBD> <20>訡<EFBFBD><E8A8A1> O_o",
|
2012-11-26 16:26:15 +01:00
|
|
|
|
0};
|
2013-08-10 19:47:40 +02:00
|
|
|
|
#else
|
2012-11-26 16:26:15 +01:00
|
|
|
|
char *rezult_text[]={
|
2013-03-05 19:50:47 +01:00
|
|
|
|
"operation completed successfully",
|
2012-11-26 16:26:15 +01:00
|
|
|
|
"unknown IOCTL code, wrong input/output size...",
|
|
|
|
|
"DiskId must be from 0 to 9",
|
|
|
|
|
"DiskSize is too large",
|
2013-03-05 19:50:47 +01:00
|
|
|
|
"DiskSize is too small, might be too little free RAM",
|
2012-11-26 16:26:15 +01:00
|
|
|
|
"memory allocation failed",
|
|
|
|
|
"unknown error O_o",
|
|
|
|
|
0};
|
2013-08-10 19:47:40 +02:00
|
|
|
|
#endif
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-03-01 14:00:21 +01:00
|
|
|
|
char Console_Work()
|
2012-11-26 16:26:15 +01:00
|
|
|
|
{
|
|
|
|
|
unsigned int disk_size, driver_rezult;
|
|
|
|
|
char size_t[256];
|
|
|
|
|
|
|
|
|
|
strlwr(#param);
|
2013-08-23 00:10:32 +02:00
|
|
|
|
// debug(#param);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
|
|
|
|
switch (param[0])
|
|
|
|
|
{
|
|
|
|
|
case '?': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
case 'h':
|
|
|
|
|
debug("tmpdisk command line parameters:");
|
|
|
|
|
debug("a[number]s[size in MB] - add RAM disk");
|
|
|
|
|
debug("d[number] - delete RAM disk");
|
|
|
|
|
ExitProcess();
|
|
|
|
|
break;
|
|
|
|
|
case 'd': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
debug("trying to delete disk");
|
|
|
|
|
del_disk.DiskId = param[1]-'0';
|
|
|
|
|
ioctl.handle = driver_handle;
|
|
|
|
|
ioctl.io_code = DEV_DEL_DISK;
|
|
|
|
|
ioctl.input = #del_disk;
|
|
|
|
|
ioctl.inp_size = sizeof(del_disk);
|
|
|
|
|
ioctl.output = 0;
|
|
|
|
|
ioctl.out_size = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 'a': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
debug("trying to add disk");
|
|
|
|
|
disk_size= strchr(#param, 's');
|
|
|
|
|
if (!disk_size)
|
|
|
|
|
{
|
|
|
|
|
add_disk.DiskSize = GetFreeRAM() / 5;
|
|
|
|
|
debug("disk size is not specified");
|
|
|
|
|
strcpy(#size_t, "10% from free RAM will be used, new DiskSize: ");
|
2012-12-15 16:56:24 +01:00
|
|
|
|
strcat(#size_t, itoa(add_disk.DiskSize/2048));
|
2012-11-26 16:26:15 +01:00
|
|
|
|
strcat(#size_t, " MB");
|
|
|
|
|
debug(#size_t);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
add_disk.DiskSize = atoi(#param+disk_size)*2048;
|
|
|
|
|
|
|
|
|
|
add_disk.DiskId = param[1]-'0';
|
|
|
|
|
ioctl.handle = driver_handle;
|
|
|
|
|
ioctl.io_code = DEV_ADD_DISK;
|
|
|
|
|
ioctl.input = #add_disk;
|
|
|
|
|
ioctl.inp_size = sizeof(add_disk);
|
|
|
|
|
ioctl.output = 0;
|
|
|
|
|
ioctl.out_size = 0;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
debug("unknown command line parameters");
|
|
|
|
|
debug("use 'h' or '?' for help");
|
|
|
|
|
ExitProcess();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
driver_rezult = RuleDriver(#ioctl);
|
|
|
|
|
if (driver_rezult<7) debug(rezult_text[driver_rezult]);
|
2013-03-01 14:00:21 +01:00
|
|
|
|
return driver_rezult;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
|
|
|
|
|