Subversion Repositories Kolibri OS

Rev

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

  1. /* Copyright (C) 2019-2021 Logaev Maxim (turbocat2001), GPLv3 */
  2.  
  3. #include <stdlib.h>
  4. #include <stdbool.h>
  5.  
  6. #pragma pack(push,1)
  7. typedef struct {
  8.     unsigned    p00;
  9.     unsigned long long  p04;
  10.     unsigned    p12;
  11.     unsigned    p16;
  12.     char                p20;
  13.     char                *p21;
  14. } kol_struct70;
  15. #pragma pack(pop)
  16.  
  17. int kol_file_70(kol_struct70 *k)
  18. {
  19.     asm volatile ("int $0x40"::"a"(70), "b"(k));
  20. }
  21.  
  22. bool dir_operations(unsigned char fun_num, char *path)
  23. {
  24.     kol_struct70 inf;
  25.     inf.p00 = fun_num;
  26.     inf.p04 = 0;
  27.     inf.p12 = 0;
  28.     inf.p16 = 0;
  29.     inf.p20 = 0;
  30.     inf.p21 = path;
  31.     if(!kol_file_70(&inf)){
  32.         return true;
  33.     }
  34.     else {
  35.             return false;
  36.     }
  37. }
  38.  
  39. int chdir(const char* cwd)
  40. {
  41.     __asm__ __volatile__(
  42.     "int $0x40"
  43.     ::"a"(30),"b"(1),"c"(cwd));
  44.    
  45.     return 0;
  46. }
  47.  
  48. bool mkdir(const char* dir, int a)
  49. {
  50.     return dir_operations(9, (char*)dir);
  51. }
  52.