Windows 2003/XP

hi all,

we’ve discovered WDK “Windows 2003 Build” environment produces binaries
refusing to run under Windows XP and other older version of windows.

My reserach: After building the exe I
investigated the PE (Windows Portable Executable file format) dump of a
binary file of my build with DDK as well as WDK.

It seems that the WDK seems to incorrectly set the “subsystem version”, i.e.,
the minimum subsystem required to run the executable
DDK WS03 build environment - subsystem ver 4.00 (NT4)
WDK WS03 bld env - subsystem ver 5.02 (WS03)
WDK WinXP bld env - subsystem ver 5.01 (WinXP)

*How can i set Subsystem version to 4.00 in WDK?*

*or is there any other reason because of that my exe(built on 2003 server)
not working on windows XP???*

Thanks & regards
Abhishek

Have you checked your EXE with Dependency Walker under XP?

http://www.dependencywalker.com/

Another question: if you want your software to be run under “XP and higher”…why do you build with a W2K3 environment set?

“Abhishek Bhadouria” schrieb im Newsbeitrag news:xxxxx@ntdev…

hi all,

we’ve discovered WDK “Windows 2003 Build” environment produces binaries refusing to run under Windows XP and other older version of windows.

My reserach: After building the exe I
investigated the PE (Windows Portable Executable file format) dump of a binary file of my build with DDK as well as WDK.

It seems that the WDK seems to incorrectly set the “subsystem version”, i.e., the minimum subsystem required to run the executable
DDK WS03 build environment - subsystem ver 4.00 (NT4)
WDK WS03 bld env - subsystem ver 5.02 (WS03)
WDK WinXP bld env - subsystem ver 5.01 (WinXP)

How can i set Subsystem version to 4.00 in WDK?

or is there any other reason because of that my exe(built on 2003 server) not working on windows XP???

Thanks & regards
Abhishek

Hi frank,
Thanks for your reply.
Yeh i checked with Dependency walker there is only a warning message. and
also exe is working fine on server 2003.

Actually the problem is If you build your exe on a specific WDK build
environment (for ex XP ) it 's working fine only on that build
environment.(only on xp in this ex. not on 2003 server or higher.)

With DDDK there is no probs at all. I can use binaries built on 2003 build
environment on XP and other older version also.

As i told you previously In case of DDK : Susystem Version is set to :
4.0(which is for NT) but in cas eof WDK subsystem version is set on
the basis
of which building environment you are using. for ex if you are using
XP subsystem version is setted to 5.01.

i checked the make file(both NEW file and Export Defination File, you can
find them in WDK installedfolder \ 6000\ bin ) they are quiet similar to
DDK.

can you suggest something by which i can change the subsystem Version???

On 2/27/07, frank wrote:
>
> Have you checked your EXE with Dependency Walker under XP?
>
> http://www.dependencywalker.com/
>
> Another question: if you want your software to be run under “XP and
> higher”…why do you build with a W2K3 environment set?
>
>
> “Abhishek Bhadouria” schrieb im Newsbeitrag
> news:xxxxx@ntdev…
>
> hi all,
>
> we’ve discovered WDK “Windows 2003 Build” environment produces binaries
> refusing to run under Windows XP and other older version of windows.
>
> My reserach: After building the exe I
> investigated the PE (Windows Portable Executable file format) dump of a
> binary file of my build with DDK as well as WDK.
>
> It seems that the WDK seems to incorrectly set the “subsystem version”,
> i.e., the minimum subsystem required to run the executable
> DDK WS03 build environment - subsystem ver 4.00 (NT4)
> WDK WS03 bld env - subsystem ver 5.02 (WS03)
> WDK WinXP bld env - subsystem ver 5.01 (WinXP)
>
> How can i set Subsystem version to 4.00 in WDK?
>
> or is there any other reason because of that my exe(built on 2003
> server) not working on windows XP???

>
>
> Thanks & regards
> Abhishek
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Well your claim he DDK/WDK if you set the environment to XP it will only
work on XP is bogus, sorry it works fine for XP, 2003 and Vista for any
properly written driver. Set your WDK environment to Windows 2000 and you
should be fine any OS from 2000 on (warning the WDK can in some rare
instances use a few funtions that require the later service packs). If you
really want your driver to work on NT4.0 and later, get the NT4.0 DDK and
build in that environment.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

