Binary compatible?

Hello!

From what I understand WDM drivers can be binary compatible with lots of Windows operating systems, a WDM driver running on XP can also run on Vista. Is this true?

If I need to provide my driver to XP and Vista users (32 bit and 64 bit). Is it enough to build it for 32 bit XP and 64 bit XP? Would these builds work on Vista?

Another question: In WDK 6000 there is no build environment for XP x64. What environment should I use if I want to build a 64 bit XP WDM driver?

Regards,
Mattias

Yes a well written driver for XP should run on Vista. The build
environment for XP 64bit is to use the Windows Server 2003 x64 environment,
the 64-bit XP is that kernel.


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

“Mattias Brändström” wrote in message
news:xxxxx@ntdev…
Hello!

From what I understand WDM drivers can be binary compatible with lots of
Windows operating systems, a WDM driver running on XP can also run on Vista.
Is this true?

If I need to provide my driver to XP and Vista users (32 bit and 64 bit). Is
it enough to build it for 32 bit XP and 64 bit XP? Would these builds work
on Vista?

Another question: In WDK 6000 there is no build environment for XP x64. What
environment should I use if I want to build a 64 bit XP WDM driver?

Regards,
Mattias

Mattias Brändström wrote:

From what I understand WDM drivers can be binary compatible with lots
of Windows operating systems, a WDM driver running on XP can also run
on Vista. Is this true?

Yes. We have a WDM driver that runs on any Windows version that supports
USB, starting with Win98SE. Three binaries: x86, AMD64 and IA64.

If I need to provide my driver to XP and Vista users (32 bit and 64
bit). Is it enough to build it for 32 bit XP and 64 bit XP? Would
these builds work on Vista?

Yes, but please note that if you only need to provide drivers for XP and
Vista instead of WDM you can also use KMDF or UMDF.
This will save you a lot of work and make your driver more robust.

(If you only need simple bulk USB communication, you can even do without
any driver of your own and use WinUSB.)

>From what I understand WDM drivers can be binary compatible with lots of

Windows operating systems, a WDM driver running on XP can also run on Vista.
Is this true?

Usually, WDM drivers are forward-compatible, i.e. the driver binary built for
w2k will work from w2k up, for XP - will work from XP up but will probably fail
on w2k, and so on.

There are attempts to make the binary built by Vista build env to work on w2k,
but they are not reliable.

If I need to provide my driver to XP and Vista users (32 bit and 64 bit). Is
it enough
to build it for 32 bit XP and 64 bit XP? Would these builds work on Vista?

Yes, except NDIS IM drivers which are working in Vista only in compatibility
mode (with NDIS6->NDIS5 shims) and are obsolete for Vista.

Another question: In WDK 6000 there is no build environment for XP x64. What
environment should I use if I want to build a 64 bit XP WDM driver?

Surely so, XP x64 is the desktop version of 2003 x64, so, use 2003 x64 build
env.


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

Thanks for the info everyone!

Now I have a follow-up question that you might be able to answer. :slight_smile:

I want to be able to build more than one target from a single source tree. The WDK documentation suggests that I can do this by having my source in driver/ and then one source file in drivers/xp32/ and drivers/xp64/ each.

What I can’t seem to find clear documentation on is what macros I need to place in the source files to build my targets. I understand that I should use _NT_TARGET_VERSION to select the operating system, but what macro should I use to select the architecture (32bit or 64bit)?

:.:: mattias

-----Ursprungligt meddelande-----
Fr?n: xxxxx@lists.osr.com [mailto:bounce-324896-
xxxxx@lists.osr.com] F?r Don Burn
Skickat: den 21 maj 2008 17:36
Till: Windows System Software Devs Interest List
?mne: Re:[ntdev] Binary compatible?

Yes a well written driver for XP should run on Vista. The build
environment for XP 64bit is to use the Windows Server 2003 x64
environment,
the 64-bit XP is that kernel.


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

