2015-11-05 23:49:42 +03:00
|
|
|
#ifndef INCLUDE_LIBFS_H
|
|
|
|
#define INCLUDE_LIBFS_H
|
|
|
|
#print "[include <obj/fs.h>]\n"
|
|
|
|
|
|
|
|
#ifndef INCLUDE_KOLIBRI_H
|
|
|
|
#include "../lib/kolibri.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INCLUDE_DLL_H
|
|
|
|
#include "../lib/dll.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
:struct FILE_SYSTEM_FUNCTION
|
|
|
|
{
|
|
|
|
dword remove_pointer;
|
|
|
|
byte remove(dword path);
|
|
|
|
|
2015-11-26 13:53:50 +03:00
|
|
|
dword open_pointer;
|
|
|
|
dword open(dword path);
|
|
|
|
|
2015-11-06 17:49:37 +03:00
|
|
|
dword read_pointer;
|
|
|
|
dword read(dword path);
|
|
|
|
|
2015-11-06 21:11:25 +03:00
|
|
|
dword run_pointer;
|
|
|
|
dword run(dword path,arg);
|
|
|
|
|
2015-11-05 23:49:42 +03:00
|
|
|
dword move_pointer;
|
|
|
|
byte move(dword path1,path2);
|
|
|
|
|
|
|
|
dword copy_pointer;
|
|
|
|
byte copy(dword path1,path2);
|
|
|
|
|
2015-11-26 13:53:50 +03:00
|
|
|
dword write_pointer;
|
|
|
|
byte write(dword path1,path2,path3);
|
|
|
|
|
2015-11-05 23:49:42 +03:00
|
|
|
dword get_size_pointer;
|
|
|
|
qword get_size(dword path);
|
2015-11-08 01:35:31 +03:00
|
|
|
|
2015-11-26 13:53:50 +03:00
|
|
|
dword callback_copy_pointer;
|
|
|
|
byte callback_copy(dword path1,path2,ptr);
|
2015-11-05 23:49:42 +03:00
|
|
|
} fs;
|
|
|
|
|
|
|
|
:byte FILE_SYSTEM_FUNCTION::remove(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
2015-11-08 00:33:00 +03:00
|
|
|
lib_init_fs();
|
2015-11-05 23:49:42 +03:00
|
|
|
remove_pointer stdcall(tmp);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-06 17:49:37 +03:00
|
|
|
:dword FILE_SYSTEM_FUNCTION::read(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
2015-11-08 00:33:00 +03:00
|
|
|
lib_init_fs();
|
2015-11-06 17:49:37 +03:00
|
|
|
read_pointer stdcall(tmp);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-26 13:53:50 +03:00
|
|
|
:byte FILE_SYSTEM_FUNCTION::write(dword path1,path2,path3)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = path2;
|
|
|
|
dword tmp3 = path3;
|
|
|
|
lib_init_fs();
|
|
|
|
write_pointer stdcall(tmp1,tmp2,tmp3);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-06 21:11:25 +03:00
|
|
|
:dword FILE_SYSTEM_FUNCTION::run(dword path,arg)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = arg;
|
2015-11-08 00:33:00 +03:00
|
|
|
lib_init_fs();
|
2015-11-06 21:11:25 +03:00
|
|
|
run_pointer stdcall(tmp1,tmp2);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-05 23:49:42 +03:00
|
|
|
:qword FILE_SYSTEM_FUNCTION::get_size(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
2015-11-08 00:33:00 +03:00
|
|
|
lib_init_fs();
|
2015-11-26 13:53:50 +03:00
|
|
|
//get_size_pointer stdcall(tmp);
|
|
|
|
$push tmp
|
|
|
|
$call get_size_pointer
|
|
|
|
$add esi,4
|
|
|
|
}
|
|
|
|
|
|
|
|
:dword FILE_SYSTEM_FUNCTION::open(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
|
|
|
lib_init_fs();
|
|
|
|
open_pointer stdcall(tmp);
|
2015-11-05 23:49:42 +03:00
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
:byte FILE_SYSTEM_FUNCTION::move(dword path1,path2)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = path2;
|
2015-11-08 00:33:00 +03:00
|
|
|
lib_init_fs();
|
2015-11-05 23:49:42 +03:00
|
|
|
move_pointer stdcall(tmp1,tmp2);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
:byte FILE_SYSTEM_FUNCTION::copy(dword path1,path2)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = path2;
|
2015-11-08 00:33:00 +03:00
|
|
|
lib_init_fs();
|
2015-11-05 23:49:42 +03:00
|
|
|
copy_pointer stdcall(tmp1,tmp2);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-26 13:53:50 +03:00
|
|
|
:byte FILE_SYSTEM_FUNCTION::callback_copy(dword path1,path2,ptr)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = path2;
|
|
|
|
lib_init_fs();
|
|
|
|
callback_copy_pointer stdcall(tmp1,tmp2,ptr);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-06 17:49:37 +03:00
|
|
|
:byte __CHECK_FS__ = 0;
|
2015-11-05 23:49:42 +03:00
|
|
|
:void lib_init_fs()
|
|
|
|
{
|
2015-11-06 17:49:37 +03:00
|
|
|
IF(__CHECK_FS__)return;
|
2015-11-05 23:49:42 +03:00
|
|
|
library.load("/sys/LIB/FS.OBJ");
|
|
|
|
fs.remove_pointer = library.get("fs.remove");
|
|
|
|
fs.get_size_pointer = library.get("fs.get_size");
|
|
|
|
fs.move_pointer = library.get("fs.move");
|
2015-11-26 13:53:50 +03:00
|
|
|
fs.open_pointer = library.get("fs.open");
|
2015-11-05 23:49:42 +03:00
|
|
|
fs.copy_pointer = library.get("fs.copy");
|
2015-11-06 17:49:37 +03:00
|
|
|
fs.read_pointer = library.get("fs.read");
|
2015-11-06 21:11:25 +03:00
|
|
|
fs.run_pointer = library.get("fs.execute");
|
2015-11-26 13:53:50 +03:00
|
|
|
fs.write_pointer = library.get("fs.write");
|
|
|
|
fs.callback_copy_pointer = library.get("fs.callback_copy");
|
2015-11-06 17:49:37 +03:00
|
|
|
__CHECK_FS__ = true;
|
2015-11-05 23:49:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|