napisalem sobie program importujacy z dll prosta funkcje.
Na stos wrzucam mu adres jakiegos stringa.
Potem call funkcja, dlaczego musze zwiekszyc esp? Co idzie na stos po push s? Bo call raczej nie powoduje jego zmiany =/ Jak nie zwieksze stosu to sie sypie i w ebx mam sieci.
Kod:
Format PE CONSOLE 4.0
include 'C:\FASM\INCLUDE\WIN32A.INC'
section '.code' code readable executable
push s
call [xxx]
ret
section '.data' data readable writeable
s db 'text',0
section '.idata' data import readable
library msvcrt, 'msvcrt.dll', dll, 'dll.dll'
import msvcrt, printf, 'printf'
import dll, xxx, 'xxx'
section '.data' data readable writeable
lib db 'dll.dll',0
i dll
Kod:
Format PE GUI 4.0 DLL
include 'C:\FASM\INCLUDE\WIN32A.INC'
section '.code' code readable executable
main:
add esp, 4
pop ebx
push 0
push 0
push ebx
push 0
call [mb]
ret
section '.idata' data import readable
library user32, 'user32.dll'
import  user32, mb, 'MessageBoxA'
section '.edata' export data readable
export 0, main, 'xxx'
section '.reloc' data fixups readable discardable