Subversion Repositories Kolibri OS

Rev

Rev 5862 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  use32          
  2.         org     0x0          
  3.          
  4.         db      'MENUET01'      ; 8 byte id          
  5.         dd      38              ; required os          
  6.         dd      STARTAPP        ; program start          
  7.         dd      I_END           ; program image size          
  8.         dd      0x1000000       ; required amount of memory          
  9.         dd      0x1000000       ; stack heap          
  10.         dd      app_path
  11.         dd      0x0          
  12.                    
  13. include 'kinc/proc32.inc'          
  14. include 'kinc/macros.inc'          
  15. include 'kinc/dll.inc'          
  16.  
  17.          
  18. PATH_MAX_CHARS equ 255          
  19.          
  20.          
  21. STARTAPP:          
  22.     ; Initialize memory          
  23.     mcall   68, 11          
  24.     or      eax,eax          
  25.     jz      close_app          
  26.     ;Import libraries          
  27.     stdcall dll.Load,importTable          
  28.     test    eax, eax          
  29.     jnz     close_app          
  30.    
  31.     invoke  ini_get_int, aIni, aMain, aButton, 0
  32.     mov ecx, eax
  33.     mcall 48, 1
  34.     invoke  ini_get_int, aIni, aMain, aBg, 0
  35.     cmp eax, 1
  36.     jnz set_bg
  37.  
  38. set_program:
  39.     invoke  ini_get_str, aIni, aMain, aProgram, sz_buffer, PATH_MAX_CHARS, 0
  40.     invoke  ini_get_str, aIni, aMain, aParam, sz_param, PATH_MAX_CHARS, 0
  41.     stdcall RunProgram, sz_buffer, sz_param
  42.     jmp set_skin
  43.            
  44. set_bg:
  45.     invoke  ini_get_str, aIni, aMain, aWallpaper, sz_param, PATH_MAX_CHARS, 0
  46.     mov     byte [sz_buffer + 0],'\'
  47.     mov     byte [sz_buffer + 1], 'S'          
  48.     mov     byte [sz_buffer + 2], '_'          
  49.     mov     byte [sz_buffer + 3], '_'          
  50.          
  51.     mov     edi, 0          
  52. @@:          
  53.     mov     ah, byte [sz_param + edi]          
  54.     mov     byte [sz_buffer + edi + 4], ah          
  55.     inc     edi          
  56.     cmp     byte [sz_param + edi], 0          
  57.     jne     @b          
  58.          
  59.     mov     byte [sz_buffer + edi + 4], 0          
  60.     mcall   70, is_kiv
  61.          
  62. set_skin:                  
  63.     invoke  ini_get_str, aIni, aMain, aSkin, sz_param, PATH_MAX_CHARS, 0
  64.     mcall   48, 8, sz_param          
  65.  
  66. close_app:
  67.     mcall -1
  68.  
  69. proc RunProgram stdcall, app_path:dword, app_param:dword
  70.     pusha          
  71.     mov      dword [InfoStructure],    7   ; run program          
  72.     mov      dword [InfoStructure+4],  0   ; flags          
  73.     mov      eax, [app_param]          
  74.     mov      dword [InfoStructure+8],  eax ; pointer to the parametrs          
  75.     mov      dword [InfoStructure+12], 0   ; reserved          
  76.     mov      dword [InfoStructure+16], 0   ; reserved          
  77.     mov      dword [InfoStructure+20], 0   ; reserved          
  78.     mov      eax, [app_path]          
  79.     mov      dword [InfoStructure+21], eax ; pointer to the file name          
  80.     mcall    70, InfoStructure          
  81.     popa          
  82.     ret          
  83. endp          
  84.  
  85.          
  86. align 16          
  87. importTable:          
  88. library                                                 \          
  89.         libini, 'libini.obj'          
  90.          
  91. import  libini, \          
  92.         ini_get_str  ,'ini_get_str', \          
  93.         ini_set_str  ,'ini_set_str', \          
  94.         ini_get_int  ,'ini_get_int', \          
  95.         ini_set_int  ,'ini_set_int'          
  96.          
  97. InfoStructure:
  98.                      dd      0x0     ; subfunction number          
  99.                      dd      0x0     ; position in the file in bytes          
  100.                      dd      0x0     ; upper part of the position address          
  101.                      dd      0x0     ; number of     bytes to read          
  102.                      dd      0x0     ; pointer to the buffer to write data          
  103.                      db      0          
  104.                      dd      0       ; pointer to the filename          
  105.  
  106.          
  107. aIni                   db  '/rd/1/settings/eskin.ini',0          
  108. aMain                  db  'main',0          
  109. aBg                    db  'bg',0
  110. aButton                db  '3d',0          
  111. aSkin                  db  'skin',0          
  112. aWallpaper             db  'wallpaper',0
  113. aProgram               db  'program',0
  114. aParam                 db  'param',0          
  115.  
  116. is_kiv:
  117.     dd      7, 0, sz_buffer, 0, 0          
  118.     db      "/rd/1/media/kiv", 0          
  119.  
  120. sz_buffer:
  121.     rb        PATH_MAX_CHARS
  122. sz_param:          
  123.     rb        PATH_MAX_CHARS
  124.          
  125. I_END:                    ; End of application code and data marker          
  126.          
  127. app_path       rb  PATH_MAX_CHARS          
  128.