“Abhishek Bhadouria” wrote in message
news:xxxxx@ntdev…
> Hi frank,
> Thanks for your reply.
> Yeh i checked with Dependency walker there is only a warning message. and
> also exe is working fine on server 2003.
>
> Actually the problem is If you build your exe on a specific WDK build
> environment (for ex XP ) it 's working fine only on that build
> environment.(only on xp in this ex. not on 2003 server or higher.)
>
> With DDDK there is no probs at all. I can use binaries built on 2003
> build
> environment on XP and other older version also.
>
> As i told you previously In case of DDK : Susystem Version is set to :
> 4.0(which is for NT) but in cas eof WDK subsystem version is set on
> the basis
> of which building environment you are using. for ex if you are using
> XP subsystem version is setted to 5.01.
>
> i checked the make file(both NEW file and Export Defination File, you can
> find them in WDK installedfolder \ 6000\ bin ) they are quiet similar to
> DDK.
>
> can you suggest something by which i can change the subsystem Version???
>
>
> On 2/27/07, frank wrote:
>>
>> Have you checked your EXE with Dependency Walker under XP?
>>
>> http://www.dependencywalker.com/
>>
>> Another question: if you want your software to be run under “XP and
>> higher”…why do you build with a W2K3 environment set?
>>
>>
>> “Abhishek Bhadouria” schrieb im
>> Newsbeitrag
>> news:xxxxx@ntdev…
>>
>> hi all,
>>
>> we’ve discovered WDK “Windows 2003 Build” environment produces binaries
>> refusing to run under Windows XP and other older version of windows.
>>
>> My reserach: After building the exe I
>> investigated the PE (Windows Portable Executable file format) dump of a
>> binary file of my build with DDK as well as WDK.
>>
>> It seems that the WDK seems to incorrectly set the “subsystem version”,
>> i.e., the minimum subsystem required to run the executable
>> DDK WS03 build environment - subsystem ver 4.00 (NT4)
>> WDK WS03 bld env - subsystem ver 5.02 (WS03)
>> WDK WinXP bld env - subsystem ver 5.01 (WinXP)
>>
>> How can i set Subsystem version to 4.00 in WDK?
>>
>> or is there any other reason because of that my exe(built on 2003
>> server) not working on windows XP???

>>
>>
>> Thanks & regards
>> Abhishek
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>

Don, I think the OP is complaining that his DDK built exes won’t work up
rev, not his DDK built drivers. I find that a strange complaint as well,
as the SDK is generally up rev OS compatible, but as I hardly ever use
the DDK to build applications, I wouldn’t know.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Tuesday, February 27, 2007 9:22 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Windows 2003/XP

Well your claim he DDK/WDK if you set the environment to XP it will only

work on XP is bogus, sorry it works fine for XP, 2003 and Vista for any
properly written driver. Set your WDK environment to Windows 2000 and
you
should be fine any OS from 2000 on (warning the WDK can in some rare
instances use a few funtions that require the later service packs). If
you
really want your driver to work on NT4.0 and later, get the NT4.0 DDK
and
build in that environment.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

