Subversion Repositories Kolibri OS

Rev

Rev 5890 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef INCLUDE_LIBFS_H
  2. #define INCLUDE_LIBFS_H
  3. #print "[include <obj/fs.h>]\n"
  4.  
  5. #ifndef INCLUDE_KOLIBRI_H
  6. #include "../lib/kolibri.h"
  7. #endif
  8.  
  9. #ifndef INCLUDE_DLL_H
  10. #include "../lib/dll.h"
  11. #endif
  12.  
  13. :struct FILE_SYSTEM_FUNCTION
  14. {
  15.         dword remove_pointer;
  16.         byte remove(dword path);
  17.        
  18.         dword read_pointer;
  19.         dword read(dword path);
  20.        
  21.         dword run_pointer;
  22.         dword run(dword path,arg);
  23.        
  24.         dword move_pointer;
  25.         byte move(dword path1,path2);
  26.        
  27.         dword copy_pointer;
  28.         byte copy(dword path1,path2);
  29.        
  30.         dword get_size_pointer;
  31.         qword get_size(dword path);
  32. } fs;
  33.  
  34. :byte FILE_SYSTEM_FUNCTION::remove(dword path)
  35. {
  36.         dword tmp = path;
  37.         lib_init_fs();
  38.         remove_pointer stdcall(tmp);
  39.         return EAX;
  40. }
  41.  
  42. :dword FILE_SYSTEM_FUNCTION::read(dword path)
  43. {
  44.         dword tmp = path;
  45.         lib_init_fs();
  46.         read_pointer stdcall(tmp);
  47.         return EAX;
  48. }
  49.  
  50. :dword FILE_SYSTEM_FUNCTION::run(dword path,arg)
  51. {
  52.         dword tmp1 = path1;
  53.         dword tmp2 = arg;
  54.         lib_init_fs();
  55.         run_pointer stdcall(tmp1,tmp2);
  56.         return EAX;
  57. }
  58.  
  59. :qword FILE_SYSTEM_FUNCTION::get_size(dword path)
  60. {
  61.         dword tmp = path;
  62.         lib_init_fs();
  63.         get_size_pointer stdcall(tmp);
  64.         return EAX;
  65. }
  66.  
  67. :byte FILE_SYSTEM_FUNCTION::move(dword path1,path2)
  68. {
  69.         dword tmp1 = path1;
  70.         dword tmp2 = path2;
  71.         lib_init_fs();
  72.         move_pointer stdcall(tmp1,tmp2);
  73.         return EAX;
  74. }
  75.  
  76. :byte FILE_SYSTEM_FUNCTION::copy(dword path1,path2)
  77. {
  78.         dword tmp1 = path1;
  79.         dword tmp2 = path2;
  80.         lib_init_fs();
  81.         copy_pointer stdcall(tmp1,tmp2);
  82.         return EAX;
  83. }
  84.  
  85. :byte __CHECK_FS__ = 0;
  86. :void lib_init_fs()
  87. {
  88.         IF(__CHECK_FS__)return;
  89.         library.load("/sys/LIB/FS.OBJ");
  90.         fs.remove_pointer = library.get("fs.remove");
  91.         fs.get_size_pointer = library.get("fs.get_size");
  92.         fs.move_pointer = library.get("fs.move");
  93.         fs.copy_pointer = library.get("fs.copy");
  94.         fs.read_pointer = library.get("fs.read");
  95.         fs.run_pointer = library.get("fs.execute");
  96.         __CHECK_FS__ = true;
  97. }
  98.  
  99. #endif