0

Function AddDllDirectory was added to Windows 7 in one of the updates.

I'm using Windows 10 SDK headers in my c++ application. Is it possible to configure them to show only functions available in first Windows 7 version (without any updates) ?

I read about defines of:

WINVER, _WIN32_WINNT

I tried to set them to:

#define _WIN32_WINNT 0x601
#define NTDDI_VERSION 0x06010000

or even:

#define _WIN32_WINNT 0x600
#define NTDDI_VERSION 0x06000000

, but it doesn't work.

AdamF
  • 2,501
  • 17
  • 30

1 Answers1

0

The NTDDI_VERSION macro uses a 32-bit number that includes service pack information. The older defines (WINVER, _WIN32_WINNT, _WIN32_WINDOWS, and _WIN32_IE) is just a 16-bit number, typically in hex: 0xaabb where aa is the Windows major version and bb is the minor version.

The correct value for Windows 7 is therefore 0x0601 for these defines and 0x06010000 is just for NTDDI_VERSION. The SdkDdkver.h header also provides macros like _WIN32_WINNT_WIN7 and NTDDI_WIN7 where the version numbers are listed for you.

AJM
  • 1,317
  • 2
  • 15
  • 30
Anders
  • 97,548
  • 12
  • 110
  • 164
  • 2
    The [AddDllDirectory](https://msdn.microsoft.com/en-us/library/windows/desktop/hh310513.aspx) API call was introduced in a [Security Advisory](https://support.microsoft.com/en-us/help/2533623/microsoft-security-advisory-insecure-library-loading-could-allow-remot) update. I doubt that `NTDDI_VERSION` has any provision for that. – IInspectable Mar 02 '18 at 19:58
  • Another relevant URL: https://devblogs.microsoft.com/oldnewthing/20070410-00/?p=27313 – AJM Feb 16 '23 at 15:22