“Abhishek Bhadouria” wrote in message
news:xxxxx@ntdev…
> Hi frank,
> Thanks for your reply.
> Yeh i checked with Dependency walker there is only a warning message.
and
> also exe is working fine on server 2003.
>
> Actually the problem is If you build your exe on a specific WDK build
> environment (for ex XP ) it 's working fine only on that build
> environment.(only on xp in this ex. not on 2003 server or higher.)
>
> With DDDK there is no probs at all. I can use binaries built on 2003
> build
> environment on XP and other older version also.
>
> As i told you previously In case of DDK : Susystem Version is set to :
> 4.0(which is for NT) but in cas eof WDK subsystem version is set on
> the basis
> of which building environment you are using. for ex if you are using
> XP subsystem version is setted to 5.01.
>
> i checked the make file(both NEW file and Export Defination File, you
can
> find them in WDK installedfolder \ 6000\ bin ) they are quiet similar
to
> DDK.
>
> can you suggest something by which i can change the subsystem
Version???
>
>
> On 2/27/07, frank wrote:
>>
>> Have you checked your EXE with Dependency Walker under XP?
>>
>> http://www.dependencywalker.com/
>>
>> Another question: if you want your software to be run under “XP and
>> higher”…why do you build with a W2K3 environment set?
>>
>>
>> “Abhishek Bhadouria” schrieb im
>> Newsbeitrag
>> news:xxxxx@ntdev…
>>
>> hi all,
>>
>> we’ve discovered WDK “Windows 2003 Build” environment produces
binaries
>> refusing to run under Windows XP and other older version of windows.
>>
>> My reserach: After building the exe I
>> investigated the PE (Windows Portable Executable file format) dump of
a
>> binary file of my build with DDK as well as WDK.
>>
>> It seems that the WDK seems to incorrectly set the “subsystem
version”,
>> i.e., the minimum subsystem required to run the executable
>> DDK WS03 build environment - subsystem ver 4.00 (NT4)
>> WDK WS03 bld env - subsystem ver 5.02 (WS03)
>> WDK WinXP bld env - subsystem ver 5.01 (WinXP)
>>
>> How can i set Subsystem version to 4.00 in WDK?
>>
>> or is there any other reason because of that my exe(built on 2003
>> server) not working on windows XP???

>>
>>
>> Thanks & regards
>> Abhishek
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>


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

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Hi Don,

I am making myself more clear.

According to MSDN:
If you want your driver to run on multiple versions of Windows and
dynamically determine the features that are available to the driver, build
the driver in the build environment for the most recent version of the
operating system. For example, if your driver will support all Windows
versions starting with Windows 2000 but you want the driver to use certain
features that were first made available in Windows XP when your driver is
running on Windows XP or later operating systems, build your driver in the
Windows Vista build environment of the WDK.

*The same i want to do.*
FIrst the problem *is with WDK* *not DDK*.

with* DDK my exe is working fine*, i can build my exe from 2003 server
build environment and able to use it on older version of Windows.
But when i *built my exe via WDK* server 2003 build environment i am *not
able to use* it on older version of windows.

Reason behind this: According to my investigation WDK is setting the
Subsystem version to 5.02 if you are using server 2003 build Envon ) and
5.01(if you are using XP build Env) .
But WIth DDK you build on any environment it is setting the Subsystem
Version to 4.0.

There is nothing like i am claiming i just told you what is happening when i
am using WDK to build my exe. May be there is some setting i have to do
to.
I am thankful to you if you acn give me any suggestion on solving this prob.

Regards
Abhi

