From d340c1ed3485e8d6560ddb21f2eaf1ff17335d77 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Thu, 26 Nov 2015 10:53:50 +0000 Subject: [PATCH] add functions git-svn-id: svn://kolibrios.org@5933 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/lib/font.h | 2 +- programs/cmm/lib/kolibri.h | 1 + programs/cmm/lib/obj/fs.h | 45 +++++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index ab7ac9615..c59f8e5e5 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -5,7 +5,7 @@ #include "../lib/math.h" #endif -#ifndef INCLUDE_IO_H +#ifndef INCLUDE_FS_H #include "../lib/obj/fs.h" #endif diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 645bafc65..cb48fed44 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -813,6 +813,7 @@ void ______INIT______() $pop ebx main(); + ExitProcess(); } ______STOP______: #endif \ No newline at end of file diff --git a/programs/cmm/lib/obj/fs.h b/programs/cmm/lib/obj/fs.h index dc323deb8..34b7dc023 100644 --- a/programs/cmm/lib/obj/fs.h +++ b/programs/cmm/lib/obj/fs.h @@ -15,6 +15,9 @@ dword remove_pointer; byte remove(dword path); + dword open_pointer; + dword open(dword path); + dword read_pointer; dword read(dword path); @@ -27,10 +30,14 @@ dword copy_pointer; byte copy(dword path1,path2); + dword write_pointer; + byte write(dword path1,path2,path3); + dword get_size_pointer; qword get_size(dword path); - dword callback_copy; + dword callback_copy_pointer; + byte callback_copy(dword path1,path2,ptr); } fs; :byte FILE_SYSTEM_FUNCTION::remove(dword path) @@ -49,6 +56,16 @@ return EAX; } +: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; +} + :dword FILE_SYSTEM_FUNCTION::run(dword path,arg) { dword tmp1 = path1; @@ -62,7 +79,17 @@ { dword tmp = path; lib_init_fs(); - get_size_pointer stdcall(tmp); + //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); return EAX; } @@ -84,6 +111,16 @@ return EAX; } +: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; +} + + :byte __CHECK_FS__ = 0; :void lib_init_fs() { @@ -92,10 +129,12 @@ fs.remove_pointer = library.get("fs.remove"); fs.get_size_pointer = library.get("fs.get_size"); fs.move_pointer = library.get("fs.move"); + fs.open_pointer = library.get("fs.open"); fs.copy_pointer = library.get("fs.copy"); fs.read_pointer = library.get("fs.read"); fs.run_pointer = library.get("fs.execute"); - fs.callback_copy = library.get("fs.callback_copy"); + fs.write_pointer = library.get("fs.write"); + fs.callback_copy_pointer = library.get("fs.callback_copy"); __CHECK_FS__ = true; }