flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Locals and parameters.

Author
Thread Post new topic Reply to topic
booter



Joined: 08 Dec 2006
Posts: 67
booter 03 May 2009, 09:17
I'm rather confused with proc parameters and locals.
Why can't I use them the same way as "outside" variables?
Code:
StdOutHdl   dd 0  ; handle
 ...
macro TstTst
{stdcall Test,handle}
 ...
proc Test hdl:DWORD
  invoke  WriteFile,[StdOutHdl], ...   ; OK
  invoke  WriteFile,hdl, ... ; compile error (why?)
  invoke  WriteFile,addr hdl, ... ; doesn't work 
  invoke  WriteFile,[hdl], ... ; doesn't work 
endp    

I found some (ugly) solution, but why would I need this?
Code:
  mov     ebx,[hdl]
  mov     ebx,[ebx]
  invoke  WriteFile,ebx, ... ; works    
Post 03 May 2009, 09:17
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 03 May 2009, 09:52
Works for me:
Code:
include 'win32ax.inc'

proc start hd1:DWORD
  invoke  WriteFile,[hd1]
     invoke  WriteFile,addr hd1
endp

macro A param,[arg] {nop}

macro B [arg]{
  common
  A xyz,arg
}

B 1,2,3,4

.end start    
Post 03 May 2009, 09:52
View user's profile Send private message Visit poster's website Reply with quote
Neutrino



Joined: 18 Dec 2008
Posts: 2
Neutrino 04 May 2009, 08:22
To get variable value you should use brackets:
Code:
  macro TstTst   {stdcall Test,[handle]}     

and:
Code:
  invoke  WriteFile,[hdl], ...    
Post 04 May 2009, 08:22
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.