On 2/27/07, Don Burn wrote:
>
> Well your claim he DDK/WDK if you set the environment to XP it will only
> work on XP is bogus, sorry it works fine for XP, 2003 and Vista for any
> properly written driver. Set your WDK environment to Windows 2000 and
> you
> should be fine any OS from 2000 on (warning the WDK can in some rare
> instances use a few funtions that require the later service packs). If
> you
> really want your driver to work on NT4.0 and later, get the NT4.0 DDK and
> build in that environment.
>
>
> –
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
> “Abhishek Bhadouria” wrote in message
> news:xxxxx@ntdev…
> > Hi frank,
> > Thanks for your reply.
> > Yeh i checked with Dependency walker there is only a warning message.
> and
> > also exe is working fine on server 2003.
> >
> > Actually the problem is If you build your exe on a specific WDK build
> > environment (for ex XP ) it 's working fine only on that build
> > environment.(only on xp in this ex. not on 2003 server or higher.)
> >
> > With DDDK there is no probs at all. I can use binaries built on 2003
> > build
> > environment on XP and other older version also.
> >
> > As i told you previously In case of DDK : Susystem Version is set to :
> > 4.0(which is for NT) but in cas eof WDK subsystem version is set on
> > the basis
> > of which building environment you are using. for ex if you are using
> > XP subsystem version is setted to 5.01.
> >
> > i checked the make file(both NEW file and Export Defination File, you
> can
> > find them in WDK installedfolder \ 6000\ bin ) they are quiet similar to
> > DDK.
> >
> > can you suggest something by which i can change the subsystem
> Version???
> >
> >
> > On 2/27/07, frank wrote:
> >>
> >> Have you checked your EXE with Dependency Walker under XP?
> >>
> >> http://www.dependencywalker.com/
> >>
> >> Another question: if you want your software to be run under “XP and
> >> higher”…why do you build with a W2K3 environment set?
> >>
> >>
> >> “Abhishek Bhadouria” schrieb im
> >> Newsbeitrag
> >> news:xxxxx@ntdev…
> >>
> >> hi all,
> >>
> >> we’ve discovered WDK “Windows 2003 Build” environment produces binaries
> >> refusing to run under Windows XP and other older version of windows.
> >>
> >> My reserach: After building the exe I
> >> investigated the PE (Windows Portable Executable file format) dump of a
> >> binary file of my build with DDK as well as WDK.
> >>
> >> It seems that the WDK seems to incorrectly set the “subsystem version”,
> >> i.e., the minimum subsystem required to run the executable
> >> DDK WS03 build environment - subsystem ver 4.00 (NT4)
> >> WDK WS03 bld env - subsystem ver 5.02 (WS03)
> >> WDK WinXP bld env - subsystem ver 5.01 (WinXP)
> >>
> >> How can i set Subsystem version to 4.00 in WDK?
> >>
> >> or is there any other reason because of that my exe(built on 2003
> >> server) not working on windows XP???

> >>
> >>
> >> Thanks & regards
> >> Abhishek
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> >> http://www.osronline.com/article.cfm?id=256
> >>
> >> To unsubscribe, visit the List Server section of OSR Online at
> >> http://www.osronline.com/page.cfm?name=ListServer
> >>
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

add this to your sources file

_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)

This should set the subsystem as you expect. The build environment sets this for you automatically depending on the OS you pick. This statement will override what the build environment sets for you by default.

d

hi horan,

Thanks for your reply.
Addding _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) can work. but before
trying i want to discuss some issues.

  1. When i was working *with DDK there is nothing* about _NT_TARGET_VERSION
    means There is *no need to add* *_NT_TARGET_VERSION* in source files.

I investigate the makefile(Export defination file and New file) in WDK or
DDK’s bin directory. Setting of _NT_TARGET_VERSION is quiet same. but still
in case of DDK target subsystem version is set to 4.0 but in case of WDK it
is set t0 5.02 or 5.01 based on which build environment you are using.
*Then why in WDK* i have to *specifically set the _NT_TARGET_VERSION*.

  1. I have more than 300 source files. Is there any solution so i can set
    the minimum subsystem in WDK only.

  2. Setting the _NT_TARGET_VERSION source file to $(NT_TARGET_VERSION*
    WINNT4* ) will work on all the version of windows like* XP, 2000 *or it will
    work *only for NT4 ??*

I will be thankful if you can help me in getting answers of these questions.

On 2/28/07, xxxxx@microsoft.com wrote:
>
> add this to your sources file
>
> _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
>
> This should set the subsystem as you expect. The build environment sets
> this for you automatically depending on the OS you pick. This statement
> will override what the build environment sets for you by default.
>
> d
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

You really should be clear if you are talking about user mode
applications or drivers. Drivers build just fine without using any of
this stuff.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek
Bhadouria
Sent: Wednesday, February 28, 2007 10:51 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Windows 2003/XP

hi horan,

Thanks for your reply.

Addding _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) can work. but
before trying i want to discuss some issues.

  1. When i was working with DDK there is nothing about
    _NT_TARGET_VERSION means There is no need to add _NT_TARGET_VERSION in
    source files.

I investigate the makefile(Export defination file and New file) in WDK
or DDK’s bin directory. Setting of _NT_TARGET_VERSION is quiet same. but
still in case of DDK target subsystem version is set to 4.0 but in case
of WDK it is set t0 5.02 or 5.01 based on which build environment you
are using.

