Compile-time defines for Windows versions

Hello,

I have looked for some #define definitions to do the following, but can’t find anything. I may be missing the obvious. What I need is something like this:

#ifdef WINXP
(Windows XP specific code)
#endif
#ifdef WIN2K
(Windows 2000 specific code)
#endif

Are there defines like this, and if so, where?

aTdHvAaNnKcSe,

Barry Kierstein

Hi Barry,

You can use _WIN32_WINNT as the version indicator. It’s value is 0x400 for
Windows NT, 0x500 for 2K, 0x501 for XP.

Of course, you can do something like:

#define WINXP (_WIN32_WINNT >= 0x501)
#define WIN2K (_WIN32_WINNT == 0x500)

etc.


Mats

-----Original Message-----
From: Kierstein, Barry [mailto:barry.kierstein@hp.com]
Sent: Tuesday, February 03, 2004 11:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Compile-time defines for Windows versions

Hello,

I have looked for some #define definitions to do the
following, but can’t find anything. I may be missing the
obvious. What I need is something like this:

#ifdef WINXP
(Windows XP specific code)
#endif
#ifdef WIN2K
(Windows 2000 specific code)
#endif

Are there defines like this, and if so, where?

aTdHvAaNnKcSe,

Barry Kierstein


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

You can add #defines like these in the sources file using USER_C_FLAGS. Your source file will look like the following:

USER_C_FLAGS=$(USER_C_FLAGS) /DYOUR_DEFINE

SOURCES=

USER_C_FLAGS = $(USER_C_FLAGS)

Then you can add
#ifdef YOUR_DEFINE

#endif
to your source code.

Regards,
Gregory

-----Original Message-----
From: Kierstein, Barry [mailto:barry.kierstein@hp.com]
Sent: Tuesday, February 03, 2004 13:29
To: Windows System Software Devs Interest List
Subject: [ntdev] Compile-time defines for Windows versions

Hello,

I have looked for some #define definitions to do the following, but can’t find anything. I may be missing the obvious. What I need is something like this:

#ifdef WINXP
(Windows XP specific code)
#endif
#ifdef WIN2K
(Windows 2000 specific code)
#endif

Are there defines like this, and if so, where?

aTdHvAaNnKcSe,

Barry Kierstein


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@store-age.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

IMPORTANT: Do not open attachments from unrecognized senders


The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or the
sender immediately and do not disclose the contents to any one or make copies.




This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.

check ntverp.h header.
You can use it safely.

----- Original Message -----
From: “Kierstein, Barry” <barry.kierstein>
To: “Windows System Software Devs Interest List”
Sent: Tuesday, February 03, 2004 1:29 PM
Subject: [ntdev] Compile-time defines for Windows versions

Hello,

I have looked for some #define definitions to do the following, but can’t
find anything. I may be missing the obvious. What I need is something like
this:

#ifdef WINXP
(Windows XP specific code)
#endif
#ifdef WIN2K
(Windows 2000 specific code)
#endif

Are there defines like this, and if so, where?

aTdHvAaNnKcSe,

Barry Kierstein


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@rdsor.ro
To unsubscribe send a blank email to xxxxx@lists.osr.com</barry.kierstein>