“Mattias Br?ndstr?m” wrote in message
> news:xxxxx@ntdev…
> Hello!
>
> From what I understand WDM drivers can be binary compatible with lots of
> Windows operating systems, a WDM driver running on XP can also run on
> Vista.
> Is this true?
>
> If I need to provide my driver to XP and Vista users (32 bit and 64 bit).
> Is
> it enough to build it for 32 bit XP and 64 bit XP? Would these builds work
> on Vista?
>
> Another question: In WDK 6000 there is no build environment for XP x64.
> What
> environment should I use if I want to build a 64 bit XP WDM driver?
>
> Regards,
> Mattias
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Your understandings are wrong. The ‘wdk way’ is to manually open a command
shell window for the correct target - w2k3 x64 checked build - for example,
and then manually execute build. You can look at the shortcut provided that
does this and see that it does something like:

C:\WinDDK\6001.18000\bin\setenv.bat C:\WinDDK\6001.18000\ chk WNET

that is what sets up the correct environment (for example setting the
appropriate value for _NT_TARGET_VERSION ).

You could do the same thing in a makefile, or in your own command script.

On Thu, May 22, 2008 at 4:49 AM, Mattias Br?ndstr?m <
xxxxx@todos.se> wrote:

Thanks for the info everyone!

Now I have a follow-up question that you might be able to answer. :slight_smile:

I want to be able to build more than one target from a single source tree.
The WDK documentation suggests that I can do this by having my source in
driver/ and then one source file in drivers/xp32/ and drivers/xp64/ each.

What I can’t seem to find clear documentation on is what macros I need to
place in the source files to build my targets. I understand that I should
use _NT_TARGET_VERSION to select the operating system, but what macro should
I use to select the architecture (32bit or 64bit)?

:.:: mattias

> -----Ursprungligt meddelande-----
> Fr?n: xxxxx@lists.osr.com [mailto:bounce-324896-
> xxxxx@lists.osr.com] F?r Don Burn
> Skickat: den 21 maj 2008 17:36
> Till: Windows System Software Devs Interest List
> ?mne: Re:[ntdev] Binary compatible?
>
> Yes a well written driver for XP should run on Vista. The build
> environment for XP 64bit is to use the Windows Server 2003 x64
> environment,
> the 64-bit XP is that kernel.
>
>
> –
> 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
>
>
>
> “Mattias Br?ndstr?m” wrote in message
> > news:xxxxx@ntdev…
> > Hello!
> >
> > From what I understand WDM drivers can be binary compatible with lots of
> > Windows operating systems, a WDM driver running on XP can also run on
> > Vista.
> > Is this true?
> >
> > If I need to provide my driver to XP and Vista users (32 bit and 64 bit).
> > Is
> > it enough to build it for 32 bit XP and 64 bit XP? Would these builds
> work
> > on Vista?
> >
> > Another question: In WDK 6000 there is no build environment for XP x64.
> > What
> > environment should I use if I want to build a 64 bit XP WDM driver?
> >
> > Regards,
> > Mattias
> >
> >
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > For our schedule of WDF, WDM, debugging and other seminars visit:
> > http://www.osr.com/seminars
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Mark Roddy

Mattias Brändström wrote:

Thanks for the info everyone!

Now I have a follow-up question that you might be able to answer. :slight_smile:

I want to be able to build more than one target from a single source tree. The WDK documentation suggests that I can do this by having my source in driver/ and then one source file in drivers/xp32/ and drivers/xp64/ each.

What I can’t seem to find clear documentation on is what macros I need to place in the source files to build my targets. I understand that I should use _NT_TARGET_VERSION to select the operating system, but what macro should I use to select the architecture (32bit or 64bit)?

Mark’s answer is correct, you can’t do this in a single call to build.
Here is part of a batch file I use to build multiple environments in a
single run (in this case, XP checked and XP free, but you can figure out
how to extend it). Note that this must be started from a command line
that has not already run “setenv”:

setlocal
set BLD=
if “%1” == “clean” set BLD=-c
set LAST=%CD%
call %DDK%\bin\setenv %DDK% chk WXP
@echo on
set USERNAME=timr
cd %LAST%
build %BLD%
endlocal

setlocal
set BLD=
if “%1” == “clean” set BLD=-c
set LAST=%CD%
call %DDK%\bin\setenv %DDK% fre WXP
@echo on
set USERNAME=timr
cd %LAST%
build %BLD%
endlocal


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Maxim S. Shatskih wrote:

Are there any documents out there that describe this in detail? I ask
because a build for XP will
run on a w2k sp4 urp1 machine.