Then why in WDK i have to specifically set the _NT_TARGET_VERSION.

  1. I have more than 300 source files. Is there any solution so i can set
    the minimum subsystem in WDK only.

  2. Setting the _NT_TARGET_VERSION source file to
    $(_NT_TARGET_VERSION_WINNT4 ) will work on all the version of windows
    like XP, 2000 or it will work only for NT4 ??

I will be thankful if you can help me in getting answers of these
questions.

On 2/28/07, xxxxx@microsoft.com
wrote:

add this to your sources file

_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)

This should set the subsystem as you expect. The build environment sets
this for you automatically depending on the OS you pick. This
statement will override what the build environment sets for you by
default.

d


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

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Hi Mark,
my project is a driver project. I am woking on a scanner driver project.
But still i am facing these build issues with *WDK.* with DDK everything is
Fine.

regards
Abhishek

On 2/28/07, Roddy, Mark wrote:
>
> You really should be clear if you are talking about user mode
> applications or drivers. Drivers build just fine without using any of this
> stuff.
>
>
> ------------------------------
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Abhishek Bhadouria
> Sent: Wednesday, February 28, 2007 10:51 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Windows 2003/XP
>
>
>
> hi horan,
>
>
>
> Thanks for your reply.
>
> Addding _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP) can work. but
> before trying i want to discuss some issues.
>
>
>
> 1. When i was working with DDK there is nothing about
> _NT_TARGET_VERSION means There is no need to add _NT_TARGET_VERSION in
> source files.
>
>
>
> I investigate the makefile(Export defination file and New file) in WDK or
> DDK’s bin directory. Setting of _NT_TARGET_VERSION is quiet same. but still
> in case of DDK target subsystem version is set to 4.0 but in case of WDK
> it is set t0 5.02 or 5.01 based on which build environment you are using.
>
> Then why in WDK i have to specifically set the _NT_TARGET_VERSION.
>
>
>
> 2. I have more than 300 source files. Is there any solution so i can set
> the minimum subsystem in WDK only.
>
>
>
> 3. Setting the _NT_TARGET_VERSION source file to $(NT_TARGET_VERSION

> WINNT4
) will work on all the version of windows like* XP, 2000 *or it
> will work only for NT4 ??
>
>
> I will be thankful if you can help me in getting answers of these
> questions.
>
>
>
>
> On 2/28/07, xxxxx@microsoft.com
> wrote:
>
> add this to your sources file
>
> _NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
>
> This should set the subsystem as you expect. The build environment sets
> this for you automatically depending on the OS you pick. This statement
> will override what the build environment sets for you by default.
>
> d
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List
> Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Abishek-

About 1, the DDK is arguably the one in error. It lets you build a binary with calls that didn’t exist on NT4, but is marked as being an NT 4 binary.

Also, you said “source files”- in case that wasn’t a typo- this setting is made in the SOURCES file in each leaf directory of your build tree, not in each source file in your tree. I suppose you really could have 300 drivers, test apps, and libraries you build in this project- it just seems a bit large.

I realize that doesn’t answer why, but that’s a big question. One reason is that you get what we use, and that’s a change that improves our engineering processes by forcing us to be more explicit about where each binary built in the OS source tree is expected to work. Another is that it prevents you from targeting a binary at a platform that contains calls the platform doesn’t support. There are probably some others, but I don’t think they matter in any practical sense. This is the recommended way to fix this problem. I’ve had to do it myself quite a few times, since we have to test KMDF on all those legacy platforms.

For 2, I believe one thing you can do is just use the SET command and set the corresponding environment variable (I haven’t tried it, but I believe this is an environment variable and not a macro). You should be able to do that in a batch file (but I would also recommend you do this as a temporary measure while you fix the sources files, because you will eventually run into support issues if you are not using the WDK).

For 3- there is no such setting. NT4 is unsupported in the WDK. The WDK supports WINXP and WIN2K for targets of this macro.

