Hello folks!
I'm doing some experiments with Fasm, but in my first try I had the following problem:
The above code compiles without error or warning but it gives a GPF when I run it. I debugged it with Ollydbg to see what was wrong and I saw the following:
Whell the MessageBoxA api wasn't compiled correctly.
Is it a bug in fasm?
I'm doing some experiments with Fasm, but in my first try I had the following problem:
format PE GUI 4.0
entry start
include 'include\win32a.inc'
;---------------
;secao de dados
;---------------
section '.1' data readable writeable
DumbString db "Hello world!",0
DumbTitle db "Dumb Title",0
;---------------
;secao de codigo
;---------------
section '.2' code readable executable
start:
push 0
push DumbTitle
push DumbString
push 0
call MessageBoxA
push 0
call ExitProcess
;---------------
;tabela de importacao
;---------------
section '.3' import data readable writeable
library Kernel32,'Kernel32.dll'
library User32,'User32.dll'
import User32,MessageBoxA,'MessageBoxA'
import Kernel32,ExitProcess,'ExitProcess'
The above code compiles without error or warning but it gives a GPF when I run it. I debugged it with Ollydbg to see what was wrong and I saw the following:
00402000 > $ 6A 00 PUSH 0
00402002 . 68 0F104000 PUSH silvio.0040100F ; ASCII "Dumb Title"
00402007 . 68 00104000 PUSH silvio.00401000 ; ASCII "Hello world!"
0040200C . 6A 00 PUSH 0
0040200E . E8 5D100000 CALL silvio.00403070
00402013 . 6A 00 PUSH 0
00402015 . E8 74100000 CALL <&Kernel32.ExitProcess>
Whell the MessageBoxA api wasn't compiled correctly.
Is it a bug in fasm?
Whell the MessageBoxA api wasn't compiled correctly.
Is it a bug in fasm?
No. You used the "library" macro inappropriately. There were other errors, too. The code below works.
format PE GUI 4.0
entry start
include '%include%\win32a.inc'
;---------------
;secao de dados
;---------------
section '.1' data readable writeable
DumbString db "Hello world!",0
DumbTitle db "Dumb Title",0
;---------------
;secao de codigo
;---------------
section '.2' code readable executable
start:
push 0
push DumbTitle
push DumbString
push 0
call
push 0
call
;---------------
;tabela de importacao
;---------------
section '.3' import data readable writeable
library Kernel32,'Kernel32.dll', \
User32,'User32.dll'
import User32,MessageBoxA,'MessageBoxA'
import Kernel32,ExitProcess,'ExitProcess'
Thank you very much friend!
Now it works
Now it works