flat assembler
Message board for the users of flat assembler.

Index > Windows > How can I get Windows OS version during compilation.

Author
Thread Post new topic Reply to topic
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Is there any way to achieve this without actually making API calls?

If not, may I ask Tomasz to include this in the next release.

so like

Code:
   IF %OS% EQU 5
      display "Windows XP"
   ELSE IF %OS% EQU 6
      display "Vista"
   END IF
... and so on
    


Thanks.
Post 10 Sep 2012, 23:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17665
Location: In your JS exploiting you and your system
revolution
I'm curious to know the purpose? Is this useful in some places?
Post 11 Sep 2012, 00:33
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
revolution wrote:
I'm curious to know the purpose? Is this useful in some places?


Well of course it is. I want to make a program using FASM with some hard coded numbers based on the System's OS version and mode(32bit/64bit ).
Post 11 Sep 2012, 01:37
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17665
Location: In your JS exploiting you and your system
revolution
typedef wrote:
I want to make a program using FASM with some hard coded numbers based on the System's OS version and mode(32bit/64bit ).
From the machine that compiles the source? Which could be entirely different from the machine that runs the code.
Post 11 Sep 2012, 02:48
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
revolution wrote:
typedef wrote:
I want to make a program using FASM with some hard coded numbers based on the System's OS version and mode(32bit/64bit ).
From the machine that compiles the source? Which could be entirely different from the machine that runs the code.


I have different OSs. XP, VISTA, Windows 7. The same as having to define a variable or function in C/C++ based on System.

So it seems there's no way. Then we can end this thread.
Post 11 Sep 2012, 03:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17665
Location: In your JS exploiting you and your system
revolution
You can make a file for each target machine OS that you want to compile the code for:
Code:
;MyUberProggyW2K.asm
OS equ W2K
include 'MyUberProggy.inc'    
Code:
;MyUberProggyW7.asm
OS equ W7
include 'MyUberProggy.inc'    
Then you can compile the code for each target machine on any of your development machines, including Linux, Unix or DOS if you wanted to.
Post 11 Sep 2012, 03:40
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Quote:

including Linux, Unix or DOS

I'll never develop for linux/Unix, dunix or trinix or whatever you call them.
Post 11 Sep 2012, 03:49
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
This can help maybe.
Code:
include "%OS%/MyUberProggy.inc"    


I am not sure for the value of %OS% environment variable for different versions of Windows.
Although, you should never make OS dependent compilation. It is very, very bad practice IMHO.
Post 11 Sep 2012, 05:53
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17665
Location: In your JS exploiting you and your system
revolution
JohnFound wrote:
I am not sure for the value of %OS% environment variable for different versions of Windows.
For everything since W2K it says this:
Code:
OS=Windows_NT    
Although I haven't seen it for W8, it might be different there.
Post 11 Sep 2012, 05:59
View user's profile Send private message Visit poster's website 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.