The build env version must be <= the target OS version, it was always so
with DDKs.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Abhishek Bhadouria” wrote in message
news:xxxxx@ntdev…
> hi all,
>
> we’ve discovered WDK “Windows 2003 Build” environment produces binaries
> refusing to run under Windows XP and other older version of windows.
>
> My reserach: After building the exe I
> investigated the PE (Windows Portable Executable file format) dump of a
> binary file of my build with DDK as well as WDK.
>
> It seems that the WDK seems to incorrectly set the “subsystem version”, i.e.,
> the minimum subsystem required to run the executable
> DDK WS03 build environment - subsystem ver 4.00 (NT4)
> WDK WS03 bld env - subsystem ver 5.02 (WS03)
> WDK WinXP bld env - subsystem ver 5.01 (WinXP)
>
> How can i set Subsystem version to 4.00 in WDK?
>
> or is there any other reason because of that my exe(built on 2003 server)
> not working on windows XP???

>
>
> Thanks & regards
> Abhishek
>

Hi bob,

Thanks for your reply but i think there is some gap in understanding. I
think i am not able to put my query correctly.

According to MSDN

MSDN Library-> Win32 and com Developement -> Windows Driver Kit -> Getting
Started with Windows Driver -> Building , Debugging and Testing Driver ->
Header Files In Windows Driver Kit ->Best Practices for using WDK header
Files.

If you want your driver to run on multiple versions of Windows and
dynamically determine the features that are available to the driver, build
the driver in the build environment for the most recent version of the
operating system. For example, if your driver will support all Windows
versions starting with Windows 2000 but you want the driver to use certain
features that were first made available in Windows XP when your driver is
running on Windows XP or later operating systems, build your driver in the
Windows Vista build environment of the WDK.
My use case is like this: -
In DDK, I used to build my driver in W2K3 build env so that my driver could
be deployed in any lower version of Windows without missing XP specific
feature on XP target machine, without missing W2K3 specific features on W2K3
target machine.

But In WDK, When i am building my driver on W2K3 build env I am not able to
deploy it in any lower version of windows.but If i am building using WINXP
build env i am able to use it on W2K3.
SO that means with WDK there is a forward support for binaries but no
reverse support.

In WDK, it appears that if I need a driver which should work on Win2K,
WinXP, W2K3, then I should build the driver using the Win2K build env of
WDK. *But then if my driver is trying to use some WinXP feature, will i am
going to miss those feature. *

It appears from the MSDN documentation that my use case should work with WDK
as it was working with DDK, but it is not so.

Thanks & regards
Abhishek

On 3/1/07, Bob Kjelgaard wrote:
>
> Abishek-
>
> About 1, the DDK is arguably the one in error. It lets you build a binary
> with calls that didn’t exist on NT4, but is marked as being an NT 4 binary.
>
> Also, you said “source files”- in case that wasn’t a typo- this setting is
> made in the SOURCES file in each leaf directory of your build tree, not in
> each source file in your tree. I suppose you really could have 300 drivers,
> test apps, and libraries you build in this project- it just seems a bit
> large.
>
> I realize that doesn’t answer why, but that’s a big question. One reason
> is that you get what we use, and that’s a change that improves our
> engineering processes by forcing us to be more explicit about where each
> binary built in the OS source tree is expected to work. Another is that it
> prevents you from targeting a binary at a platform that contains calls the
> platform doesn’t support. There are probably some others, but I don’t think
> they matter in any practical sense. This is the recommended way to fix this
> problem. I’ve had to do it myself quite a few times, since we have to test
> KMDF on all those legacy platforms.
>
> For 2, I believe one thing you can do is just use the SET command and set
> the corresponding environment variable (I haven’t tried it, but I believe
> this is an environment variable and not a macro). You should be able to do
> that in a batch file (but I would also recommend you do this as a temporary
> measure while you fix the sources files, because you will eventually run
> into support issues if you are not using the WDK).
>
> For 3- there is no such setting. NT4 is unsupported in the WDK. The WDK
> supports WINXP and WIN2K for targets of this macro.
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>

Add SUBSYSTEM_VERSION=4.00 to the SOURCES file and everything would work
just fine. Generated binaries work even under Windows 98/Me.

Anton

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Friday, March 02, 2007 3:30 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Windows 2003/XP

