flat assembler
Message board for the users of flat assembler.

Index > Windows > MessageBox without macros [MASM > FASM]

Author
Thread Post new topic Reply to topic
Izu1



Joined: 15 Feb 2010
Posts: 4
Izu1 15 Feb 2010, 12:01
Hello everyone, can somebody show how to convert this to fasm? I read that offsets are don't exist in fasm, so how would you pass string as an argument?

Code:
      jmp @F
      szDlgTitle    db "Minimum MASM",0
      szMsg         db "  --- Assembler Pure and Simple ---  ",0
    @@:

    push MB_OK
    push offset szDlgTitle
    push offset szMsg
    push 0
    call MessageBox
    


thanks for help.
Post 15 Feb 2010, 12:01
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Feb 2010, 12:31
in FASM, name of label always stands for offset. Eg. if "szMsg" is at offset 403020, then "mov eax, szMsg" means "mov eax, 403020", and "mov eax, [szMsg]" means "mov eax, [403020]". First moves offset, second moves value at offset. BTW, this is same in NASM.
Post 15 Feb 2010, 12:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Izu1



Joined: 15 Feb 2010
Posts: 4
Izu1 15 Feb 2010, 12:40
This still doesnt compile, says write failed.
Code:
  
    push MB_OK
    push szDlgTitle
    push szMsg
    push 0
    call [MessageBox]
    
Post 15 Feb 2010, 12:40
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1403
Location: Piraeus, Greece
Picnic 15 Feb 2010, 12:48
Hi Izu1,

Perhaps an instance of the application keep running in the background?
Post 15 Feb 2010, 12:48
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Feb 2010, 13:17
Write failed means the output file can't be (re)written. You probably didn't finish your application, and it is still running (so the EXE file is locked and can't be overwritten by FASM). Hit CTRL+ALT+DEL and kill it.
Post 15 Feb 2010, 13:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Izu1



Joined: 15 Feb 2010
Posts: 4
Izu1 15 Feb 2010, 13:51
Yes seems like the process did not terminate properly... Laughing by the way should I adjust the stack after pushing parameters on it? or is it adjusted by api when it returns?
Post 15 Feb 2010, 13:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20481
Location: In your JS exploiting you and your system
revolution 15 Feb 2010, 13:56
Standard call (stdcall) spec says that the stack is adjusted by the callee. So you don't have to adjust it.
Post 15 Feb 2010, 13:56
View user's profile Send private message Visit poster's website Reply with quote
Izu1



Joined: 15 Feb 2010
Posts: 4
Izu1 15 Feb 2010, 14:21
thanks for help everyone, I'm still kind of new to assembler programming and completely new to fasm.
Post 15 Feb 2010, 14:21
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1403
Location: Piraeus, Greece
Picnic 29 Apr 2010, 20:38
Hi everyone,

Why this code output is 321 in MASM and 123 in FASM?

Code:
.686
.model flat, stdcall

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.data
    msg  dd 0,0

.code
main:
       mov [msg], "123"
  invoke MessageBox, 0,  ADDR msg,  0, 0
      invoke ExitProcess, 0
end main
    


Code:
    format pe console 4.0
    include 'win32ax.inc'

.data
    msg  dd 0,0

.code
main:
    mov [msg], "123"
    invoke MessageBox, 0, addr msg,  0, 0
    invoke ExitProcess, 0
.end main
    
Post 29 Apr 2010, 20:38
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8361
Location: Kraków, Poland
Tomasz Grysztar 29 Apr 2010, 20:55
See fasm's FAQ, third question.
Post 29 Apr 2010, 20:55
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1403
Location: Piraeus, Greece
Picnic 29 Apr 2010, 21:16
Thanks for response Tomasz Grysztar.
Post 29 Apr 2010, 21:16
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.