Subversion Repositories Kolibri OS

Rev

Rev 5862 | Rev 7639 | 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      0x0
  11.         dd      0x0          
  12.                    
  13. include '../../../proc32.inc'          
  14. include '../../../macros.inc'          
  15. include '../../../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     dword [sz_buffer], "\__S"
  47.  
  48.          
  49.     xor     edi, edi
  50. @@:          
  51.     mov     ah, byte [sz_param + edi]          
  52.     mov     byte [sz_buffer + edi + 4], ah          
  53.     inc     edi          
  54.     cmp     byte [sz_param + edi], 0          
  55.     jne     @b          
  56.          
  57.     mov     byte [sz_buffer + edi + 4], 0          
  58.         stdcall RunProgram, sz_buffer, aKiv
  59.          
  60. set_skin:                  
  61.     invoke  ini_get_str, aIni, aMain, aSkin, sz_param, PATH_MAX_CHARS, 0
  62.     mcall   48, 8, sz_param          
  63.  
  64. close_app:
  65.     mcall   -1
  66.  
  67. proc RunProgram stdcall, app_path:dword, app_param:dword
  68.     push    eax          
  69.     m2m     dword [InfoStructure+8],  [app_param] ; pointer to the parametrs          
  70.     m2m     dword [InfoStructure+21], [app_path] ; pointer to the file name          
  71.     mcall   70, InfoStructure          
  72.     pop     eax          
  73.     ret          
  74. endp          
  75.  
  76.          
  77. align 16          
  78. importTable:          
  79. library                                                 \          
  80.         libini, 'libini.obj'          
  81.          
  82. import  libini, \          
  83.         ini_get_str  ,'ini_get_str', \          
  84.         ini_get_int  ,'ini_get_int'      
  85.          
  86. InfoStructure:
  87.         dd      7     ; subfunction number          
  88.         dd      0     ; position in the file in bytes          
  89.         dd      ?     ; upper part of the position address          
  90.         dd      0     ; number of bytes to read          
  91.         dd      0     ; pointer to the buffer to write data          
  92.         db      0          
  93.         dd      ?     ; pointer to the filename          
  94.  
  95.          
  96. aIni          db  '/sys/settings/eskin.ini',0          
  97. aKiv          db  '/sys/media/kiv',0        
  98. aMain         db  'main',0          
  99. aBg           db  'bg',0
  100. aButton       db  '3d',0          
  101. aSkin         db  'skin',0          
  102. aWallpaper    db  'wallpaper',0
  103. aProgram      db  'program',0
  104. aParam        db  'param',0          
  105.  
  106.  
  107. sz_buffer:
  108.     rb        PATH_MAX_CHARS
  109. sz_param:          
  110.     rb        PATH_MAX_CHARS
  111.          
  112. I_END:                    ; End of application code and data marker          
  113.        
  114.