The build env version must be <= the target OS version, it was always so
with DDKs.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Abhishek Bhadouria” wrote in message
news:xxxxx@ntdev…
> hi all,
>
> we’ve discovered WDK “Windows 2003 Build” environment produces binaries
> refusing to run under Windows XP and other older version of windows.
>
> My reserach: After building the exe I
> investigated the PE (Windows Portable Executable file format) dump of a
> binary file of my build with DDK as well as WDK.
>
> It seems that the WDK seems to incorrectly set the “subsystem version”,
i.e.,
> the minimum subsystem required to run the executable
> DDK WS03 build environment - subsystem ver 4.00 (NT4)
> WDK WS03 bld env - subsystem ver 5.02 (WS03)
> WDK WinXP bld env - subsystem ver 5.01 (WinXP)
>
> How can i set Subsystem version to 4.00 in WDK?
>
> or is there any other reason because of that my exe(built on 2003
server)
> not working on windows XP???

>
>
> Thanks & regards
> Abhishek
>


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

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Abhishek (apologies for the earlier typo)-

I’ll file a WDK documentation bug for this, if there isn’t one already. Myself, I don’t think it was ever right- I think the best practice if you’re going to ship one multi-platform driver is to build on the oldest environment you support because then you get at least some compile-time issues pointing out where you want to use the newer function. You lose that early notification as you tweak #defines to get the newer features defined, but some earlier on is better than none.

Also, I see I was wrong about NT4 as an option for the switch. But it’s still a virtually worthless option, especially in the kernel.

Also, the reason Doron and I mentioned the target version macros, and I said it was the recommended way is because as a part of the OS, that’s the way we HAVE to do it for KMDF. In my case at least, I was thinking about the OS build environment and not the WDK.

I still think it’s a useful macro because it will work even if you inadvertently build with the wrong environment.

Also, my posts are as always my opinion, no matter how I state it. Someone who’s got better knowledge than I of the ins and outs of the build settings presumably gets to handle the bug.

You are missing the point of “If you want your driver to run on multiple
versions of Windows and dynamically determine the features that are
available to the driver”. This is the case where you want a single binary
image driver to use interfaces if they are present while being able to run
on platforms where they are not present. For example you want your driver
(and this discussion really only applies to drivers) to use kernel
interfaces only supported in Vista but also be able to run on XP and W2K3.
You build your driver for Vista but you also have to identify every
interface that you intend to use that is not present in XP and you have to
write code to dynamically test for the presence of that interface, use it if
it is present, and use a substitute if it is not. You do that by using
MmGetSystemRoutineAddress - which is present in W2K and later - to find the
address of a kernel function if it is present on the platform.

The much simpler approach is to build for the lowest version platform you
need to support - XP in your case - and to not use any higher version
platform kernel interfaces.

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Abhishek Bhadouria
Sent: Friday, March 02, 2007 1:01 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Windows 2003/XP

Hi bob,

Thanks for your reply but i think there is some gap in understanding. I
think i am not able to put my query correctly.

According to MSDN

MSDN Library-> Win32 and com Developement -> Windows Driver Kit -> Getting
Started with Windows Driver -> Building , Debugging and Testing Driver ->
Header Files In Windows Driver Kit ->Best Practices for using WDK header
Files.

. If you want your driver to run on multiple versions of Windows and
dynamically determine the features that are available to the driver, build
the driver in the build environment for the most recent version of the
operating system. For example, if your driver will support all Windows
versions starting with Windows 2000 but you want the driver to use certain
features that were first made available in Windows XP when your driver is
running on Windows XP or later operating systems, build your driver in the
Windows Vista build environment of the WDK.

My use case is like this: -

In DDK, I used to build my driver in W2K3 build env so that my driver could
be deployed in any lower version of Windows without missing XP specific
feature on XP target machine, without missing W2K3 specific features on W2K3
target machine.

But In WDK, When i am building my driver on W2K3 build env I am not able to
deploy it in any lower version of windows.but If i am building using WINXP
build env i am able to use it on W2K3.

SO that means with WDK there is a forward support for binaries but no
reverse support.

