use32 org 0x0 db 'MENUET01' ; 8 byte id dd 38 ; required os dd STARTAPP ; program start dd I_END ; program image size dd 0x1000000 ; required amount of memory dd 0x1000000 ; stack heap dd app_path dd 0x0 include '../../../proc32.inc' include '../../../macros.inc' include '../../../dll.inc' PATH_MAX_CHARS equ 255 STARTAPP: ; Initialize memory mcall 68, 11 or eax,eax jz close_app ;Import libraries stdcall dll.Load,importTable test eax, eax jnz close_app invoke ini_get_int, aIni, aMain, aButton, 0 mov ecx, eax mcall 48, 1 invoke ini_get_int, aIni, aMain, aBg, 0 cmp eax, 1 jnz set_bg set_program: invoke ini_get_str, aIni, aMain, aProgram, sz_buffer, PATH_MAX_CHARS, 0 invoke ini_get_str, aIni, aMain, aParam, sz_param, PATH_MAX_CHARS, 0 stdcall RunProgram, sz_buffer, sz_param jmp set_skin set_bg: invoke ini_get_str, aIni, aMain, aWallpaper, sz_param, PATH_MAX_CHARS, 0 mov byte [sz_buffer + 0],'\' mov byte [sz_buffer + 1], 'S' mov byte [sz_buffer + 2], '_' mov byte [sz_buffer + 3], '_' mov edi, 0 @@: mov ah, byte [sz_param + edi] mov byte [sz_buffer + edi + 4], ah inc edi cmp byte [sz_param + edi], 0 jne @b mov byte [sz_buffer + edi + 4], 0 mcall 70, is_kiv set_skin: invoke ini_get_str, aIni, aMain, aSkin, sz_param, PATH_MAX_CHARS, 0 mcall 48, 8, sz_param close_app: mcall -1 proc RunProgram stdcall, app_path:dword, app_param:dword pusha mov dword [InfoStructure], 7 ; run program mov dword [InfoStructure+4], 0 ; flags mov eax, [app_param] mov dword [InfoStructure+8], eax ; pointer to the parametrs mov dword [InfoStructure+12], 0 ; reserved mov dword [InfoStructure+16], 0 ; reserved mov dword [InfoStructure+20], 0 ; reserved mov eax, [app_path] mov dword [InfoStructure+21], eax ; pointer to the file name mcall 70, InfoStructure popa ret endp align 16 importTable: library \ libini, 'libini.obj' import libini, \ ini_get_str ,'ini_get_str', \ ini_set_str ,'ini_set_str', \ ini_get_int ,'ini_get_int', \ ini_set_int ,'ini_set_int' InfoStructure: dd 0x0 ; subfunction number dd 0x0 ; position in the file in bytes dd 0x0 ; upper part of the position address dd 0x0 ; number of bytes to read dd 0x0 ; pointer to the buffer to write data db 0 dd 0 ; pointer to the filename aIni db '/rd/1/settings/eskin.ini',0 aMain db 'main',0 aBg db 'bg',0 aButton db '3d',0 aSkin db 'skin',0 aWallpaper db 'wallpaper',0 aProgram db 'program',0 aParam db 'param',0 is_kiv: dd 7, 0, sz_buffer, 0, 0 db "/rd/1/media/kiv", 0 sz_buffer: rb PATH_MAX_CHARS sz_param: rb PATH_MAX_CHARS I_END: ; End of application code and data marker app_path rb PATH_MAX_CHARS