flat assembler
Message board for the users of flat assembler.

Index > Windows > struct(macro argument)

Author
Thread Post new topic Reply to topic
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex
Simple question that I couldn't find an answer for.

Code:
[...]
stem SYSTEMTIME
[...]
invoke GetLocalTime,stem
[...]
macro tim tst
{
 [...]
 xor eax,eax
 mov ax,[tst.wDay]
 [...]
}    


Quote:
Error: undefined symbol 'tst.wDay'.


If I use [stem] in the macro directly - it works.
How do I pass the structure as an argument to it?
Post 27 Jul 2010, 14:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Use the hash:
Code:
mov ax,[tst#.wDay]    
Post 27 Jul 2010, 14:25
View user's profile Send private message Visit poster's website Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex
Yes. That worked. #

Now why didn't I find that anywhere?
If you don't have a source where I can read about it (which I am sure you will, but) - how does it work?
Post 27 Jul 2010, 14:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Inside macroinstruction also special operator # can be used. This operator causes two names to be concatenated into one name. It can be useful, because it's done after the arguments and local names are replaced with their values.
Post 27 Jul 2010, 14:51
View user's profile Send private message Visit poster's website Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex
Now I remember.
Thank you.
Post 27 Jul 2010, 14:53
View user's profile Send private message Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex
It's offtopic, but it's too small of a question to start a new thread about.

Code:
[...]
lamb rb 128
[...]
;do something with lamb
mov dword[lamb],0
[...]    


I want to "clear" [lamb], as I append strings to it.
Is this a correct way to do so?
If not - what is the correct way?

Again - sorry for the offtopic.
Post 27 Jul 2010, 21:29
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Do you want to clear (set to zero) the entire 128 bytes? Are you using null terminated strings?
Post 27 Jul 2010, 21:35
View user's profile Send private message Visit poster's website Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex
Yes. Yes.
Post 27 Jul 2010, 22:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
Since you are using null terminated strings then this will suffice:
Code:
mov [lamb],0    
There is no need to clear the entire array, the first zero is enough.
Post 27 Jul 2010, 22:23
View user's profile Send private message Visit poster's website Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex
Thanks.
You've been very helpful.
Post 27 Jul 2010, 22:26
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.