flat assembler
Message board for the users of flat assembler.

Index > Windows > Bug in fasm?

Author
Thread Post new topic Reply to topic
Cthulhu



Joined: 12 May 2005
Posts: 29
Cthulhu 12 May 2005, 12:50
Hello folks!
I'm doing some experiments with Fasm, but in my first try I had the following problem:
Code:
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:

Code:

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?
Post 12 May 2005, 12:50
View user's profile Send private message Reply with quote
flaith



Joined: 07 Feb 2005
Posts: 122
Location: $300:20 58 FC 60 N 300G => Vietnam
flaith 12 May 2005, 14:29
try :

Code:
...
        start:
                push 0
                push DumbTitle
                push DumbString
                push 0
                call [MessageBoxA]              ; change to ptr MessageBoxA

                push 0
                call [ExitProcess]              ; here too
...
    

_________________
Je suis sur de 'rien', mais je ne suis pas sur du 'tout'.
Post 12 May 2005, 14:29
View user's profile Send private message Visit poster's website Reply with quote
Cthulhu



Joined: 12 May 2005
Posts: 29
Cthulhu 12 May 2005, 15:45
It didn't work... the result was the same Sad
Post 12 May 2005, 15:45
View user's profile Send private message Reply with quote
flaith



Joined: 07 Feb 2005
Posts: 122
Location: $300:20 58 FC 60 N 300G => Vietnam
flaith 12 May 2005, 15:51
the whole code :

Code:
format PE GUI 4.0
entry start

include '%fasminc%\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]              ; change to ptr MessageBoxA

                push 0
                call [ExitProcess]              ; here too

;---------------
;tabela de importacao
;---------------
section '.3' import data readable writeable

                library Kernel32,'Kernel32.dll',\
                        User32,'User32.dll'                  ; changed here too

                import User32,MessageBoxA,'MessageBoxA'
                import Kernel32,ExitProcess,'ExitProcess'
    

_________________
Je suis sur de 'rien', mais je ne suis pas sur du 'tout'.
Post 12 May 2005, 15:51
View user's profile Send private message Visit poster's website Reply with quote
Cthulhu



Joined: 12 May 2005
Posts: 29
Cthulhu 12 May 2005, 15:58
Thanks friend!
Now it works Smile
Fasm looks great I think I'll move entirely to it.
Post 12 May 2005, 15:58
View user's profile Send private message Reply with quote
flaith



Joined: 07 Feb 2005
Posts: 122
Location: $300:20 58 FC 60 N 300G => Vietnam
flaith 12 May 2005, 16:07
Cthulhu wrote:
Thanks friend!
Now it works Smile
Fasm looks great I think I'll move entirely to it.


me too Very Happy

_________________
Je suis sur de 'rien', mais je ne suis pas sur du 'tout'.
Post 12 May 2005, 16:07
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.