VirtualBox

Changeset 92902 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Dec 14, 2021 10:06:10 PM (3 years ago)
Author:
vboxsync
Message:

iprt/win/windows.h,++: Workaround for buggy winioctl.h in some windows 10 SDKs, must make sure to include our windows.h wrapper with the necessary tricks. bugref:10116

Location:
trunk/include/iprt/win
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/win/d3d9.h

    r85121 r92902  
    3030#endif
    3131
     32/* d3d9.h includes windows.h (via objbase.h -> rpc.h), so do it up front using
     33   our wrappers to avoid needing to duplicate warning workarounds for it. */
     34#include <iprt/win/windows.h>
     35
    3236#ifdef _MSC_VER
    3337# pragma warning(push)
  • trunk/include/iprt/win/objbase.h

    r85121 r92902  
    3030#endif
    3131
     32/* objbase.h includes windows.h via rpc.h, so get ahead of it and include
     33   it here via our cleanup wrapper. */
     34#include <iprt/win/windows.h>
     35
    3236#ifdef _MSC_VER
    3337# pragma warning(push)
  • trunk/include/iprt/win/windows.h

    r85121 r92902  
    2828#ifndef RT_WITHOUT_PRAGMA_ONCE
    2929# pragma once
     30#endif
     31
     32
     33/* winioctl.h in windows 10 SDKs up to 22000(?) has a warning(push/pop) bug in the
     34   portion taken from ntddscm.h causing trouble when using _WIN32_WINNT or NTDDI_VERSION
     35   older than NTDDI_WIN10_RS5.  In 18362 winioctl.h also tests against _WIN32_WINNT_WIN10_TH2
     36   and other sdkddkver.h defines which only exist in NTDDI variants, not in _WIN32_WINNT_XXX,
     37   so we fake up those too to keep the precompiler warning free.
     38
     39   Work around this by blocking out the buggy section on winioctl.h for now if the
     40   NTDDI_VERSION target is too small.
     41
     42   WDK_NTDDI_VERSION is not present in the W7 SDK, not sure when exactly it was added.
     43   NTDDI_WIN10_RS5 is W10 1809. NTDDI_WIN10_CO is Windows 11? */
     44#include <sdkddkver.h>
     45#ifdef _WIN32_WINNT_WIN10
     46# ifndef _WIN32_WINNT_WIN10_TH2
     47#  define _WIN32_WINNT_WIN10_TH2 _WIN32_WINNT_WIN10
     48# endif
     49# ifndef _WIN32_WINNT_WIN10_RS1
     50#  define _WIN32_WINNT_WIN10_RS1 _WIN32_WINNT_WIN10
     51# endif
     52# ifndef _WIN32_WINNT_WIN10_RS2
     53#  define _WIN32_WINNT_WIN10_RS2 _WIN32_WINNT_WIN10
     54# endif
     55# ifndef _WIN32_WINNT_WIN10_RS3
     56#  define _WIN32_WINNT_WIN10_RS3 _WIN32_WINNT_WIN10
     57# endif
     58# ifndef _WIN32_WINNT_WIN10_RS4
     59#  define _WIN32_WINNT_WIN10_RS4 _WIN32_WINNT_WIN10
     60# endif
     61# ifndef _WIN32_WINNT_WIN10_RS5
     62#  define _WIN32_WINNT_WIN10_RS5 _WIN32_WINNT_WIN10
     63# endif
     64#endif
     65#if defined(NTDDI_WIN10_RS5) && !defined(NTDDI_WIN10_CO) && defined(WDK_NTDDI_VERSION)
     66# if NTDDI_VERSION < NTDDI_WIN10_RS5
     67#  define _NTDDSCM_H_ buggy, hope nobody needs it.
     68# endif
    3069#endif
    3170
  • trunk/include/iprt/win/winsock2.h

    r85121 r92902  
    3030#endif
    3131
     32/* winsock2.h includes windows.h, but without winsock.h, so we need to do it
     33   up front using our wrapper header to avoid repeating tricks here. */
     34#define _WINSOCKAPI_ /* do not include winsock.h via windows.h */
     35#include <iprt/win/windows.h>
     36
    3237#ifdef _MSC_VER
    3338/*
  • trunk/include/iprt/win/ws2tcpip.h

    r85121 r92902  
    3030#endif
    3131
     32/* ws2tcpip.h includes winsock2.h, so get ahead of it and include our cleanly
     33   wrapped version first to avoid duplicating stuff here. */
     34#include <iprt/win/winsock2.h>
     35
    3236#ifdef _MSC_VER
    3337# pragma warning(push)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette