MENU.DAT: general update of Russian version

UNIMG: upload binnary, add to IMG
KWINE: upload to SVN, add to ISO

git-svn-id: svn://kolibrios.org@7864 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-05 00:40:51 +00:00
parent dad5229ccd
commit 7d89f2686a
13 changed files with 1846 additions and 65 deletions

View File

@ -25,6 +25,7 @@ img_files = {
{"LANG.INC", build_type .. "/lang.inc"}, {"LANG.INC", build_type .. "/lang.inc"},
{"NOTIFY3.PNG", "common/notify3.png"}, {"NOTIFY3.PNG", "common/notify3.png"},
{"TOOLBAR.PNG", PROGS .. "/cmm/txtread/toolbar.png"}, {"TOOLBAR.PNG", PROGS .. "/cmm/txtread/toolbar.png"},
{"UNIMG", PROGS .. "/fs/unimg/unimg"},
{"VMODE", "common/vmode"}, {"VMODE", "common/vmode"},
{"3D/HOUSE.3DS", "common/3d/house.3ds"}, {"3D/HOUSE.3DS", "common/3d/house.3ds"},
{"DEVELOP/T_EDIT.INI", PROGS .. "/other/t_edit/t_edit.ini"}, {"DEVELOP/T_EDIT.INI", PROGS .. "/other/t_edit/t_edit.ini"},
@ -177,15 +178,14 @@ extra_files = {
{"kolibrios/develop/TinyBasic/", "common/develop/TinyBasic/*"}, {"kolibrios/develop/TinyBasic/", "common/develop/TinyBasic/*"},
{"kolibrios/utils/cnc_editor/cnc_editor", PROGS .. "/other/cnc_editor/cnc_editor"}, {"kolibrios/utils/cnc_editor/cnc_editor", PROGS .. "/other/cnc_editor/cnc_editor"},
{"kolibrios/utils/cnc_editor/kolibri.NC", PROGS .. "/other/cnc_editor/kolibri.NC"}, {"kolibrios/utils/cnc_editor/kolibri.NC", PROGS .. "/other/cnc_editor/kolibri.NC"},
{"kolibrios/emul/", "common/emul/*"},
{"kolibrios/emul/dosbox/", "common/emul/DosBox/*"}, {"kolibrios/emul/dosbox/", "common/emul/DosBox/*"},
{"kolibrios/emul/e80/readme.txt", PROGS .. "/emulator/e80/trunk/readme.txt"}, {"kolibrios/emul/e80/readme.txt", PROGS .. "/emulator/e80/trunk/readme.txt"},
{"kolibrios/emul/e80/keyboard.png", PROGS .. "/emulator/e80/trunk/keyboard.png"}, {"kolibrios/emul/e80/keyboard.png", PROGS .. "/emulator/e80/trunk/keyboard.png"},
{"kolibrios/emul/fceu/fceu", PROGS .. "/emulator/fceu/fceu"}, {"kolibrios/emul/fceu/fceu", PROGS .. "/emulator/fceu/fceu"},
{"kolibrios/emul/fceu/FCEU ReadMe.txt", PROGS .. "/emulator/fceu/FCEU ReadMe.txt"}, {"kolibrios/emul/fceu/FCEU ReadMe.txt", PROGS .. "/emulator/fceu/FCEU ReadMe.txt"},
{"kolibrios/emul/", "common/emul/gameboy"}, {"kolibrios/emul/kwine/kwine", PROGS .. "/emulator/kwine/bin/kwine"},
{"kolibrios/emul/", "common/emul/pokemini"}, {"kolibrios/emul/kwine/lib/", PROGS .. "/emulator/kwine/bin/kwine/lib/*"},
{"kolibrios/emul/", "common/emul/scummvm"},
{"kolibrios/emul/", "common/emul/zsnes"},
{"kolibrios/demos/ak47.lif", "common/demos/ak47.lif"}, {"kolibrios/demos/ak47.lif", "common/demos/ak47.lif"},
{"kolibrios/demos/life2", "common/demos/life2"}, {"kolibrios/demos/life2", "common/demos/life2"},
{"kolibrios/demos/life3tb.png", PROGS .. "/games/life3/trunk/life3tb.png"}, {"kolibrios/demos/life3tb.png", PROGS .. "/games/life3/trunk/life3tb.png"},

View File

@ -2,13 +2,13 @@
ˆ£à®¢®© 業âà /sys/allgames ˆ£à®¢®© 業âà /sys/allgames
„¥¬ª¨ > /@1 „¥¬ª¨ > /@1
ƒà ä¨ª  > /@3 ƒà ä¨ª  > /@3
Œã«ì⨬¥¤¨  > /@4 ‡¢ãª ¨ ¢¨¤¥® > /@4
<EFBFBD>¬ã«ïâ®àë > /@18
<EFBFBD> §à ¡®âª  > /@5 <EFBFBD> §à ¡®âª  > /@5
<EFBFBD>¬ã«ïâ®àë > /@6
‘¨á⥬  > /@7 ‘¨á⥬  > /@7
Ž¡à ¡®âª  ¤ ­­ëå > /@13 Žä¨á > /@10
‘¥âì > /@14 ‘¥âì > /@11
<EFBFBD> §­®¥ > /@17 <EFBFBD> §­®¥ > /@14
„®ªã¬¥­â æ¨ï /sys/docpack „®ªã¬¥­â æ¨ï /sys/docpack
‡ ¯ã᪠¯à®£à ¬¬ë /sys/run ‡ ¯ã᪠¯à®£à ¬¬ë /sys/run
‡ ¢¥à襭¨¥ à ¡®âë /sys/end ‡ ¢¥à襭¨¥ à ¡®âë /sys/end
@ -42,84 +42,62 @@ FlatWave /sys/3d/flatwav
<EFBFBD>¥¤ ªâ®à Animage /sys/media/animage <EFBFBD>¥¤ ªâ®à Animage /sys/media/animage
<EFBFBD> «®¦¥­¨¥ 䨫ìâ஢ /sys/media/imgf/imgf <EFBFBD> «®¦¥­¨¥ 䨫ìâ஢ /sys/media/imgf/imgf
<EFBFBD> «¨âà  /sys/media/palitra <EFBFBD> «¨âà  /sys/media/palitra
#4 **** Œã«ì⨬¥¤¨  **** <EFBFBD>¨¯¥âª  /sys/pipetka
#4 **** ‡¢ãª ¨ ¢¨¤¥® ****
€ã¤¨®¯«¥¥à Pixie /sys/media/pixie €ã¤¨®¯«¥¥à Pixie /sys/media/pixie
€ã¤¨®¯«¥¥à AC97SND /sys/media/ac97snd €ã¤¨®¯«¥¥à AC97SND /sys/media/ac97snd
‚¨¤¥®¯«¥¥à Fplay /kolibrios/media/fplay ‚¨¤¥®¯«¥¥à Fplay /kolibrios/media/fplay
Midi-¯«¥¥à /sys/media/midamp Midi-¯«¥¥à /sys/media/midamp
#5 **** <20> §à ¡®âª  **** #5 **** <20> §à ¡®âª  ****
<EFBFBD>ਬ¥àë > /@6
“¯ ª®¢é¨ª KPack /sys/kpack “¯ ª®¢é¨ª KPack /sys/kpack
Flat Assembler /sys/develop/fasm Flat Assembler /sys/develop/fasm
„®áª  ®â« ¤ª¨ /sys/develop/board „®áª  ®â« ¤ª¨ /sys/develop/board
HEX-। ªâ®à /sys/develop/heed
Diff tool /sys/develop/diff Diff tool /sys/develop/diff
Žâ« ¤ç¨ª /sys/develop/mtdbg Žâ« ¤ç¨ª /sys/develop/mtdbg
<EFBFBD>¨¯¥âª  /sys/pipetka
Hex2Dec2Bin /sys/develop/h2d2b Hex2Dec2Bin /sys/develop/h2d2b
’ ¡«¨æ  ᨬ¢®«®¢ /sys/ASCIIVju ’ ¡«¨æ  ᨬ¢®«®¢ /sys/ASCIIVju
ASCII-ª®¤ë /sys/develop/keyascii ASCII-ª®¤ë /sys/develop/keyascii
SCAN-ª®¤ë /sys/develop/scancode SCAN-ª®¤ë /sys/develop/scancode
#6 **** <20> §à ¡®âª  -> <20>ਬ¥àë **** #6 **** <20>¬ã«ïâ®àë ****
<EFBFBD>®â®ª¨ /sys/develop/thread DOSBox DOS Emulator /kolibrios/emul/DosBox/dosbox
Color Slider /sys/demos/cslide e80 (ZX Spectrum) /kolibrios/emul/e80/e80
Š®­á®«ì­ë© ¯à¨¬¥à 1 /sys/develop/testcon2 FCE Ultra - NES /kolibrios/emul/fceu/fceu
Š®­á®«ì­ë© ¯à¨¬¥à 2 /sys/develop/test_gets PokeMini /kolibrios/emul/pokemini
Žª­  á®®¡é¥­¨© /sys/demos/use_mb ScummVM /kolibrios/emul/scummvm
ZSNES Super Nintendo /kolibrios/emul/zsnes
#7 **** ‘¨á⥬  **** #7 **** ‘¨á⥬  ****
<EFBFBD> áâனª¨ > /@8 ‘¨á⥬­ ï ¯ ­¥«ì /sys/syspanel
‘¨á⥬­ë¥ ᥭá®àë > /@9 ” ©«®¢ë¥ ¬¥­¥¤¦¥àë > /@8
<EFBFBD> ¡®â  á ä ©« ¬¨ > /@10 ‘¯¥æ. ¢®§¬®¦­®á⨠> /@9
’¥áâ¨à®¢ ­¨¥ > /@11
‘¯¥æ. ¢®§¬®¦­®á⨠> /@12
Š «¥­¤ àì /sys/calendar Š «¥­¤ àì /sys/calendar
„®áª  ®â« ¤ª¨ /sys/develop/board
<EFBFBD>ãä¥à ®¡¬¥­  /sys/develop/clipview
’¥à¬¨­ « /sys/terminal ’¥à¬¨­ « /sys/terminal
#8 **** ‘¨á⥬  -> <20> áâனª¨ **** ‚¨àâã «ì­ë¥ ¤¨áª¨ /sys/tmpdisk
“áâனá⢠ /sys/setup Š®­á®«ì SHELL /sys/shell
“áâ ­®¢¨âì ä®­ /sys/media/palitra ‘®åà ­¥­¨¥ ®¡à §  /sys/rdsave
‘â¨«ì ®ª®­ /sys/skincfg #8 **** ‘¨á⥬  -> ” ©«®¢ë¥ ¬¥­¥¤¦¥àë ****
ƒ®àï稥 ª« ¢¨è¨ /sys/mykey
‚¨¤¥®à¥¦¨¬ ¤«ï ATI /sys/vmode
#9 **** ‘¨á⥬  -> ‘¥­á®àë ****
„¨á¯¥âç¥à ¯à®æ¥áᮢ /sys/cpu
PCI-ãáâனá⢠ /sys/pcidev
CPUID /sys/cpuid
GHOST Monitor /sys/gmon
K. Bus disconnected /sys/kbd
HDD ¨­ä®à¬¥à /sys/hdd_info
#10 **** ‘¨á⥬  -> <20> ¡®â  á ä ©« ¬¨ ****
KFAR /sys/File Managers/kfar KFAR /sys/File Managers/kfar
fNav /sys/File Managers/fNav/fNav fNav /sys/File Managers/fNav/fNav
KFM /sys/File Managers/kfm KFM /sys/File Managers/kfm
Eolite /sys/File Managers/Eolite Eolite /sys/File Managers/Eolite
‚¨àâã «ì­ë¥ ¤¨áª¨ /sys/tmpdisk #9 **** ‘¨á⥬  -> ‘¯¥æ.¢®§¬®¦­®á⨠****
Š®­á®«ì SHELL /sys/shell
‘®åà ­¥­¨¥ ®¡à §  /sys/rdsave
#11 **** ‘¨á⥬  -> ’¥áâ¨à®¢ ­¨¥ ****
’¥áâ § é¨âë /sys/test
’¥áâ ¬®­¨â®à  /sys/disptest
ƒà ä¨ç¥áª¨© ¡¥­ç¬ àª /sys/mgb
FSPEED ᪮à®áâì ”‘ /sys/fspeed
#12 **** ‘¨á⥬  -> ‘¯¥æ.¢®§¬®¦­®á⨠****
<EFBFBD>ªà ­­ ï «ã¯  /sys/magnify <EFBFBD>ªà ­­ ï «ã¯  /sys/magnify
<EFBFBD>ªà ­­ ï ª« ¢¨ âãà  /sys/zkey <EFBFBD>ªà ­­ ï ª« ¢¨ âãà  /sys/zkey
#13 **** Ž¡à ¡®âª  ¤ ­­ëå **** #10 **** Žä¨á ****
Š «ìªã«ïâ®à /sys/calc Š «ìªã«ïâ®à /sys/calc
<EFBFBD>¥¤ ªâ®à Tinypad /sys/tinypad <EFBFBD>¥¤ ªâ®à Tinypad /sys/tinypad
<EFBFBD>¥¤ ªâ®à TextEdit /sys/develop/t_edit <EFBFBD>¥¤ ªâ®à TextEdit /sys/develop/t_edit
’ ¡«¨ç­ë© ¯à®æ¥áá®à /sys/table ’ ¡«¨ç­ë© ¯à®æ¥áá®à /sys/table
<EFBFBD>®áâ஥­¨¥ £à ä¨ª®¢ /sys/graph <EFBFBD>®áâ஥­¨¥ £à ä¨ª®¢ /sys/graph
HEX-। ªâ®à /sys/develop/heed <EFBFBD>à®á¬®âà RTF /sys/rtfread
<EFBFBD> § à娢 â®à Unz /sys/unz #11 **** ‘¥âì ****
#14 **** ‘¥âì **** ‘¥à¢¥àë > /@12
‘¥à¢¥àë > /@15 Š«¨¥­âë > /@13
Š«¨¥­âë > /@16
<EFBFBD> áâனª¨ á¥â¨ /sys/network/netcfg <EFBFBD> áâனª¨ á¥â¨ /sys/network/netcfg
‘â âãá ¯®¤ª«î祭¨ï /sys/network/netstat ‘â âãá ¯®¤ª«î祭¨ï /sys/network/netstat
#15 **** ‘¥âì -> ‘¥à¢¥àë **** #12 **** ‘¥âì -> ‘¥à¢¥àë ****
FTP daemon /sys/network/ftpd FTP daemon /sys/network/ftpd
#16 **** ‘¥âì -> Š«¨¥­âë **** #13 **** ‘¥âì -> Š«¨¥­âë ****
IRC ª«¨¥­â /sys/network/ircc IRC ª«¨¥­â /sys/network/ircc
FTP ª«¨¥­â /sys/network/ftpc FTP ª«¨¥­â /sys/network/ftpc
TFTP ª«¨¥­â /sys/network/tftpc TFTP ª«¨¥­â /sys/network/tftpc
@ -130,19 +108,12 @@ DNS lookup /sys/network/nslookup
VNC Š«¨¥­â /sys/network/vncc VNC Š«¨¥­â /sys/network/vncc
ˆ­â¥à­¥â § £àã§ç¨ª /sys/network/downloader ˆ­â¥à­¥â § £àã§ç¨ª /sys/network/downloader
’¥ªáâ®¢ë© ¡à ã§¥à /sys/network/webview ’¥ªáâ®¢ë© ¡à ã§¥à /sys/network/webview
#17 **** <20> §­®¥ **** #14 **** <20> §­®¥ ****
‘®§¤ ­¨¥ áªà¨­è®â®¢ /sys/scrshoot ‘®§¤ ­¨¥ áªà¨­è®â®¢ /sys/scrshoot
€­ «®£®¢ë¥ ç áë /sys/demos/aclock €­ «®£®¢ë¥ ç áë /sys/demos/aclock
<EFBFBD>à®á¬®âà RTF /sys/rtfread
’ ¡«¨æ  Œ¥­¤¥«¥¥¢  /sys/period ’ ¡«¨æ  Œ¥­¤¥«¥¥¢  /sys/period
’७ ¦ñà KJ|ABuIIIA /sys/games/klavisha ’७ ¦ñà KJ|ABuIIIA /sys/games/klavisha
<EFBFBD>¨­ à­ë¥ ç áë /sys/demos/bcdclk <EFBFBD>¨­ à­ë¥ ç áë /sys/demos/bcdclk
’ ©¬¥à /sys/demos/timer ’ ©¬¥à /sys/demos/timer
#18 **** <20>¬ã«ïâ®àë **** <EFBFBD> § à娢 â®à Unz /sys/unz
DOSBox DOS Emulator /kolibrios/emul/DosBox/dosbox
e80 (ZX Spectrum) /kolibrios/emul/e80/e80
FCE Ultra - NES /kolibrios/emul/fceu/fceu
Gameboy Color /kolibrios/emul/gameboy
ScummVM (adventure) /kolibrios/emul/scummvm
ZSNES Super Nintendo /kolibrios/emul/zsnes
## ##

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,664 @@
; ------------------------------------------------------------- ;
; KWINE is a fork of program PELoad written by 0CodErr
; author - rgimad
; ------------------------------------------------------------- ;
ORG 0
BITS 32
; ------------------------------------------------------------- ;
PATH_SIZE equ 4096
PARAMS_SIZE equ 4096
STACK_SIZE equ 4096
END_ equ IMAGE_BASE - (PATH_SIZE + PARAMS_SIZE + STACK_SIZE)
; ------------------------------------------------------------- ;
IMAGE_BASE equ 400000H
; ------------------------------------------------------------- ;
MENUET01 db 'MENUET01'
version dd 1
program.start dd start_
program.end dd END_
program.memory dd END_ + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
program.stack dd END_ + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
program.params dd END_ + PATH_SIZE
program.path dd END_
; ------------------------------------------------------------- ;
load.library:
mov eax, 68
mov ebx, 19
mov ecx, [esp + 4]
int 64
ret 4
; ------------------------------------------------------------- ;
getprocaddress:
mov edx, [esp + 8]
xor eax, eax
test edx, edx
jz .end
.next:
xor eax, eax
cmp [edx], dword 0
jz .end
mov esi, [edx]
mov edi, [esp + 4]
.next_:
lodsb
scasb
jne .fail
or al, al
jnz .next_
jmp .ok
.fail:
add edx, 8
jmp .next
.ok:
mov eax, [edx + 4]
.end:
ret 8
; ------------------------------------------------------------- ;
realloc.app.mem:
mov eax, 64
mov ebx, 1
mov ecx, [esp + 4]
int 64
ret 4
; ------------------------------------------------------------- ;
set.current.directory:
mov eax, 30
mov ebx, 1
mov ecx, [esp + 4]
int 64
ret 4
; ------------------------------------------------------------- ;
%if 0 ; comment
int2str:
%define number [esp + 8 + 8 * 4]
%define buffer [esp + 4 + 8 * 4]
pushad
mov edi, buffer
mov eax, " " ; 4 spaces
stosd
stosd
stosw
xor al, al
stosb
dec edi
dec edi
mov ecx, 10
mov eax, number
.next:
xor edx, edx
div ecx ; ecx = 10
add edx, 48 ; edx = (eax MOD ecx) + 48
mov [edi], dl
dec edi
test eax, eax
jnz .next
popad
ret 8
%undef number
%undef buffer
%endif ; endcomment
; ------------------------------------------------------------- ;
; test_file_path db "/hd3/1/mntest.exe",0
; complex
; address
; data
; hello
; numbers +-
; proc
; sptrim
; se
; clear
; locals +-
; tokenise -
; mntest
file_path dd 0
lib_name dd 0
lib dd 0
func dd 0
func_name dd 0
; ------------------------------------------------------------- ;
sz_pe_load db "PELoad",0
; ------------------------------------------------------------- ;
con_init dd 0
con_write_asciiz dd 0
con_exit dd 0
console dd 0
sz_con_init db "con_init",0
sz_con_write_asciiz db "con_write_asciiz",0
sz_con_exit db "con_exit",0
sz_console db "/sys/lib/console.obj",0
; ------------------------------------------------------------- ;
MZ dw 0
PE dw 0
lfa_new dd 0
NumberOfSections dd 0
SizeOfOptionalHeader dd 0
EntryPoint dd 0
SizeOfImage dd 0
SizeOfHeaders dd 0
DataDirectories dd 0
SectionsTable dd 0
Import dd 0
; ------------------------------------------------------------- ;
ERROR_MESSAGE dd 0
err_params db "Parameters error",0
err_file_path db "No input file path",0
err_read_file db "Read file error",0
err_mz_not_found db "No DOS signature found",0
err_pe_not_found db "No PE signature found",0
err_load_library db "Error load library: ",0
err_func_not_found db "Not found function: ",0
; ------------------------------------------------------------- ;
%if 0 ; comment
msg_buffer resb 256
sz_new_line db 10,0
sz_space db " ",0
sz_space_colon_space db " : ",0
%endif ; endcomment
sz_empty db "",0
start_:
; ------------------------------------------------------------- ;
; find params and file path
; mov eax, test_file_path
mov eax, [program.params]
cmp [eax], byte 34 ; quote
jne .no_quote
inc eax
mov edi, eax
.find_quote_or_zero:
cmp [edi], byte 0
je .found
cmp [edi], byte 34 ; quote
je .found
inc edi
jmp .find_quote_or_zero
.no_quote:
mov edi, eax
.find_space_or_zero:
cmp [edi], byte 0
je .found
cmp [edi], byte 32 ; space
je .found
inc edi
jmp .find_space_or_zero
.found:
mov [edi], byte 0
mov [file_path], eax
; check file path
mov eax, [file_path]
mov al, [eax]
test al, al
jne file_path_ok
mov [ERROR_MESSAGE], dword err_file_path
jmp ERROR
file_path_ok:
; check MZ signature (IMAGE_DOS_HEADER.e_magic)
push dword [file_path];filepath
dec esp
mov [esp], byte 0
push dword MZ;buffer
push dword 2;count
push dword 0
push dword 0;position
push dword 0
mov ebx, esp
mov eax, 70
int 64
test eax, eax
je read_ok
mov [ERROR_MESSAGE], dword err_read_file
jmp ERROR
read_ok:
cmp word [MZ], "MZ"
je MZ_exists
mov [ERROR_MESSAGE], dword err_mz_not_found
jmp ERROR
MZ_exists:
; get lfa_new (IMAGE_DOS_HEADER.e_lfanew)
push dword [file_path];filepath
dec esp
mov [esp], byte 0
push dword lfa_new;buffer
push dword 4;count
push dword 0
push dword 60;position
push dword 0
mov ebx, esp
mov eax, 70
int 64
; check PE signature (IMAGE_OPTIONAL_HEADER.Magic)
push dword [file_path];filepath
dec esp
mov [esp], byte 0
push dword PE;buffer
push dword 2;count
push dword 0
push dword [lfa_new];position
push dword 0
mov ebx, esp
mov eax, 70
int 64
cmp word [PE], "PE"
je PE_exists
mov [ERROR_MESSAGE], dword err_pe_not_found
jmp ERROR
PE_exists:
; get size of headers (IMAGE_OPTIONAL_HEADER.SizeOfHeaders)
push dword [file_path];filepath
dec esp
mov [esp], byte 0
push dword SizeOfHeaders;buffer
push dword 4;count
push dword 0
mov eax, [lfa_new]
add eax, 84
push eax;position
push dword 0
mov ebx, esp
mov eax, 70
int 64
; resize app memory and load headers
mov eax, IMAGE_BASE
add eax, [SizeOfHeaders]
push eax
call realloc.app.mem
push dword [file_path];filepath
dec esp
mov [esp], byte 0
push dword IMAGE_BASE;buffer
push dword [SizeOfHeaders];count
push dword 0
push dword 0;position
push dword 0
mov ebx, esp
mov eax, 70
int 64
add esp, (25 * 5) ; restore our stack top
mov edx, [lfa_new]
; get SizeOfImage (IMAGE_OPTIONAL_HEADER.SizeOfImage)
mov eax, [IMAGE_BASE + edx + 80]
mov [SizeOfImage], eax
; get EntryPoint (IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint)
mov eax, [IMAGE_BASE + edx + 40]
mov [EntryPoint], eax
; get DataDirectories (IMAGE_OPTIONAL_HEADER.DataDirectory)
lea eax, [edx + 120]
mov [DataDirectories], eax
; get SizeOfOptionalHeader (IMAGE_FILE_HEADER.SizeOfOptionalHeader)
movzx eax, word [IMAGE_BASE + edx + 20]
mov [SizeOfOptionalHeader], ax
; get SectionsTable
lea eax, [edx + 24]
add ax, [SizeOfOptionalHeader]
mov [SectionsTable], eax
; get Import
mov eax, IMAGE_BASE
add eax, [DataDirectories]
add eax, 1 * 8
mov eax, [eax]
mov [Import], eax
; get NumberOfSections (IMAGE_FILE_HEADER.NumberOfSections)
movzx eax, word [IMAGE_BASE + edx + 6]
mov [NumberOfSections], eax
; resize app memory and load sections to their virtual address
mov eax, IMAGE_BASE
add eax, [SizeOfImage]
push eax
call realloc.app.mem
mov ecx, [NumberOfSections]
next_section:
lea eax, [ecx - 1]
lea eax, [eax * 4 + eax]
lea eax, [eax * 8]
add eax, IMAGE_BASE
add eax, [SectionsTable]
push dword [file_path] ; filepath
dec esp
mov [esp], byte 0
mov edx, [eax + 12]
add edx, IMAGE_BASE
push edx ; buffer (IMAGE_SECTION_HEADER.VirtualAddress)
push dword [eax + 16] ; count (IMAGE_SECTION_HEADER.SizeOfRawData)
push dword 0
push dword [eax + 20] ; position (IMAGE_SECTION_HEADER.PointerToRawData)
push dword 0
mov ebx, esp
mov eax, 70
int 64
dec ecx
jnz next_section
mov eax, [NumberOfSections]
lea eax, [eax * 4 + eax]
lea eax, [eax * 4 + eax]
add esp, eax ; restore our stack top
; ==========================================================
%if 0 ; comment
push sz_console
call load.library
; mov [console], eax
mov ecx, eax
mov ebx, getprocaddress
push ecx
push sz_con_init
call ebx
mov [con_init], eax
push ecx
push sz_con_write_asciiz
call ebx
mov [con_write_asciiz], eax
push ecx
push sz_con_exit
call ebx
mov [con_exit], eax
push sz_pe_load
push -1
push -1
push -1
push -1
call [con_init]
mov ecx, [NumberOfSections]
next_sect:
lea eax, [ecx - 1]
lea eax, [eax * 4 + eax]
lea eax, [eax * 8]
add eax, IMAGE_BASE
add eax, [SectionsTable]
push eax
push eax
call [con_write_asciiz]
push sz_space_colon_space
call [con_write_asciiz]
pop eax
add eax, 20
mov eax, [eax]
push eax
push msg_buffer
call int2str
push msg_buffer
call [con_write_asciiz]
push sz_new_line
call [con_write_asciiz]
dec ecx
jnz next_sect
%endif ; endcomment
; ==============================================
; program.path = program.path_without_filename & "lib/"
mov edi, [program.path]
xor al, al
xor ecx, ecx
dec ecx
repne scasb
std
mov al, "/"
repne scasb
cld
inc edi
inc edi
mov eax, "lib/"
stosd
;
mov [lib_name], edi
xor ecx, ecx
next_descriptor:
lea eax, [ecx * 4 + ecx]
lea eax, [eax * 4]
add eax, IMAGE_BASE
add eax, [Import]
mov edx, [eax + 12]
add edx, IMAGE_BASE
%if 0 ; comment
pushad
push edx
call [con_write_asciiz]
push sz_new_line
call [con_write_asciiz]
popad
%endif ; endcomment
pushad
; concatenate (program.path_without_filename & "lib/") & lib_name
mov esi, edx
mov edi, [lib_name]
.copy_lib_name:
lodsb
stosb
test al, al
jnz .copy_lib_name
; try to load library
push dword [program.path]
call load.library
test eax, eax
jnz .lib_loaded
; concatenate "Error load library: " & lib_name
sub edi, [lib_name]
mov esi, edi
mov edi, err_load_library
xor al, al
xor ecx, ecx
dec ecx
repne scasb
dec edi
mov ecx, esi
mov esi, edx
rep movsb
;
popad
mov [ERROR_MESSAGE], dword err_load_library
jmp ERROR
.lib_loaded:
mov [lib], eax
popad
xor ebx, ebx
next_function:
mov edx, [eax + 16]
lea esi, [edx + ebx * 4 + IMAGE_BASE]
mov [func], esi
mov edx, [esi]
test edx, edx
jz .done
inc edx
inc edx
add edx, IMAGE_BASE
%if 0 ; comment
pushad
push edx
call [con_write_asciiz]
push sz_new_line
call [con_write_asciiz]
popad
%endif ; endcomment
pushad
mov [func_name], edx
; look for address of imported function
push dword [lib]
push edx
call getprocaddress
test eax, eax
jnz .func_found
popad
; concatenate "Not found function: " & name of function
mov edi, err_func_not_found
xor al, al
xor ecx, ecx
dec ecx
repne scasb
dec edi
mov esi, edx
.copy_func_name:
lodsb
stosb
test al, al
jnz .copy_func_name
;
dec edi
mov eax, " in "
stosd
mov esi, [lib_name]
.copy_lib_name:
lodsb
stosb
test al, al
jnz .copy_lib_name
mov [ERROR_MESSAGE], dword err_func_not_found
jmp ERROR
.func_found:
mov edx, [func]
mov [edx], eax
popad
inc ebx
jmp next_function
.done:
inc ecx
lea eax, [ecx * 4 + ecx]
lea eax, [eax * 4]
add eax, IMAGE_BASE
add eax, [Import]
mov eax, [eax + 12]
cmp eax, dword 0
jnz next_descriptor
; set.current.directory
mov edi, [file_path]
xor al, al
xor ecx, ecx
dec ecx
repne scasb
std
mov al, "/"
repne scasb
cld
mov [edi + 1], byte 0
push dword [file_path]
call set.current.directory
mov [edi + 1], byte "/" ; restore full file_path
; ---------------------- ;
; call load_console_lib ;
; ---------------------- ;
; go to EntryPoint
mov eax, [EntryPoint]
add eax, IMAGE_BASE
jmp eax
; push dword [EntryPoint]
; push msg_buffer
; call int2str
; push msg_buffer
; call [con_write_asciiz]
%if 0 ; comment
push 0
call [con_exit]
%endif ; endcomment
%if 0 ; comment
; dump ---------------------------------------
push dword dump_path;filepath
dec esp
mov [esp], byte 0
push dword 0 ;buffer
mov eax, IMAGE_BASE
add eax, [SizeOfImage]
push eax;count
push dword 0
push dword 0;position
push dword 2
mov ebx, esp
mov eax, 70
int 64
xor eax, eax
dec eax
int 64
dump_path db "/hd3/1/dump.bin",0
%endif ; endcomment
; ==========================================================
ERROR:
push sz_console
call load.library
; mov [console], eax
mov ecx, eax
mov ebx, getprocaddress
push ecx
push sz_con_init
call ebx
mov [con_init], eax
push ecx
push sz_con_write_asciiz
call ebx
mov [con_write_asciiz], eax
push ecx
push sz_con_exit
call ebx
mov [con_exit], eax
push sz_pe_load
push -1
push -1
push -1
push -1
call [con_init]
push dword [ERROR_MESSAGE]
call [con_write_asciiz]
push 0
call [con_exit]
xor eax, eax
dec eax
int 64
; load_console_lib:
; push sz_console
; call load.library
; push eax
; push sz_con_init
; call getprocaddress
; mov [con_init], eax
; push sz_empty
; push -1
; push -1
; push -1
; push -1
; call [con_init]
; ret

View File

@ -0,0 +1,868 @@
; ------------------------------------------------------------- ;
; KWINE is a fork of program PELoad written by 0CodErr
; author - rgimad
; ------------------------------------------------------------- ;
; standard device (Winbase.h)
%define STD_INPUT_HANDLE -10
%define STD_OUTPUT_HANDLE -11
%define STD_ERROR_HANDLE -12
; starting point for file pointer move (Winbase.h)
%define FILE_BEGIN 0 ; zero or beginning of file
%define FILE_CURRENT 1 ; current value of file pointer
%define FILE_END 2 ; current end-of-file position
; file system operation codes (kernel/trunk/fs/fs_lfn.inc)
%define F70_READ_F 0 ; read file
%define F70_READ_D 1 ; read folder
%define F70_CREATE_F 2 ; create/rewrite file
%define F70_WRITE_F 3 ; write/append to file
%define F70_SETSIZE_F 4 ; set end of file
%define F70_GETATTR_FD 5 ; get file/directory attributes structure
%define F70_SETATTR_FD 6 ; set file/directory attributes structure
%define F70_START_F 7 ; start application
%define F70_DELETE_FD 8 ; delete file
%define F70_CREATE_D 9 ; create directory
; action to take on file that exists or does not exist (Winbase.h)
%define CREATE_NEW 1 ; creates a new file, only if it does not already exist
%define CREATE_ALWAYS 2 ; creates new file, always
%define OPEN_EXISTING 3 ; opens file, only if it exists
%define OPEN_ALWAYS 4 ; opens file, always
%define TRUNCATE_EXISTING 5 ; opens file and truncates it so that its size is zero bytes, only if it exists
%define INVALID_HANDLE_VALUE -1
%define INVALID_FILE_SIZE -1
GLOBAL EXPORTS
section '.exprt' align 16
;**********************************************************************************
EXPORTS: ;/////////////////////////////////////////////////////////////////////////
;**********************************************************************************
dd sz_ExitProcess, ExitProcess
dd sz_GetStdHandle, GetStdHandle
dd sz_SetConsoleMode, SetConsoleMode
dd sz_WriteFile, WriteFile
dd sz_ReadFile, ReadFile
dd sz_GetCommandLineA, GetCommandLineA
dd sz_GlobalAlloc, GlobalAlloc
dd sz_GlobalFree, GlobalFree
dd sz_GlobalReAlloc, GlobalReAlloc
dd sz_Sleep, Sleep
dd sz_FlushConsoleInputBuffer, FlushConsoleInputBuffer
dd sz_CloseHandle, CloseHandle
dd sz_GetFileSize, GetFileSize
dd sz_CreateFileA, CreateFileA
dd sz_SetFilePointer, SetFilePointer
dd sz_VirtualAlloc, VirtualAlloc
dd sz_VirtualFree, VirtualFree
dd sz_SetConsoleCursorPosition, SetConsoleCursorPosition
dd sz_DeleteFileA, DeleteFileA
dd sz_FindClose, FindClose
dd sz_FindFirstFileA, FindFirstFileA
dd sz_GetLocalTime, GetLocalTime
dd sz_GetLastError, GetLastError
dd sz_GetProcessHeap, GetProcessHeap
dd sz_HeapAlloc, HeapAlloc
dd sz_HeapFree, HeapFree
dd sz_HeapReAlloc, HeapReAlloc
dd 0
sz_ExitProcess db "ExitProcess",0
sz_GetStdHandle db "GetStdHandle",0
sz_SetConsoleMode db "SetConsoleMode",0
sz_WriteFile db "WriteFile",0
sz_ReadFile db "ReadFile",0
sz_GetCommandLineA db "GetCommandLineA",0
sz_GlobalAlloc db "GlobalAlloc",0
sz_GlobalFree db "GlobalFree",0
sz_GlobalReAlloc db "GlobalReAlloc",0
sz_Sleep db "Sleep",0
sz_FlushConsoleInputBuffer db "FlushConsoleInputBuffer",0
sz_CloseHandle db "CloseHandle",0
sz_GetFileSize db "GetFileSize",0
sz_CreateFileA db "CreateFileA",0
sz_SetFilePointer db "SetFilePointer",0
sz_VirtualAlloc db "VirtualAlloc",0
sz_VirtualFree db "VirtualFree",0
sz_SetConsoleCursorPosition db "SetConsoleCursorPosition",0
sz_DeleteFileA db "DeleteFileA",0
sz_FindClose db "FindClose",0
sz_FindFirstFileA db "FindFirstFileA",0
sz_GetLocalTime db "GetLocalTime",0
sz_GetLastError db "GetLastError",0
sz_GetProcessHeap db "GetProcessHeap",0
sz_HeapAlloc db "HeapAlloc",0
sz_HeapFree db "HeapFree",0
sz_HeapReAlloc db "HeapReAlloc",0
section '.code' align 16
align 16
;**********************************************************************************
ExitProcess: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
xor eax, eax
dec eax
int 64
; ret not need
align 16
;**********************************************************************************
GetStdHandle: ;////////////////////////////////////////////////////////////////////
;**********************************************************************************
push ebx
push esi
push edi
; if already loaded then do nothing
cmp [console], dword 0
jne .do_nothing
push sz_console
call load.library
mov [console], eax
mov ecx, eax
mov ebx, getprocaddress
push ecx
push sz_con_init
call ebx
mov [con_init], eax
push ecx
push sz_con_write_asciiz
call ebx
mov [con_write_asciiz], eax
push ecx
push sz_con_exit
call ebx
mov [con_exit], eax
push ecx
push sz_con_gets
call ebx
mov [con_gets], eax
push ecx
push sz_con_write_string
call ebx
mov [con_write_string], eax
push ecx
push sz_con_set_flags
call ebx
mov [con_set_flags], eax
push ecx
push sz_con_set_cursor_pos
call ebx
mov [con_set_cursor_pos], eax
push ecx
push sz_con_printf
call ebx
mov [con_printf], eax
mov eax, [28]
cmp [eax], byte 34 ; quote
jne .no_quote
inc eax
.no_quote:
push eax
push -1
push -1
push -1
push -1
call [con_init]
.do_nothing:
mov eax, con_handle ; return pointer to console descriptor
pop edi
pop esi
pop ebx
ret 4
align 16
;**********************************************************************************
WriteFile: ;///////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hFile [ebp + 8] ; handle to the file
%define lpBuffer [ebp + 12] ; pointer to buffer containing data
%define nNumberOfBytesToWrite [ebp + 16] ; number of bytes to be written
%define lpNumberOfBytesWritten [ebp + 20] ; pointer to variable that receives number of bytes written
%define lpOverlapped [ebp + 24] ; pointer to OVERLAPPED structure
push ebp
mov ebp, esp
push ebx
push esi
push edi
;---------
mov eax, hFile
cmp [eax + 8], dword "CON"
je .con
lea edx, [eax + 8]
push edx ;filepath
dec esp
mov [esp], byte 0
push dword lpBuffer ;buffer
push dword nNumberOfBytesToWrite;count
push dword 0
push dword [eax + 4];position ; in InternalFileInfo in libio
push dword F70_WRITE_F
mov ebx, esp
mov eax, 70
int 64
add esp, 25 ; restore stack
mov edx, lpNumberOfBytesWritten
mov [edx], ebx
mov edx, hFile
add [edx + 4], ebx
jmp .exit
.con:
; push dword lpBuffer
; call [con_printf]
; add esp, 4
push dword nNumberOfBytesToWrite
push dword lpBuffer
call [con_write_string]
; push dword lpBuffer
; call [con_write_asciiz]
.exit:
;---------
pop edi
pop esi
pop ebx
pop ebp
ret 20
%undef hFile
%undef lpBuffer
%undef nNumberOfBytesToWrite
%undef lpNumberOfBytesWritten
%undef lpOverlapped
align 16
;**********************************************************************************
ReadFile: ;////////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hFile [ebp + 8] ; handle to the file
%define lpBuffer [ebp + 12] ; pointer to buffer that receives data
%define nNumberOfBytesToRead [ebp + 16] ; maximum number of bytes to read
%define lpNumberOfBytesRead [ebp + 20] ; pointer to variable that receives number of bytes read
%define lpOverlapped [ebp + 24] ; pointer to OVERLAPPED structure
push ebp
mov ebp, esp
push ebx
push esi
push edi
; push dword 0
; call GetStdHandle
;---------
mov eax, hFile
cmp [eax + 8], dword "CON"
je .con
; lea eax, [eax + 8]
; push eax
; call [con_write_asciiz]
lea edx, [eax + 8]
push edx ;filepath
dec esp
mov [esp], byte 0
push dword lpBuffer ;buffer
push dword nNumberOfBytesToRead;count
push dword 0
push dword [eax + 4];position ; in InternalFileInfo in libio
push dword F70_READ_F
mov ebx, esp
mov eax, 70
int 64
add esp, 25 ; restore stack
mov edx, lpNumberOfBytesRead
mov [edx], ebx
mov edx, hFile
add [edx + 4], ebx
jmp .exit
.con:
push dword nNumberOfBytesToRead
push dword lpBuffer
call [con_gets]
.exit:
;---------
pop edi
pop esi
pop ebx
pop ebp
ret 20
%undef hFile
%undef lpBuffer
%undef nNumberOfBytesToRead
%undef lpNumberOfBytesRead
%undef lpOverlapped
align 16
;**********************************************************************************
SetConsoleMode: ;//////////////////////////////////////////////////////////////////
;**********************************************************************************
; ignore input parameters
xor eax, eax
dec eax
ret 8
align 16
;**********************************************************************************
GetCommandLineA: ;/////////////////////////////////////////////////////////////////
;**********************************************************************************
push edi
mov edi, [28]
xor al, al
xor ecx, ecx
dec ecx
repne scasb
mov eax, edi
pop edi
ret
align 16
;**********************************************************************************
GlobalAlloc: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define uFlags [esp + 4 +1*4] ; memory allocation attributes
%define dwBytes [esp + 8 +1*4] ; number of bytes to allocate
push ebx
; uFlags ignored
mov eax, 68
mov ebx, 12
mov ecx, dwBytes
int 64
pop ebx
ret 8
%undef uFlags
%undef dwBytes
align 16
;**********************************************************************************
GlobalFree: ;//////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hMem [esp + 4 +1*4] ; handle to global memory object
push ebx
mov eax, 68
mov ebx, 13
mov ecx, hMem
int 64
pop ebx
ret 4
%undef hMem
align 16
;**********************************************************************************
GlobalReAlloc: ;///////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hMem [esp + 4 +1*4] ; handle to global memory object
%define dwBytes [esp + 8 +1*4] ; new size of memory block in bytes
%define uFlags [esp + 12 +1*4] ; reallocation options
push ebx
; uFlags ignored
mov eax, 68
mov ebx, 20
mov ecx, dwBytes
mov edx, hMem
int 64
pop ebx
ret 12
%undef hMem
%undef dwBytes
%undef uFlags
align 16
;**********************************************************************************
Sleep: ;///////////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define dwMilliseconds [esp + 4 +1*4] ; time interval
push ebx
mov eax, dwMilliseconds
mov ebx, 10
cmp eax, ebx
jae .ae
add eax, 10 ; avoid zero result if dwMilliseconds < 10
.ae:
xor edx, edx
div ebx
mov ebx, eax
mov eax, 5
int 64
pop ebx
ret 4
%undef dwMilliseconds
align 16
;**********************************************************************************
FlushConsoleInputBuffer: ;/////////////////////////////////////////////////////////
;**********************************************************************************
; not implemented correctly
xor eax, eax
dec eax
ret 4
align 16
;**********************************************************************************
CloseHandle: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hObject [esp + 4 +1*4]
push ebx
mov eax, 68
mov ebx, 13
mov ecx, hObject
int 64
pop ebx
ret 4
%undef hObject
align 16
;**********************************************************************************
GetFileSize: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hFile [esp + 4 +3*4]
%define lpFileSizeHigh [esp + 8 +3*4]
push ebx
push esi
push edi
; lpFileSizeHigh ignored
mov [esp - (25 + 40) + 0], dword F70_GETATTR_FD
mov [esp - (25 + 40) + 8], dword 0
mov [esp - (25 + 40) + 20], byte 0
lea eax, [esp - 40]
mov [esp - (25 + 40) + 16], eax
lea ebx, [esp - (25 + 40)]
mov eax, hFile
lea eax, [eax + 8] ; as in InternalFileInfo in libio
mov [esp - (25 + 40) + 21], eax
mov eax, 70
int 64
test eax, eax
jz .no_error
mov eax, INVALID_FILE_SIZE
jmp .exit
.no_error:
mov eax, [esp - (25 + 40) + 25 + 32] ; file.size
.exit:
pop edi
pop esi
pop ebx
ret 8
%undef hFile
%undef lpFileSizeHigh
align 16
;**********************************************************************************
CreateFileA: ;//////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define lpFileName [esp + 4 +3*4]
%define dwDesiredAccess [esp + 8 +3*4]
%define dwShareMode [esp + 12 +3*4]
%define lpSecurityAttributes [esp + 16 +3*4]
%define dwCreationDisposition [esp + 20 +3*4]
%define dwFlagsAndAttributes [esp + 24 +3*4]
%define hTemplateFile [esp + 28 +3*4]
push ebx
push esi
push edi
;---------
; push dword 0
; call GetStdHandle
; push dword lpFileName
; call [con_write_asciiz]
mov eax, 68
mov ebx, 12
mov ecx, 4096
int 64
mov edx, eax
lea edi, [eax + 8] ; as in InternalFileInfo in libio
mov esi, lpFileName
.copy_name:
lodsb
stosb
test al, al
jnz .copy_name
mov eax, dwCreationDisposition
cmp eax, CREATE_ALWAYS
je .create_always
cmp eax, OPEN_EXISTING
je .open_existing
mov eax, INVALID_HANDLE_VALUE
jmp .exit
.open_existing:
lea eax, [edx + 8]
push eax ;filepath
dec esp
mov [esp], byte 0
push dword 0 ; buffer
push dword 0 ; count
push dword 0
push dword 0
push dword F70_READ_F
mov ebx, esp
mov eax, 70
int 64
add esp, 25 ; restore stack
test eax, eax
jz .no_error
mov eax, INVALID_HANDLE_VALUE
jmp .exit
.no_error:
mov eax, edx ; return pointer to file descriptor
jmp .exit
.create_always:
lea eax, [edx + 8]
push eax ;filepath
dec esp
mov [esp], byte 0
push dword 0 ; buffer
push dword 0 ; count
push dword 0
push dword 0
push dword F70_CREATE_F
mov ebx, esp
mov eax, 70
int 64
add esp, 25 ; restore stack
mov eax, edx ; return pointer to file descriptor
jmp .exit
.exit:
;---------
pop edi
pop esi
pop ebx
ret 28
%undef lpFileName
%undef dwDesiredAccess
%undef dwShareMode
%undef lpSecurityAttributes
%undef dwCreationDisposition
%undef dwFlagsAndAttributes
%undef hTemplateFile
align 16
;**********************************************************************************
SetFilePointer: ;//////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hFile [esp + 4 +3*4]
%define lDistanceToMove [esp + 8 +3*4]
%define lpDistanceToMoveHigh [esp + 12 +3*4]
%define dwMoveMethod [esp + 16 +3*4]
push ebx
push esi
push edi
;---------
mov eax, hFile
cmp dwMoveMethod, dword FILE_BEGIN
je .FILE_BEGIN
cmp dwMoveMethod, dword FILE_CURRENT
je .FILE_CURRENT
jmp .FILE_END
.FILE_BEGIN:
mov edx, lDistanceToMove
mov [eax + 4], edx
jmp .exit
.FILE_CURRENT:
mov edx, lDistanceToMove
add [eax + 4], edx
jmp .exit
.FILE_END:
push dword 0
push eax
call GetFileSize
mov edx, eax
mov eax, hFile
mov [eax + 4], edx
mov edx, lDistanceToMove
add [eax + 4], edx
.exit:
mov eax, [eax + 4]
;---------
pop edi
pop esi
pop ebx
ret 16
%undef hFile
%undef lDistanceToMove
%undef lpDistanceToMoveHigh
%undef dwMoveMethod
align 16
;**********************************************************************************
VirtualAlloc: ;////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define lpAddress [esp + 4 +1*4]
%define dwSize [esp + 8 +1*4]
%define flAllocationType [esp + 12 +1*4]
%define flProtect [esp + 16 +1*4]
push ebx
mov eax, 68
mov ebx, 12
mov ecx, dwSize
int 64
pop ebx
ret 16
%undef lpAddress
%undef dwSize
%undef flAllocationType
%undef flProtect
align 16
;**********************************************************************************
VirtualFree: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define lpAddress [esp + 4 +1*4]
%define dwSize [esp + 8 +1*4]
%define dwFreeType [esp + 12 +1*4]
push ebx
mov eax, 68
mov ebx, 13
mov ecx, lpAddress
int 64
pop ebx
ret 12
%undef lpAddress
%undef dwSize
%undef dwFreeType
align 16
;**********************************************************************************
SetConsoleCursorPosition: ;////////////////////////////////////////////////////////
;**********************************************************************************
%define hConsoleOutput [esp + 4 +3*4]
%define dwCursorPosition [esp + 8 +3*4]
push ebx
push esi
push edi
mov edx, dwCursorPosition
shld eax, edx, 16
shr edx, 16
push eax
push edx
call [con_set_cursor_pos]
pop edi
pop esi
pop ebx
ret 8
%undef hConsoleOutput
%undef dwCursorPosition
align 16
;**********************************************************************************
DeleteFileA: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define lpFileName [esp + 4 +1*4] ; name of file
push ebx
mov [esp - (25 + 40) + 0], dword F70_DELETE_FD
mov [esp - (25 + 40) + 8], dword 0
mov [esp - (25 + 40) + 20], byte 0
lea eax, [esp - 40]
mov [esp - (25 + 40) + 16], eax
lea ebx, [esp - (25 + 40)]
mov eax, lpFileName
mov [esp - (25 + 40) + 21], eax
mov eax, 70
int 64
pop ebx
ret 4
%undef lpFileName
align 16
;**********************************************************************************
FindClose: ;///////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hFindFile [esp + 4 +1*4] ; file search handle
ret 4
%undef hFindFile
align 16
;**********************************************************************************
FindFirstFileA: ;//////////////////////////////////////////////////////////////////
;**********************************************************************************
%define lpFileName [esp + 4 +3*4] ; name of file
%define lpFindFileData [esp + 8 +3*4] ; pointer to WIN32_FIND_DATA structure
push ebx
push esi
push edi
pop edi
pop esi
pop ebx
ret 8
%undef lpFileName
%undef lpFindFileData
align 16
;**********************************************************************************
GetLocalTime: ;///////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define lpSystemTime [esp + 4] ; pointer to SYSTEMTIME structure
; yet not implemented
; mov eax, lpSystemTime
; mov [eax + 0], dword 12345678H
; mov [eax + 4], dword 12345678H
; mov [eax + 8], dword 12345678H
; mov [eax + 12], dword 12345678H
; MSDN: This function does not return a value.
ret 4
%undef lpSystemTime
align 16
;**********************************************************************************
GetLastError: ;////////////////////////////////////////////////////////////////////
;**********************************************************************************
xor eax, eax
ret
align 16
;**********************************************************************************
GetProcessHeap: ;////////////////////////////////////////////////////////////////////
;**********************************************************************************
xor eax, eax
dec eax
ret
align 16
;**********************************************************************************
HeapAlloc: ;///////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hHeap [esp + 4 +1*4]
%define dwFlags [esp + 8 +1*4]
%define dwBytes [esp + 12 +1*4]
push ebx
mov eax, 68
mov ebx, 12
mov ecx, dwBytes
int 64
pop ebx
ret 12
%undef hHeap
%undef dwFlags
%undef dwBytes
align 16
;**********************************************************************************
HeapFree: ;////////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hHeap [esp + 4 +1*4]
%define dwFlags [esp + 8 +1*4]
%define lpMem [esp + 12 +1*4]
push ebx
mov eax, 68
mov ebx, 13
mov ecx, lpMem
int 64
pop ebx
ret 12
%undef hHeap
%undef dwFlags
%undef lpMem
align 16
;**********************************************************************************
HeapReAlloc: ;/////////////////////////////////////////////////////////////////////
;**********************************************************************************
%define hHeap [esp + 4 +1*4]
%define dwFlags [esp + 8 +1*4]
%define lpMem [esp + 12 +1*4]
%define dwBytes [esp + 16 +1*4]
push ebx
mov eax, 68
mov ebx, 20
mov ecx, dwBytes
mov edx, lpMem
int 64
pop ebx
ret 16
%undef hHeap
%undef dwFlags
%undef lpMem
%undef dwBytes
; ------------------------------------------------------------- ;
load.library:
mov eax, 68
mov ebx, 19
mov ecx, [esp + 4]
int 64
ret 4
; ------------------------------------------------------------- ;
getprocaddress:
mov edx, [esp + 8]
xor eax, eax
test edx, edx
jz .end
.next:
xor eax, eax
cmp [edx], dword 0
jz .end
mov esi, [edx]
mov edi, [esp + 4]
.next_:
lodsb
scasb
jne .fail
or al, al
jnz .next_
jmp .ok
.fail:
add edx, 8
jmp .next
.ok:
mov eax, [edx + 4]
.end:
ret 8
; ------------------------------------------------------------- ;
section '.data' align 16
con_init dd 0
con_write_asciiz dd 0
con_exit dd 0
con_gets dd 0
con_write_string dd 0
con_set_flags dd 0
con_set_cursor_pos dd 0
con_printf dd 0
console dd 0
sz_con_init db "con_init",0
sz_con_write_asciiz db "con_write_asciiz",0
sz_con_exit db "con_exit",0
sz_con_gets db "con_gets",0
sz_con_write_string db "con_write_string",0
sz_console db "/sys/lib/console.obj",0
sz_con_set_flags db "con_set_flags",0
sz_con_set_cursor_pos db "con_set_cursor_pos",0
sz_con_printf db "con_printf",0
con_handle:
dd 0
dd 0
dd "CON"

View File

@ -0,0 +1,243 @@
; ------------------------------------------------------------- ;
; KWINE is a fork of program PELoad written by 0CodErr
; author - rgimad
; ------------------------------------------------------------- ;
GLOBAL EXPORTS
section '.exprt' align 16
;**********************************************************************************
EXPORTS: ;/////////////////////////////////////////////////////////////////////////
;**********************************************************************************
dd sz__getch, _getch
dd sz__kbhit, _kbhit
dd sz_printf, printf
dd sz_puts, puts
dd sz_gets, gets
dd sz_strlen, strlen
dd 0
sz__getch db "_getch",0
sz__kbhit db "_kbhit",0
sz_printf db "printf",0
sz_puts db "puts",0
sz_gets db "gets",0
sz_strlen db "strlen",0
section '.code' align 16
align 16
;**********************************************************************************
_getch: ;//////////////////////////////////////////////////////////////////////////
;**********************************************************************************
push ebx
push esi
push edi
call load_console_lib
pop ecx
call [con_getch]
push ecx
pop edi
pop esi
pop ebx
ret
align 16
;**********************************************************************************
_kbhit: ;//////////////////////////////////////////////////////////////////////////
;**********************************************************************************
push ebx
push esi
push edi
call load_console_lib
pop ecx
call [con_kbhit]
push ecx
pop edi
pop esi
pop ebx
ret
align 16
;**********************************************************************************
printf: ;//////////////////////////////////////////////////////////////////////////
;**********************************************************************************
;pushad
;push ebx
;push esi
;push edi
call load_console_lib
;popad
pop ecx
call [con_printf]
push ecx
;pop edi
;pop esi
;pop ebx
ret
align 16
;**********************************************************************************
puts: ;////////////////////////////////////////////////////////////////////////// cdecl
;**********************************************************************************
;push ebx
;push esi
;push edi
call load_console_lib
pop ecx ; pop return address
call [con_write_asciiz]
push ecx ; push return address again
;pop edi
;pop esi
;pop ebx
ret
align 16
;**********************************************************************************
gets: ;////////////////////////////////////////////////////////////////////////// cdecl
;**********************************************************************************
;push ebx
;push esi
;push edi
call load_console_lib
pop ecx
pop edx
push 25 ;; second arg of con_gets assume by default
push edx
call [con_gets]
push ecx
;pop edi
;pop esi
;pop ebx
ret
align 16
;**********************************************************************************
strlen: ;//////////////////////////////////////////////////////////////////////////
;**********************************************************************************
push ebx
push esi
push edi
call load_console_lib
xor eax,eax
mov edi, dword [esp + 4 + 4 + 4 + 4]
.while1:
inc eax
cmp byte [eax + edi], 0
jnz .while1
pop edi
pop esi
pop ebx
ret
load_console_lib: ;; stdcall ?
; if already loaded then do nothing
cmp [console], dword 0
jne .do_nothing
push sz_console
call load.library
mov [console], eax
mov ecx, eax
mov ebx, getprocaddress
;;
push ecx
push sz_con_init
call ebx
mov [con_init], eax
;;
push ecx
push sz_con_getch
call ebx
mov [con_getch], eax
;;
push ecx
push sz_con_kbhit
call ebx
mov [con_kbhit], eax
;;
push ecx
push sz_con_printf
call ebx
mov [con_printf], eax
;;
push ecx
push sz_con_write_asciiz
call ebx
mov [con_write_asciiz], eax
;;
push ecx
push sz_con_gets
call ebx
mov [con_gets], eax
push ecx
push sz_con_init
call ebx
mov [con_init], eax
push con_caption
push -1
push -1
push -1
push -1
call [con_init]
.do_nothing:
ret
; ------------------------------------------------------------- ; stdcall
load.library:
mov eax, 68
mov ebx, 19
mov ecx, [esp + 4]
int 64
ret 4
; ------------------------------------------------------------- ;
getprocaddress:
mov edx, [esp + 8]
xor eax, eax
test edx, edx
jz .end
.next:
xor eax, eax
cmp [edx], dword 0
jz .end
mov esi, [edx]
mov edi, [esp + 4]
.next_:
lodsb
scasb
jne .fail
or al, al
jnz .next_
jmp .ok
.fail:
add edx, 8
jmp .next
.ok:
mov eax, [edx + 4]
.end:
ret 8
; ------------------------------------------------------------- ;
section '.data' align 16
con_caption db "test!",0
con_init dd 0
con_getch dd 0
con_kbhit dd 0
con_printf dd 0
con_write_asciiz dd 0
con_gets dd 0
console dd 0
sz_con_init db "con_init",0
sz_con_getch db "con_getch",0
sz_con_kbhit db "con_kbhit",0
sz_con_printf db "con_printf",0
sz_con_write_asciiz db "con_write_asciiz",0
sz_con_gets db "con_gets",0
sz_console db "/sys/lib/console.obj",0

View File

@ -0,0 +1,22 @@
@echo off
set NASM="nasm\nasm.exe"
%NASM% -f coff "lib\msvcrt.dll.asm" -o "..\lib\msvcrt.dll"
strip --strip-debug "../lib/msvcrt.dll"
%NASM% -f coff "lib/kernel32.dll.asm" -o "../lib/kernel32.dll"
strip --strip-debug "../lib/kernel32.dll"
%NASM% -f bin "kwine.asm" -o "../kwine"
if %errorlevel% == 0 (
echo compiled succesfully.
ubuntu1804 run "mcopy -D o -i ../kolibri.img ../lib/msvcrt.dll ::kwine/lib/msvcrt.dll"
ubuntu1804 run "mcopy -D o -i ../kolibri.img ../lib/kernel32.dll ::kwine/lib/kernel32.dll"
ubuntu1804 run "mcopy -D o -i ../kolibri.img ../kwine ::kwine/kwine"
qemu-system-x86_64 -fda ../kolibri.img -m 256
) else (
echo compilation failed.
)
pause

View File

@ -0,0 +1,5 @@
@echo off
fasm lib\kernel32.dll.asm ..\lib\kernel32.dll
fasm lib\msvcrt.dll.asm ..\lib\msvcrt.dll
fasm kwine.asm ..\kwine
pause

View File

@ -0,0 +1,8 @@
kwine - kolibri wine.
Developers:
- 0CodErr founder of project (PEload)
- rgimad some improvements
Topic:
http://board.kolibrios.org/viewtopic.php?f=9&t=2318&p=74314#p74308

BIN
programs/fs/unimg/unimg Normal file

Binary file not shown.