Same with w3k build (run on a w2k urp1), yet I don’t think a driver
built with w3k would work on
an XP sp2 machine (just assuming, never tested). At the same time, a
plain w2k sp4 driver should work upwards to Vista.

I base this off of what I’ve seen with mini-filters. Given service pack
requirements and updates, is an XP build
the best way to go for the time being (single binary for w2k threw '08
-minus bitness and architecture)?

Matt

Usually, WDM drivers are forward-compatible, i.e. the driver binary built for
w2k will work from w2k up, for XP - will work from XP up but will probably fail
on w2k, and so on.

There are attempts to make the binary built by Vista build env to work on w2k,
but they are not reliable.

> If I need to provide my driver to XP and Vista users (32 bit and 64 bit). Is
>
it enough

> to build it for 32 bit XP and 64 bit XP? Would these builds work on Vista?
>

Yes, except NDIS IM drivers which are working in Vista only in compatibility
mode (with NDIS6->NDIS5 shims) and are obsolete for Vista.

> Another question: In WDK 6000 there is no build environment for XP x64. What
> environment should I use if I want to build a 64 bit XP WDM driver?
>

Surely so, XP x64 is the desktop version of 2003 x64, so, use 2003 x64 build
env.

Matt,

It all depends on what functions the driver calls. You can compile a
driver in a Win2K8 environment, if it doesn’t use any function calls
added since XP then it will run on XP.

Of course this is dangerous and relies on the developer knowing about
these things. That is why people have told you that if it builds in
the XP environment it should work on all subsequent Windows releases
(barring a complete change in driver or class model). Generally one
should be compiling in the environment for the earliest version of
Windows that you want to support.

As for documentation, the WDK documentation generally states which
Windows release a function was added. If it makes no statement then
the function has been there forever. And in case you use a function
that looks useful but was only introduced with Vista, when you
compile in an XP environment the WDK headers will ensure that the
function is flagged as unrecognised.

Backwards support to W2K is often a tricky issue, sometimes what you
want to do is simply just not available in W2K. Of course, this can
only be assessed on a case by case basis, which you’ll have to find
out for yourself.

Mark.

At 11:35 23/05/2008, Matt wrote:

Maxim S. Shatskih wrote:

Are there any documents out there that describe this in detail? I
ask because a build for XP will
run on a w2k sp4 urp1 machine.

Same with w3k build (run on a w2k urp1), yet I don’t think a driver
built with w3k would work on
an XP sp2 machine (just assuming, never tested). At the same time, a
plain w2k sp4 driver should work upwards to Vista.

I base this off of what I’ve seen with mini-filters. Given service
pack requirements and updates, is an XP build
the best way to go for the time being (single binary for w2k threw
'08 -minus bitness and architecture)?

Matt

>Usually, WDM drivers are forward-compatible, i.e. the driver binary built for
>w2k will work from w2k up, for XP - will work from XP up but will
>probably fail
>on w2k, and so on.
>
>There are attempts to make the binary built by Vista build env to
>work on w2k,
>but they are not reliable.
>
>

>>If I need to provide my driver to XP and Vista users (32 bit and 64 bit). Is
>>
>it enough
>
>>to build it for 32 bit XP and 64 bit XP? Would these builds work on Vista?
>>
>
>Yes, except NDIS IM drivers which are working in Vista only in compatibility
>mode (with NDIS6->NDIS5 shims) and are obsolete for Vista.
>
>
>>Another question: In WDK 6000 there is no build environment for XP x64. What
>>environment should I use if I want to build a 64 bit XP WDM driver?
>>
>
>Surely so, XP x64 is the desktop version of 2003 x64, so, use 2003 x64 build
>env.
>
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Mark S. Edwards wrote:

I was under the impression that PE header formats changed between
versions of the OS, and this is what this thread was about.

My Apologies,

Matt

Matt,

It all depends on what functions the driver calls.

> I was under the impression that PE header formats changed between

versions of the OS

Not so.

I had a .SYS binary which worked OK from NT4 to Vista.

So are the user-mode apps.

Last on-disk registry format change: from w2k to XP.
Last NTFS layout change: from NT4 to w2k, backported to some late NT4 SP.


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

Maxim S. Shatskih wrote:

> I was under the impression that PE header formats changed between
> versions of the OS
>

Not so.

I had a .SYS binary which worked OK from NT4 to Vista.

So are the user-mode apps.

That sounds right on, but I recall having an unusual problem once. When
I built a particular
code base for Vista and tried to run it on w2k, an error of “Invalid
image format” or something to
that effect was produced. However, when I built the same code base for
w2k, all OS versions
at base and upwards were fine.

In reading threw MS’s PE Format specification document this morning, it
kinda appears there
might be two areas where an older machine might not understand the
format (just a quick scan
through finding “compatibility”). But for this to be the case,
linker/compiler options would of
had to been messed up seriously - and I don’t generally mess with those
a whole lot…

I figure it’s more likely that I had errors during the build that were
not caught causing the build
to stop… Thus garbage was generated…

I really can’t recall the specifics of what happened, I just jumped to
the conclusion that
modifications/updates to the PE format ‘might’ not be understood by
older systems.

Now that I think about it, ‘backwards compatibility’ actually has two
different meanings, never
really thought about that…

Matt

Starting with the vista wdk, applications are marked as running on vista and forward in the PE header. The side effect of this is that on older platforms, this shows up as an invalid image format. You can control the versioning by adding the _NT_TARGET_VERSION directive to your sources file. For example

_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WIN2K)

