Is there a #define that I can check in my code to identify which WDK is being used?
With the Win8 WDK someone at MS thought it would be a good idea to rename one of the members of the _CDB union in storport.h. While the new name is better in the sense that it is the same name that T10 uses, it means that my code now can’t compile with multiple kits without #if junk. I’d be happy to switch everything over to the new kit, if it supported all the required Windows versions, but of course it does not.
I have tenatively put #if _MSC_VER < 1700 in the code, but I’d rather use a symbol that comes from the kit instead of the compiler if one exists. I don’t see one, however.
The WDK does not provide a preprocessor symbol. Since the header change (can you send the specific change please?) is tied to a windows release, perhaps an NTDDI_VERSION comparison would be better than tying it to a compiler version.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, August 8, 2012 4:34 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] WDK preprocessor symbol
Is there a #define that I can check in my code to identify which WDK is being used?
With the Win8 WDK someone at MS thought it would be a good idea to rename one of the members of the _CDB union in storport.h. While the new name is better in the sense that it is the same name that T10 uses, it means that my code now can’t compile with multiple kits without #if junk. I’d be happy to switch everything over to the new kit, if it supported all the required Windows versions, but of course it does not.
I have tenatively put #if _MSC_VER < 1700 in the code, but I’d rather use a symbol that comes from the kit instead of the compiler if one exists. I don’t see one, however.
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
I only see one copy of storport.h in the kit, so NTDDI isn’t exactly what I want either. The new name is really tied to the kit.
In practice NTDDI or MSC_VER will work because they will imply the information that I want (in this case), I was just hoping to be able to essentially test for which version of storport.h I’m using.
Based on your answer, I’ll have to fall back to using the implication either that I’m only going to build the 2k3 binary with the old kit (use NTDDI), or that the new kit will always be using a compiler later than 17.0.
Thanks Doron.
I am curious, what field in what struct in the CDB changed from w7 to w8?
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, August 8, 2012 4:50 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WDK preprocessor symbol
I only see one copy of storport.h in the kit, so NTDDI isn’t exactly what I want either. The new name is really tied to the kit.
In practice NTDDI or MSC_VER will work because they will imply the information that I want (in this case), I was just hoping to be able to essentially test for which version of storport.h I’m using.
Based on your answer, I’ll have to fall back to using the implication either that I’m only going to build the 2k3 binary with the old kit (use NTDDI), or that the new kit will always be using a compiler later than 17.0.
Thanks Doron.
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
On 09-Aug-2012 02:34, xxxxx@gmail.com wrote:
Is there a #define that I can check in my code to identify which WDK is being used?
With the Win8 WDK someone at MS thought it would be a good idea to rename one of the members of the _CDB union in storport.h. While the new name is better in the sense that it is the same name that T10 uses, it means that my code now can’t compile with multiple kits without #if junk. I’d be happy to switch everything over to the new kit, if it supported all the required Windows versions, but of course it does not.
I have tenatively put #if _MSC_VER < 1700 in the code, but I’d rather use a symbol that comes from the kit instead of the compiler if one exists. I don’t see one, however.
Maybe, #ifdef NTDDI_WIN8 (in sdkddkver.h)
– pa
You don’t want #ifdef NTDD_WIN8, you want
#if NTDDI_VERSION >= NTDDI_WIN8
NTDDI_WIN8 is always defined, NTDDI_VERSION is what changes based on the target OS you are building for
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A
Sent: Wednesday, August 8, 2012 4:53 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] WDK preprocessor symbol
On 09-Aug-2012 02:34, xxxxx@gmail.com wrote:
Is there a #define that I can check in my code to identify which WDK is being used?
With the Win8 WDK someone at MS thought it would be a good idea to rename one of the members of the _CDB union in storport.h. While the new name is better in the sense that it is the same name that T10 uses, it means that my code now can’t compile with multiple kits without #if junk. I’d be happy to switch everything over to the new kit, if it supported all the required Windows versions, but of course it does not.
I have tenatively put #if _MSC_VER < 1700 in the code, but I’d rather use a symbol that comes from the kit instead of the compiler if one exists. I don’t see one, however.
Maybe, #ifdef NTDDI_WIN8 (in sdkddkver.h)
– pa
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
Doron Holan wrote:
You don’t want #ifdef NTDD_WIN8, you want
#if NTDDI_VERSION >= NTDDI_WIN8
NTDDI_WIN8 is always defined, NTDDI_VERSION is what changes based on the target OS you are building for
NTDDI_WIN8 is only defined if you are building with the Win 8 WDK (or
its successors). In fact, that’s probably the symbol that solves the
original poster’s problem.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Doron,
I didn’t go and check all the fields, but the one the compiler caught because I was using it was
the old BlockCount member of the READ_CAPACITY16 field in union _CDB. It’s name changed to
AllocationLength in the Win8 storport.h. I found it pretty surprising because MS is usually
very good about not changing things like this.
pre-Win8
typedef union _CDB {
…
struct _READ_CAPACITY16 {
UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16
UCHAR ServiceAction : 5;
UCHAR Reserved1 : 3;
UCHAR LogicalBlock[8];
UCHAR BlockCount[4];
UCHAR PMI : 1;
UCHAR Reserved2 : 7;
UCHAR Control;
} READ_CAPACITY16;
…
} CDB, *PCDB;
Win8
typedef union _CDB {
…
struct _READ_CAPACITY16 {
UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16
UCHAR ServiceAction : 5;
UCHAR Reserved1 : 3;
UCHAR LogicalBlock[8];
UCHAR AllocationLength[4];
UCHAR PMI : 1;
UCHAR Reserved2 : 7;
UCHAR Control;
} READ_CAPACITY16;…
} CDB, *PCDB;
#if defined(NTDDI_WIN8) feels like the best choice. Something about using the compiler version irks me even though its functionally equivalent for this.
If all you want to do is detect the win8 kit, #ifdef NTDDI_WIN8 is probably the most ingenious way to make that check (which is a result of a side effect of wdk content itself, not the wdk declaring its version). I looked at the w8 and 7 versions, the changes probably should have been wrapped in an #ifdef NTDDI_VERSION >= NTDDI_WIN8 check, if only to allow existing code to continue to compile.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, August 8, 2012 5:28 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] WDK preprocessor symbol
Doron,
I didn’t go and check all the fields, but the one the compiler caught because I was using it was the old BlockCount member of the READ_CAPACITY16 field in union _CDB. It’s name changed to AllocationLength in the Win8 storport.h. I found it pretty surprising because MS is usually very good about not changing things like this.
pre-Win8
typedef union _CDB {
…
struct _READ_CAPACITY16 {
UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16
UCHAR ServiceAction : 5;
UCHAR Reserved1 : 3;
UCHAR LogicalBlock[8];
UCHAR BlockCount[4];
UCHAR PMI : 1;
UCHAR Reserved2 : 7;
UCHAR Control;
} READ_CAPACITY16;
…
} CDB, *PCDB;
Win8
typedef union _CDB {
…
struct _READ_CAPACITY16 {
UCHAR OperationCode; // 0x9E - SCSIOP_READ_CAPACITY16
UCHAR ServiceAction : 5;
UCHAR Reserved1 : 3;
UCHAR LogicalBlock[8];
UCHAR AllocationLength[4];
UCHAR PMI : 1;
UCHAR Reserved2 : 7;
UCHAR Control;
} READ_CAPACITY16;…
} CDB, *PCDB;
#if defined(NTDDI_WIN8) feels like the best choice. Something about using the compiler version irks me even though its functionally equivalent for this.
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
Hello,
I found way for a driver YOU compile…
just <ntverp.h>
You’ll find there VER_PRODUCTBUILD/VER_PRODUCTBUILD_QFE defines which represents the WDK build number.
e.g. for Legacy WDK:
#define VER_PRODUCTBUILD /* NT */ 7600
#define VER_PRODUCTBUILD_QFE 16385
For Win8 RTM 9200 WDK:
#define VER_PRODUCTBUILD 9200
#define VER_PRODUCTBUILD_QFE 16385
Alon</ntverp.h>