forked from KolibriOS/kolibrios
104d540920
git-svn-id: svn://kolibrios.org@975 a494cfbc-eb01-0410-851d-a64ba20cac60
207 lines
5.7 KiB
Plaintext
207 lines
5.7 KiB
Plaintext
#define ac97snd "AC97SND"
|
|
#define desktop "desktop"
|
|
#define fce "/sys/games/fce"
|
|
#define graph "graph"
|
|
#define htmlv "/sys/network/HTMLv"
|
|
#define jpegview "JpegView"
|
|
#define kvid "/sys/kvid"
|
|
#define life2 "/sys/demos/life2"
|
|
#define midamp "MIDAMP"
|
|
#define mv "MV"
|
|
#define pngview "pngview"
|
|
#define rtfread "RtfRead"
|
|
#define tinypad "TinyPad"
|
|
#define view3ds "/sys/demos/3d/view3ds"
|
|
|
|
struct f70{
|
|
dword func;
|
|
dword param1;
|
|
dword param2;
|
|
dword param3;
|
|
dword param4;
|
|
char rezerv;
|
|
dword name;
|
|
};
|
|
|
|
struct BDVK{
|
|
dword attr;
|
|
byte type_name;
|
|
byte rez1, rez2, rez3;
|
|
dword timecreate;
|
|
dword datecreate;
|
|
dword timelastaccess;
|
|
dword datelastaccess;
|
|
dword timelastedit;
|
|
dword datelastedit;
|
|
dword sizelo;
|
|
dword sizehi;
|
|
char name[518];
|
|
};
|
|
|
|
////////////////////////////
|
|
// Ïðî÷èòàòü ôàéë //
|
|
////////////////////////////
|
|
f70 read_file_70;
|
|
void ReadFile(dword pos, file_size, read_buffer, file_path)
|
|
{
|
|
read_file_70.func = 0;
|
|
read_file_70.param1 = pos;
|
|
read_file_70.param2 = 0;
|
|
read_file_70.param3 = file_size;
|
|
read_file_70.param4 = read_buffer;
|
|
read_file_70.rezerv = 0;
|
|
read_file_70.name = file_path;
|
|
$mov eax,70
|
|
$mov ebx,#read_file_70.func
|
|
$int 0x40
|
|
}
|
|
|
|
///////////////////////////
|
|
// Ïðî÷èòàòü ïàïêó //
|
|
///////////////////////////
|
|
f70 read_dir_70;
|
|
void ReadDir(dword file_count, read_buffer, read_dir_path)
|
|
{
|
|
read_dir_70.func = 1;
|
|
read_dir_70.param1 = 0;
|
|
read_dir_70.param2 = 0;
|
|
read_dir_70.param3 = file_count;
|
|
read_dir_70.param4 = read_buffer;
|
|
read_dir_70.rezerv = 0;
|
|
read_dir_70.name = read_dir_path;
|
|
$mov eax,70
|
|
$mov ebx,#read_dir_70.func
|
|
$int 0x40
|
|
}
|
|
|
|
///////////////////////////
|
|
// Çàïóñê ïðîãðàììû //
|
|
///////////////////////////
|
|
f70 run_file_70;
|
|
void RunProgram(dword run_path, run_param)
|
|
{
|
|
run_file_70.func = 7;
|
|
run_file_70.param1 =
|
|
run_file_70.param3 =
|
|
run_file_70.param4 =
|
|
run_file_70.rezerv = 0;
|
|
run_file_70.param2 = run_param;
|
|
run_file_70.name = run_path;
|
|
$mov eax,70
|
|
$mov ebx,#run_file_70.func
|
|
$int 0x40
|
|
}
|
|
|
|
///////////////////////////
|
|
// Ñîçäàíèå ïàïêè //
|
|
///////////////////////////
|
|
f70 create_dir_70;
|
|
void CreateFolder(dword new_folder_path)
|
|
{
|
|
create_dir_70.func = 9;
|
|
create_dir_70.param1 =
|
|
create_dir_70.param2 =
|
|
create_dir_70.param3 =
|
|
create_dir_70.param4 =
|
|
create_dir_70.rezerv = 0;
|
|
create_dir_70.name = new_folder_path;
|
|
$mov eax,70
|
|
$mov ebx,#create_dir_70.func
|
|
$int 0x40
|
|
}
|
|
|
|
////////////////////////////
|
|
// Óäàëåíèå ôàéëà/ïàïêè //
|
|
////////////////////////////
|
|
f70 del_file_70;
|
|
void DeleleFile(dword del_file_path)
|
|
{
|
|
del_file_70.func = 8;
|
|
del_file_70.param1 =
|
|
del_file_70.param2 =
|
|
del_file_70.param3 =
|
|
del_file_70.param4 =
|
|
del_file_70.rezerv = 0;
|
|
del_file_70.name = del_file_path;
|
|
$mov eax,70
|
|
$mov ebx,#del_file_70.func
|
|
$int 0x40
|
|
}
|
|
|
|
///////////////////////////
|
|
// Ñêîïèðîâàòü ôàéë //
|
|
///////////////////////////
|
|
f70 CopyFile_f;
|
|
inline fastcall dword CopyFile(dword EBX,ECX)
|
|
{
|
|
BDVK CopyFile_atr;
|
|
dword s=EBX, d=ECX, cBufer=0;
|
|
CopyFile_f.func = 5;
|
|
CopyFile_f.param1 = 0;
|
|
CopyFile_f.param2 = 0;
|
|
CopyFile_f.param3 = 0;
|
|
CopyFile_f.param4 = #CopyFile_atr;
|
|
CopyFile_f.rezerv = 0;
|
|
CopyFile_f.name = s;
|
|
$mov eax, 70
|
|
$mov ebx, #CopyFile_f
|
|
$int 0x40
|
|
|
|
if (!EAX)
|
|
{
|
|
cBufer = malloc(CopyFile_atr.sizelo);
|
|
ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, s);
|
|
|
|
IF (!EAX)
|
|
{
|
|
CopyFile_f.func = 2;
|
|
CopyFile_f.param1 = 0;
|
|
CopyFile_f.param2 = 0;
|
|
CopyFile_f.param3 = CopyFile_atr.sizelo;
|
|
CopyFile_f.param4 = cBufer;
|
|
CopyFile_f.rezerv = 0;
|
|
CopyFile_f.name = d;
|
|
$mov eax, 70
|
|
$mov ebx, #CopyFile_f
|
|
$int 0x40
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void Run_File(dword fpath)
|
|
{
|
|
dword extension[4], fparam[256]; byte needrun;
|
|
needrun = 1; //åñëè 1 òî íóæíî çàïóñêàòü, åñëè 0 òî íå íàäî
|
|
copystr(fpath,#fparam); //ïî-óìîë÷àíèþ ïðîãà è ïàðàìåòð ðàâíû, åñëè îêàæåòñÿ ÷òî ýòî ôàéë, ïàðàì - ñáðîñèì
|
|
copystr(fpath+strlen(fpath)-4,#extension); //óçíà¸ì ðàñøèðåíèå ôàéëà ñ êàêèì ðàáîòàåì
|
|
//òóò ìû ýòî ðàñøèðåíèå ñðàâíèìàåì, è, åñëè îíî àñîöèèðóåòñÿ ñ ïðîãîé, ïðîãà - ýòî fpath
|
|
IF (!strcmp(#extension,".skn")) copystr("desktop",fpath);
|
|
IF (!strcmp(#extension,".avi")) || (!strcmp(#extension,".mpg")) copystr(kvid,fpath);
|
|
IF (!strcmp(#extension,".htm")) || (!strcmp(#extension,"html")) copystr(htmlv,fpath);
|
|
IF (!strcmp(#extension,".3ds")) copystr(view3ds,fpath);
|
|
IF (!strcmp(#extension,".lif")) copystr(life2,fpath);
|
|
IF (!strcmp(#extension,".cvs")) copystr(graph,fpath);
|
|
IF (!strcmp(#extension,".nes")) copystr(fce,fpath);
|
|
//audio
|
|
IF (!strcmp(#extension,".mp3")) || (!strcmp(#extension,".wav")) copystr(ac97snd,fpath);
|
|
IF (!strcmp(#extension,".mid")) || (!strcmp(#extension,"midi")) copystr(midamp,fpath);
|
|
//text
|
|
IF (!strcmp(#extension,".rtf")) copystr(rtfread,fpath);
|
|
IF (!strcmp(#extension,".txt")) || (!strcmp(#extension,".inc")) ||
|
|
(!strcmp(#extension,".ini")) || (!strcmp(#extension,".dat")) ||
|
|
(!strcmp(#extension,".asm")) || (!strcmp(#extension,".cpp")) copystr(tinypad,fpath);
|
|
//èçîáðàæåíèÿ
|
|
IF (!strcmp(#extension,".gif")) || (!strcmp(#extension,".bmp")) ||
|
|
(!strcmp(#extension,".tga")) || (!strcmp(#extension,".pcx")) ||
|
|
(!strcmp(#extension,".cur")) || (!strcmp(#extension,".ico")) copystr(mv,fpath);
|
|
IF (!strcmp(#extension,".png")) copystr(pngview,fpath);
|
|
IF (!strcmp(#extension,".jpg")) || (!strcmp(#extension,"jpeg")) copystr(jpegview,fpath);
|
|
|
|
IF (!strcmp(#extension,".sys")) || (!strcmp(#extension,".drv")) ||
|
|
(!strcmp(#extension,".obj")) needrun=0; // ýòè ôàéëû íå äëÿ çàïóñêà
|
|
|
|
IF (!strcmp(fpath,#fparam)) fparam=''; //åñëè fpath íå èçìåíèëñÿ, òî ýòî òàêè, íàâåðíîå, ïðîãà, ïàðàìåòðîâ íåò.
|
|
IF (needrun == 1) RunProgram(fpath, #fparam); //çàïóñê!
|
|
}
|