How to tell KMDF version at compile time

I suspect a regression in KMDF between DDK 7600 and 6001 and I want to
recompile using 6001 to see if the bug goes away, but now my code is
littered with eg “static KSTART_ROUTINE XenPci_BalloonThreadProc;” to
keep the static code verifier happy, which doesn’t work under 6001. I
build my drivers for Win2K so I already have “#if (NTDDI_VERSION >=
NTDDI_WINXP)” around such declarations, but that detects the build
target, not the DDK version.

I can see a few possibilities for detecting the KMDF version at compile
time, but what is the “correct” way?

Thanks

James

>

I suspect a regression in KMDF between DDK 7600 and 6001 and I want to
recompile using 6001 to see if the bug goes away, but now my code is
littered with eg “static KSTART_ROUTINE XenPci_BalloonThreadProc;” to
keep the static code verifier happy, which doesn’t work under 6001. I
build my drivers for Win2K so I already have “#if (NTDDI_VERSION >=
NTDDI_WINXP)” around such declarations, but that detects the build
target, not the DDK version.

I can see a few possibilities for detecting the KMDF version at
compile
time, but what is the “correct” way?

It seems that if I #include <ntverp.h> I get a bunch of #defines
including VER_PRODUCTBUILD which is 7600 or 6001 depending on the DDK I
select, which will do just nicely.

James</ntverp.h>

If you can document such a regression, that would be important news for the community. Please keep us all informed!

Peter
OSR

Kmdf versions are not tied to the os version , using ntverp.h won’t work. The wdk adds 2 #defines you can use, KMDF_VERSION_MAJOR and MINOR which correspond to the version of kmdf which shipped with the wdk.

Can you describe your suspected regression ?

d

debt from my phone

-----Original Message-----
From: James Harper
Sent: Wednesday, April 27, 2011 5:34 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to tell KMDF version at compile time

I suspect a regression in KMDF between DDK 7600 and 6001 and I want to
recompile using 6001 to see if the bug goes away, but now my code is
littered with eg “static KSTART_ROUTINE XenPci_BalloonThreadProc;” to
keep the static code verifier happy, which doesn’t work under 6001. I
build my drivers for Win2K so I already have “#if (NTDDI_VERSION >=
NTDDI_WINXP)” around such declarations, but that detects the build
target, not the DDK version.

I can see a few possibilities for detecting the KMDF version at compile
time, but what is the “correct” way?

Thanks

James


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

>

Kmdf versions are not tied to the os version , using ntverp.h won’t
work. The
wdk adds 2 #defines you can use, KMDF_VERSION_MAJOR and MINOR which
correspond
to the version of kmdf which shipped with the wdk.

It’s not the OS version I’m interested in it’s the DDK version. 7600
typedefs a KSTART_ROUTINE procedure while 6001 doesn’t, so if I have
“KSTART_ROUTINE XenPci_BalloonThreadProc;” then it won’t compile under
6001, but if I do:

#if (VER_PRODUCTBUILD >= 7600)
static KSTART_ROUTINE XenPci_BalloonThreadProc;
#endif

Then it gives me exactly the result I want.

Can you describe your suspected regression ?

The regression is the hibernate issue under XP that I’ve posted about
previously. It used to work under my driver and now it doesn’t, and one
of the changes along the way was to move to the 7600 DDK so I wanted to
rule that out. Going back to 6001 and installing the 1.7 KMDF didn’t
resolve the problem so it’s nothing to do with that after all. Maybe 1.5
is the next thing to try but I’m not sure it’s related now.

James