Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is SDKDDKVer.h for?

All project created with MSVC have stdafx, which is precompiled headers, which I know what they are but what about targetver.h ? It includes SDKDDKVer.h, and I can't find what is that header about.

What is this for ?

like image 257
jokoon Avatar asked May 10 '12 17:05

jokoon


2 Answers

targetver.h and SDKDDKVer.h are used to control what functions, constants, etc. are included into your code from the Windows headers, based on the OS that you want your program to support. I believe that targetver.h sets defaults to using the latest version of Windows unless the defines are specified elsewhere.

SDKDDKVer.h is the header file that actually defines the #defines that represent each version of Windows, IE, etc.

like image 96
Andy Avatar answered Oct 24 '22 02:10

Andy


Line 193 of the SDKDDKVer.h (in SDK 8.1) states:

"if versions aren't already defined, default to most current"

This comment is specifically referring to the _WIN32_WINNT and NTDDI_VERSION macros.

So..

  1. SDKDDKVer.h applies default values unless the macros have already been defined
  2. the following code can be used to explicitly define the macros
    • #define _WIN32_WINNT 0x0601
    • #define NTDDI_VERSION 0x06010000
  3. Interestingly enough, the SDKDDKVer.h header file has 'constant' values defined for all of the SDK versions. For example:
    • #define _WIN32_WINNT_WINXP 0x0501
    • #define _WIN32_WINNT_WIN7 0x0601
    • #define _WIN32_WINNT_WIN8 0x0602
  4. One convention is to define _WIN32_WINNT and NTDDI_VERSIONin a header file called TargetVer.h, which you would reference in your pre-compiled header StdAfx.h.

ADDTIONAL READING

  • Modifying WINVER and _WIN32_WINNT
  • Using the Windows Headers
  • What does the Target Platform Version mean for a VS C++ project?
like image 30
Pressacco Avatar answered Oct 24 '22 01:10

Pressacco