flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Use string as func param

Author
Thread Post new topic Reply to topic
Andrey



Joined: 20 Oct 2008
Posts: 1
Andrey
Hi to all. I am wondering how I can put string as func param. Something like that

Code:
invoke MessageBox,0, SADD("blabla"), SADD("blabla"),MB_OK
    


In masm there are 3 macro which do that.

Code:
; ---------------------
    ; literal string MACRO
    ; ---------------------
      literal MACRO quoted_text:VARARG
        LOCAL local_text
        .data
          local_text db quoted_text,0
        .code
        EXITM <local_text>
      ENDM
    ; --------------------------------
    ; string address in INVOKE format
    ; --------------------------------
      SADD MACRO quoted_text:VARARG
        EXITM <ADDR literal(quoted_text)>
      ENDM 
    ; --------------------------------
    ; string offset for manual coding
    ; --------------------------------
     CTXT MACRO quoted_text:VARARG
        EXITM <offset literal(quoted_text)>
     ENDM

    


But the problem is in that I do not know how to translate this 3 macro into fasm macro code. If some one know please help me.

Thanks in advance.
Post 20 Oct 2008, 16:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
Have a look at the sample program that comes with the Windows version download hello.asm
Code:
; example of simplified Win32 programming using complex macro features

include 'win32ax.inc'

.code

  start:
    invoke  MessageBox,HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK
  invoke  ExitProcess,0

.end start    
Post 20 Oct 2008, 17:19
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Note however that the invoke macro embeds the string on the code instead of storing it on a data section as MASM does.
Post 20 Oct 2008, 18:06
View user's profile Send private message Reply with quote
vador



Joined: 12 Nov 2006
Posts: 68
Location: Madagascar
vador
and if you use a string several times, it will be repeated in the executable
Post 21 Oct 2008, 12:14
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.