diff --git a/cmake/re-config.cmake b/cmake/re-config.cmake index 34ebe80a5..4fefb4b09 100644 --- a/cmake/re-config.cmake +++ b/cmake/re-config.cmake @@ -135,6 +135,20 @@ if(WIN32) WIN32 _WIN32_WINNT=0x0600 ) + + unset(CMAKE_EXTRA_INCLUDE_FILES) + set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h;qos2.h") + check_type_size("QOS_FLOWID" HAS_QOS_FLOWID BUILTIN_TYPES_ONLY) + check_type_size("PQOS_FLOWID" HAS_PQOS_FLOWID BUILTIN_TYPES_ONLY) + unset(CMAKE_EXTRA_INCLUDE_FILES) + + if(HAS_QOS_FLOWID) + list(APPEND RE_DEFINITIONS HAS_QOS_FLOWID) + endif() + + if(HAS_PQOS_FLOWID) + list(APPEND RE_DEFINITIONS HAS_PQOS_FLOWID) + endif() endif() if(USE_OPENSSL) diff --git a/src/udp/udp.c b/src/udp/udp.c index 496e7581d..802fb59e9 100644 --- a/src/udp/udp.c +++ b/src/udp/udp.c @@ -28,12 +28,18 @@ #include #include #ifdef WIN32 -#if !defined(_MSC_VER) -typedef UINT32 QOS_FLOWID, *PQOS_FLOWID; +#ifndef HAS_QOS_FLOWID +typedef UINT32 QOS_FLOWID; +#endif + +#ifndef HAS_PQOS_FLOWID +typedef UINT32 *PQOS_FLOWID; +#endif + #ifndef QOS_NON_ADAPTIVE_FLOW #define QOS_NON_ADAPTIVE_FLOW 0x00000002 #endif -#endif /*!_MSC_VER*/ + #include #endif /*WIN32*/