In WDK, it appears that if I need a driver which should work on Win2K,
WinXP, W2K3, then I should build the driver using the Win2K build env of
WDK. But then if my driver is trying to use some WinXP feature, will i am
going to miss those feature.

It appears from the MSDN documentation that my use case should work with WDK
as it was working with DDK, but it is not so.

Thanks & regards

Abhishek

On 3/1/07, Bob Kjelgaard mailto:xxxxx > wrote:

Abishek-

About 1, the DDK is arguably the one in error. It lets you build a binary
with calls that didn’t exist on NT4, but is marked as being an NT 4 binary.

Also, you said “source files”- in case that wasn’t a typo- this setting is
made in the SOURCES file in each leaf directory of your build tree, not in
each source file in your tree. I suppose you really could have 300 drivers,
test apps, and libraries you build in this project- it just seems a bit
large.

I realize that doesn’t answer why, but that’s a big question. One reason is
that you get what we use, and that’s a change that improves our engineering
processes by forcing us to be more explicit about where each binary built in
the OS source tree is expected to work. Another is that it prevents you
from targeting a binary at a platform that contains calls the platform
doesn’t support. There are probably some others, but I don’t think they
matter in any practical sense. This is the recommended way to fix this
problem. I’ve had to do it myself quite a few times, since we have to test
KMDF on all those legacy platforms.

For 2, I believe one thing you can do is just use the SET command and set
the corresponding environment variable (I haven’t tried it, but I believe
this is an environment variable and not a macro). You should be able to do
that in a batch file (but I would also recommend you do this as a temporary
measure while you fix the sources files, because you will eventually run
into support issues if you are not using the WDK).

For 3- there is no such setting. NT4 is unsupported in the WDK. The WDK
supports WINXP and WIN2K for targets of this macro.


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

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List
Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx>

Mark-

I don’t mean to quibble, but the WDK also supports several user-mode and mixed-mode driver technologies (printers and scanners being among them). You cannot follow that recommendation (build for the latest in the dynamic case) for these technologies. The binaries are now stamped so they won’t run on the older platforms.

I also personally expect that even in the kernel driver case this practice could eventually break.

Yes indeed - this only applies to kernel mode drivers - but of course
similar methods are available up above in user mode. I certainly don’t
recommend doing this. The OP pointed to a section of the docs and I just
intended to clarify what that section was actually talking about.

The best practice is to build for the lowest platform version you need to
support. But please do not do away with the ability to dynamically locate
kernel interfaces - it really can be quite useful.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-279742-
xxxxx@lists.osr.com] On Behalf Of Bob Kjelgaard
Sent: Friday, March 02, 2007 12:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Windows 2003/XP

Mark-

I don’t mean to quibble, but the WDK also supports several user-mode
and mixed-mode driver technologies (printers and scanners being among
them). You cannot follow that recommendation (build for the latest in
the dynamic case) for these technologies. The binaries are now stamped
so they won’t run on the older platforms.

I also personally expect that even in the kernel driver case this
practice could eventually break.


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

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> ----------

From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Mark Roddy[SMTP:xxxxx@hollistech.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, March 02, 2007 7:02 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Windows 2003/XP

Yes indeed - this only applies to kernel mode drivers - but of course
similar methods are available up above in user mode. I certainly don’t
recommend doing this. The OP pointed to a section of the docs and I just
intended to clarify what that section was actually talking about.

Actually, OP had a good point. This part of docs is misleading. Recently I had to solve the same problem, read it, thought something bad about MS and made it the standard way (the one you recommend).

The best practice is to build for the lowest platform version you need to
support. But please do not do away with the ability to dynamically locate
kernel interfaces - it really can be quite useful.

Not only useful but quite necessary, sometimes.

Having one binary to support multiple OSes with WDK isn’t quite easy. If you define the lowest platform versions, prototypes and definitions for newer platforms aren’t available because they’re preprocessed out from WDK headers. Finally I made a separate source file with Vista support and redefined NTDDI_VERSION and _WIN32_WINNT before including WDK headers. Which may not be quite safe but Vista-only part I’d have to copy from headers was too big.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]