flat assembler
Message board for the users of flat assembler.

Index > Windows > Please help me solve it.

Author
Thread Post new topic Reply to topic
Lan



Joined: 11 Mar 2025
Posts: 1
Lan 11 Mar 2025, 05:37

hello.asm

Code:
format PE GUI
entry start

include "D:\Program Files (x86)\Fresh\include\win32\win32a.inc"

section ".idata" import data readable
    library kernel, "kernel32.dll"
    library user, "user32.dll"

    import kernel, \
        ExitProcess, "ExitProcess"
    import user, \
        MessageBoxA, "MessageBoxA"

section ".data" data readable writable
    title db "hello.asm", 0
    message db "Hello!", 0

section ".text" code executable readable
start:
    push 0
    push title
    push message
    push 0
    call [MessageBoxA]

    push eax
    call [ExitProcess]
    

When I run it, I cannot see the MessageBoxA.


Description:
Download
Filename: hello.asm
Filesize: 603 Bytes
Downloaded: 19 Time(s)

Post 11 Mar 2025, 05:37
View user's profile Send private message Reply with quote
Hrstka



Joined: 05 May 2008
Posts: 63
Location: Czech republic
Hrstka 11 Mar 2025, 08:20
Use library only once. This works for me:
Code:
    library kernel, "kernel32.dll",\
            user, "user32.dll"    
Post 11 Mar 2025, 08:20
View user's profile Send private message Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 8
FoXx 11 Mar 2025, 11:45
in FASM does not appear twice. Why is it declared as MessageBoxA?
Post 11 Mar 2025, 11:45
View user's profile Send private message Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 41
Location: Socket in motherboard
Core i7 11 Mar 2025, 13:38
FoXx wrote:
Why is it declared as MessageBoxA?

The first is an alias, and in quotes is the function name
For example, this also works:
Code:
format   pe gui
include 'win32ax.inc'
entry    start
;//-----------
.code
start:    invoke   FoXx,0,'Hello Fasm',0,0
          invoke   GoToExit,0
;//-----------
section '.idata'   import data readable
library  kernel32,'kernel32.dll',user32,'user32.dll'
import   kernel32, GoToExit,'ExitProcess'
import     user32, FoXx,'MessageBoxA'
    
Post 11 Mar 2025, 13:38
View user's profile Send private message 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.