This also controls what parts of the headers are exposed to your applications. Note that drivers use the directive to control what is exposed in the header, but the driver’s PE header is not changed like an app’s would be.

d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Matt
Sent: Sunday, May 25, 2008 4:03 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Binary compatible?

Maxim S. Shatskih wrote:

> I was under the impression that PE header formats changed between
> versions of the OS
>

Not so.

I had a .SYS binary which worked OK from NT4 to Vista.

So are the user-mode apps.

That sounds right on, but I recall having an unusual problem once. When
I built a particular
code base for Vista and tried to run it on w2k, an error of “Invalid
image format” or something to
that effect was produced. However, when I built the same code base for
w2k, all OS versions
at base and upwards were fine.

In reading threw MS’s PE Format specification document this morning, it
kinda appears there
might be two areas where an older machine might not understand the
format (just a quick scan
through finding “compatibility”). But for this to be the case,
linker/compiler options would of
had to been messed up seriously - and I don’t generally mess with those
a whole lot…

I figure it’s more likely that I had errors during the build that were
not caught causing the build
to stop… Thus garbage was generated…

I really can’t recall the specifics of what happened, I just jumped to
the conclusion that
modifications/updates to the PE format ‘might’ not be understood by
older systems.

Now that I think about it, ‘backwards compatibility’ actually has two
different meanings, never
really thought about that…

Matt


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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

Thanks! Something similar will work great for me!

-----Ursprungligt meddelande-----
Fr?n: xxxxx@lists.osr.com [mailto:bounce-325013-
xxxxx@lists.osr.com] F?r Tim Roberts
Skickat: den 22 maj 2008 19:01
Till: Windows System Software Devs Interest List
?mne: Re: SV: [ntdev] Binary compatible?

Mattias Br?ndstr?m wrote:
> Thanks for the info everyone!
>
> Now I have a follow-up question that you might be able to answer. :slight_smile:
>
> I want to be able to build more than one target from a single source
tree. The WDK documentation suggests that I can do this by having my
source in driver/ and then one source file in drivers/xp32/ and
drivers/xp64/ each.
>
> What I can’t seem to find clear documentation on is what macros I need
to place in the source files to build my targets. I understand that I
should use _NT_TARGET_VERSION to select the operating system, but what
macro should I use to select the architecture (32bit or 64bit)?
>

Mark’s answer is correct, you can’t do this in a single call to build.
Here is part of a batch file I use to build multiple environments in a
single run (in this case, XP checked and XP free, but you can figure out
how to extend it). Note that this must be started from a command line
that has not already run “setenv”:

setlocal
set BLD=
if “%1” == “clean” set BLD=-c
set LAST=%CD%
call %DDK%\bin\setenv %DDK% chk WXP
@echo on
set USERNAME=timr
cd %LAST%
build %BLD%
endlocal

setlocal
set BLD=
if “%1” == “clean” set BLD=-c
set LAST=%CD%
call %DDK%\bin\setenv %DDK% fre WXP
@echo on
set USERNAME=timr
cd %LAST%
build %BLD%
endlocal


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

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