flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How can I make one macros based ,I think, on "match&quo

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
I made this:
hMainModule = GetModuleHandle(0)
OSVERSIONINFO_.dwOSVersionInfoSize = sizeof.OSVERSIONINFO
eax = GetVersionEx(OSVERSIONINFO_)

but i don't now how to make:
OSVERSIONINFO_.dwOSVersionInfoSize = sizeof.OSVERSIONINFO

if someone can help me I will be glad. Thank you.
Post 02 Feb 2006, 09:32
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
First, you'll need to include the 'kernel32.inc' include
second, in your '.data' section you'll need:
myosversion OSVERSIONINFO
now you should be able to:
Code:
hMainModule = GetModuleHandle(0) 
OSVERSIONINFO_.dwOSVersionInfoSize = sizeof.OSVERSIONINFO 
eax = GetVersionEx(OSVERSIONINFO_) 
-----------
invoke  GetModuleHandle, 0
mov [myosversion.dwOSVersionInfoSize], sizeof.OSVERSIONINFO
invoke GetVersion, myosversion    


To use 'GetVersionEx' you'll need the new and improved OSVERSIONINFOEX, not defined in the original fasmw incudes, so here it is:

Code:
struct OSVERSIONINFOEXA
       dwOSVersionInfoSize dd ?
       dwMajorVersion dd ?
       dwMinorVersion dd ?
       dwBuildNumber dd ?
       dwPlatformId dd ?
       szCSDVersion db 128 dup(?)
       wServicePackMajor dw ?
       wServicePackMinor dw ?
       wSuiteMask dw ?
       wProductType db ?
       wReserved db ?
ends    
Post 02 Feb 2006, 11:01
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
to madmatt
I don't meen that. I did the code that I wrote.The cod work normal. But I don't know how to do
"OSVERSIONINFO_.dwOSVersionInfoSize = sizeof.OSVERSIONINFO"
I would like to make a macros, and with that macros I would like to write that. I made something like that:
Code:
macro   Add_C_SyntaxToVars      [var] 
{ 
        macro   var     param 
        \{ 
        define status 0 
        match =0 ==src,status param
       \\{ 
                mov [var],param
                define status 1 
        \\}
        match =0 any,status param 
        \\{ 
                unknown syntax 
        \\} 
        \} 
}    

but when I do
Code:
Add_C_SyntaxToVars      OSVERSIONINFO_    

fasm think that OSVERSIONINFO_.dwOSVersionInfoSize is not a macro.
fasm think that a mascro is only OSVERSIONINFO_ .
what can I do?
Post 03 Feb 2006, 17:36
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.