Question about Build

I have a rather simple question about Build.exe and the sources
file. I am writing a miniport driver and would like to keep the source code
for NT 4.0 and W2K the same because there are so few differences between the
two ( in my case ). I am putting Plug and Play support into the driver and
would like to have a conditional build setup around non-NT 4.0 code, #ifdef
WIN2K / #endif. Problem is I cannot figure out how to specify a define at
build time. In a normal compile, I do cl /D WIN2K, but how do you do that
for a driver with Build and a sources file?

Sean O’Connor
Spectra Logic
Boulder, Colorado


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi Sean.

You may use the C_DEFINES in your sources file, eg:
C_DEFINES= $(C_DEFINES) -DWIN2K

However, you’ll find a predefined Win2K macro already available to you. Simply
use in your C file:
#if _WIN32_WINNT >= 0x0500
// Windows2000 Specific code follows…
#else
// NT4 only stuff here
#endif

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: Sean O’Connor [mailto:xxxxx@spectralogic.com]
Sent: Tuesday, December 26, 2000 9:05 AM
To: NT Developers Interest List
Subject: [ntdev] Question about Build

I have a rather simple question about Build.exe and the sources
file. I am writing a miniport driver and would like to keep the source code
for NT 4.0 and W2K the same because there are so few differences between the
two ( in my case ). I am putting Plug and Play support into the driver and
would like to have a conditional build setup around non-NT 4.0 code, #ifdef
WIN2K / #endif. Problem is I cannot figure out how to specify a define at
build time. In a normal compile, I do cl /D WIN2K, but how do you do that
for a driver with Build and a sources file?


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I asked that question in the past myself. You might look in the archives for
some of the suggestions that were received.

These suggestions assume that you are using BUILD to build your driver.

The approach that I adopted was to move the SOURCES amd MAKEFILE to a
subdirectory inder the sources for the driver. Actually, you would have
multiple of these subdirectories.

In each subdirectory you modify the SOURCES list to include the files needed
for that build. For example, the SOURCES list in one SOURCES file in one of
the subdirectory would list your PnP module and the other would not. In
accition, you can modify the C_DEFINES in theses files to define a
preprocessor variable to do a little additional work.

For NDIS word I recomment that you use the Windows NT 4.0 DDK to build
drivers for NT 4.0 and the W2K DDK to build drivers for Windows 2000. I
don’t recommend that you mix-and-match.

Good luck,

Thomas F. Divine

PCAUSA - Toolkits & Resources For Network Software Developers
NDIS Protocol - NDIS Intermediate - TDI Client
http: - http:

----- Original Message -----
From: Sean O’Connor
To: NT Developers Interest List
Sent: Tuesday, December 26, 2000 12:04 PM
Subject: [ntdev] Question about Build

> I have a rather simple question about Build.exe and the sources
> file. I am writing a miniport driver and would like to keep the source
code
> for NT 4.0 and W2K the same because there are so few differences between
the
> two ( in my case ). I am putting Plug and Play support into the driver
and
> would like to have a conditional build setup around non-NT 4.0 code,
#ifdef
> WIN2K / #endif. Problem is I cannot figure out how to specify a define at
> build time. In a normal compile, I do cl /D WIN2K, but how do you do that
> for a driver with Build and a sources file?
>
> Sean O’Connor
> Spectra Logic
> Boulder, Colorado
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com</http:></http:>