2015-11-05 21:49:42 +01: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-06 15:49:37 +01:00
|
|
|
dword read_pointer;
|
|
|
|
dword read(dword path);
|
|
|
|
|
2015-11-06 19:11:25 +01:00
|
|
|
dword run_pointer;
|
|
|
|
dword run(dword path,arg);
|
|
|
|
|
2015-11-05 21:49:42 +01:00
|
|
|
dword move_pointer;
|
|
|
|
byte move(dword path1,path2);
|
|
|
|
|
|
|
|
dword copy_pointer;
|
|
|
|
byte copy(dword path1,path2);
|
|
|
|
|
|
|
|
dword get_size_pointer;
|
|
|
|
qword get_size(dword path);
|
2015-11-07 23:35:31 +01:00
|
|
|
|
|
|
|
dword callback_copy;
|
2015-11-05 21:49:42 +01:00
|
|
|
} fs;
|
|
|
|
|
|
|
|
:byte FILE_SYSTEM_FUNCTION::remove(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
2015-11-07 22:33:00 +01:00
|
|
|
lib_init_fs();
|
2015-11-05 21:49:42 +01:00
|
|
|
remove_pointer stdcall(tmp);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-06 15:49:37 +01:00
|
|
|
:dword FILE_SYSTEM_FUNCTION::read(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
2015-11-07 22:33:00 +01:00
|
|
|
lib_init_fs();
|
2015-11-06 15:49:37 +01:00
|
|
|
read_pointer stdcall(tmp);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-06 19:11:25 +01:00
|
|
|
:dword FILE_SYSTEM_FUNCTION::run(dword path,arg)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = arg;
|
2015-11-07 22:33:00 +01:00
|
|
|
lib_init_fs();
|
2015-11-06 19:11:25 +01:00
|
|
|
run_pointer stdcall(tmp1,tmp2);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-05 21:49:42 +01:00
|
|
|
:qword FILE_SYSTEM_FUNCTION::get_size(dword path)
|
|
|
|
{
|
|
|
|
dword tmp = path;
|
2015-11-07 22:33:00 +01:00
|
|
|
lib_init_fs();
|
2015-11-05 21:49:42 +01:00
|
|
|
get_size_pointer stdcall(tmp);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
:byte FILE_SYSTEM_FUNCTION::move(dword path1,path2)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = path2;
|
2015-11-07 22:33:00 +01:00
|
|
|
lib_init_fs();
|
2015-11-05 21:49:42 +01:00
|
|
|
move_pointer stdcall(tmp1,tmp2);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
:byte FILE_SYSTEM_FUNCTION::copy(dword path1,path2)
|
|
|
|
{
|
|
|
|
dword tmp1 = path1;
|
|
|
|
dword tmp2 = path2;
|
2015-11-07 22:33:00 +01:00
|
|
|
lib_init_fs();
|
2015-11-05 21:49:42 +01:00
|
|
|
copy_pointer stdcall(tmp1,tmp2);
|
|
|
|
return EAX;
|
|
|
|
}
|
|
|
|
|
2015-11-06 15:49:37 +01:00
|
|
|
:byte __CHECK_FS__ = 0;
|
2015-11-05 21:49:42 +01:00
|
|
|
:void lib_init_fs()
|
|
|
|
{
|
2015-11-06 15:49:37 +01:00
|
|
|
IF(__CHECK_FS__)return;
|
2015-11-05 21:49:42 +01: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");
|
|
|
|
fs.copy_pointer = library.get("fs.copy");
|
2015-11-06 15:49:37 +01:00
|
|
|
fs.read_pointer = library.get("fs.read");
|
2015-11-06 19:11:25 +01:00
|
|
|
fs.run_pointer = library.get("fs.execute");
|
2015-11-07 23:35:31 +01:00
|
|
|
fs.callback_copy = library.get("fs.callback_copy");
|
2015-11-06 15:49:37 +01:00
|
|
|
__CHECK_FS__ = true;
|
2015-11-05 21:49:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|