flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How to use PUSHD macro to push the offset?

Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20516
Location: In your JS exploiting you and your system
revolution 06 Nov 2004, 03:03
The PUSHD macro (in WIN32AX.INC) has the following line:

Code:
  else if _ # first in <_addr first,_ADDR first>
    


And it appears as thought it is meant to allow the pushing of an offset.
So I tried the following:

Code:
 stdcall _foo,eax,19,ecx,addr [esi+_is.bar],addr [esi+_is.tar]
    


It does not work and I get compile error "error: undefined symbol."

How can I take advantage of the PUSHD macro to push the offsets?

I know I can manually use the following but it is ugly and not clear.

Code:
 lea edx,[esi+_is.tar]
 push edx
 lea edx,[esi+_is.bar]
 stdcall _foo,eax,19,ecx,edx
    
Post 06 Nov 2004, 03:03
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 06 Nov 2004, 15:07
pushd is not a macro, it is an instruction. Afaik, in order to push a non immediate offset (one that cannot be calculated at compile time), you will need lea as you do. The same construct is used by MASM when you use addr, the difference is that eax will be used.
Post 06 Nov 2004, 15:07
View user's profile Send private message Yahoo Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 06 Nov 2004, 16:03
It should be
Code:
stdcall _foo,eax,19,ecx,addr esi+_is.bar,addr esi+_is.tar    
Post 06 Nov 2004, 16:03
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20516
Location: In your JS exploiting you and your system
revolution 06 Nov 2004, 16:45
Oh yeah, I can see how it works now.

I had copied the PUSHD macro to my code but omitted to copy the line "addr equ".

The error I got was actually "addr symbol undefined", but I did not know because the error does not explicitly say which symbol was undefined.

Actually, since it came up, is it possible to get the error function in FASM to print which symbol it cannot find when such an error occurs?

Sometimes I find that a long stdcall line with many symbols can make tracing a "symbol undefined" error troublesome.
Post 06 Nov 2004, 16:45
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 06 Nov 2004, 16:50
Where`s pushd macro?
Post 06 Nov 2004, 16:50
View user's profile Send private message Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20516
Location: In your JS exploiting you and your system
revolution 06 Nov 2004, 19:57
Quote:

The PUSHD macro (in WIN32AX.INC) has the following line
Post 06 Nov 2004, 19:57
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 06 Nov 2004, 21:11
Embarassed thanks
Post 06 Nov 2004, 21:11
View user's profile Send private message Yahoo Messenger 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.