From: "plaisthos (Code Review)" Date: Mon, 20 Nov 2023 10:51:21 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="DVBel8dtU1M="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Remove compat versionhelpers.h and remove cmake/configure check for it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --DVBel8dtU1M= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/445?usp=3Demail to review the following change. Change subject: Remove compat versionhelpers.h and remove cmake/configure c= heck for it ...................................................................... Remove compat versionhelpers.h and remove cmake/configure check for it The cmake file defined that file to be never present in contrast to the old msvc-config.h that always had it present. Also interactive.c includes versionhelpers.h without the check, so we always assume it to be present anyway. Remove also the comapt implementation taken from mingw Change-Id: I9c85ccab6d51064ebff2c391740ba8c2d044ed1a --- M CMakeLists.txt M config.h.cmake.in M configure.ac M src/compat/Makefile.am D src/compat/compat-versionhelpers.h M src/openvpn/win32.c M src/openvpnserv/interactive.c 7 files changed, 1 insertion(+), 131 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/45/445/1 diff --git a/CMakeLists.txt b/CMakeLists.txt index d21c9bd..fa6d623 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,6 @@ src/compat/compat-dirname.c src/compat/compat-gettimeofday.c src/compat/compat-strsep.c - src/compat/compat-versionhelpers.h src/openvpn/argv.c src/openvpn/argv.h src/openvpn/base64.c diff --git a/config.h.cmake.in b/config.h.cmake.in index 19b79bc..8edaff4 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -374,9 +374,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VALGRIND_MEMCHECK_H -/* Define to 1 if you have the header file. */ -#undef HAVE_VERSIONHELPERS_H - /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK diff --git a/configure.ac b/configure.ac index 84eaad6..94c6654 100644 --- a/configure.ac +++ b/configure.ac @@ -455,7 +455,6 @@ unistd.h dlfcn.h \ netinet/in.h \ netinet/tcp.h arpa/inet.h netdb.h \ - versionhelpers.h \ ]) AC_CHECK_HEADERS([ \ sys/time.h sys/ioctl.h sys/stat.h \ diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am index f5de451..5298dd8 100644 --- a/src/compat/Makefile.am +++ b/src/compat/Makefile.am @@ -20,5 +20,4 @@ compat-basename.c \ compat-gettimeofday.c \ compat-daemon.c \ - compat-strsep.c \ - compat-versionhelpers.h + compat-strsep.c \ No newline at end of file diff --git a/src/compat/compat-versionhelpers.h b/src/compat/compat-version= helpers.h deleted file mode 100644 index b071602..0000000 --- a/src/compat/compat-versionhelpers.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _INC_VERSIONHELPERS -#define _INC_VERSIONHELPERS - -#include - -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && !defined(__WIDL__) - -#ifdef __cplusplus -#define VERSIONHELPERAPI inline bool -#else -#define VERSIONHELPERAPI FORCEINLINE BOOL -#endif - -#define _WIN32_WINNT_WINBLUE 0x0603 - -#ifndef _WIN32_WINNT_WINTHRESHOLD -#define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */ -#endif - -VERSIONHELPERAPI -IsWindowsVersionOrGreater(WORD major, WORD minor, WORD servpack) -{ - OSVERSIONINFOEXW vi =3D {sizeof(vi), major, minor, 0, 0, {0}, servpack= }; - return VerifyVersionInfoW(&vi, VER_MAJORVERSION|VER_MINORVERSION|VER_S= ERVICEPACKMAJOR, - VerSetConditionMask(VerSetConditionMask(VerS= etConditionMask(0, - = VER_MAJORVERSION, VER_GREATER_EQUAL), - VER_= MINORVERSION, VER_GREATER_EQUAL), - VER_SERVICEPACKMAJOR, VE= R_GREATER_EQUAL)); -} - -VERSIONHELPERAPI -IsWindowsXPOrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_W= IN32_WINNT_WINXP), 0); -} - -VERSIONHELPERAPI -IsWindowsXPSP1OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_W= IN32_WINNT_WINXP), 1); -} - -VERSIONHELPERAPI -IsWindowsXPSP2OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_W= IN32_WINNT_WINXP), 2); -} - -VERSIONHELPERAPI -IsWindowsXPSP3OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_W= IN32_WINNT_WINXP), 3); -} - -VERSIONHELPERAPI -IsWindowsVistaOrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_W= IN32_WINNT_VISTA), 0); -} - -VERSIONHELPERAPI -IsWindowsVistaSP1OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_W= IN32_WINNT_VISTA), 1); -} - -VERSIONHELPERAPI -IsWindowsVistaSP2OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_W= IN32_WINNT_VISTA), 2); -} - -VERSIONHELPERAPI -IsWindows7OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WI= N32_WINNT_WIN7), 0); -} - -VERSIONHELPERAPI -IsWindows7SP1OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WI= N32_WINNT_WIN7), 1); -} - -VERSIONHELPERAPI -IsWindows8OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WI= N32_WINNT_WIN8), 0); -} - -VERSIONHELPERAPI -IsWindows8Point1OrGreater(void) -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(= _WIN32_WINNT_WINBLUE), 0); -} - -VERSIONHELPERAPI -IsWindows10OrGreater() -{ - return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LO= BYTE(_WIN32_WINNT_WINTHRESHOLD), 0); -} - -VERSIONHELPERAPI -IsWindowsServer(void) -{ - OSVERSIONINFOEXW vi =3D {sizeof(vi), 0, 0, 0, 0, {0}, 0, 0, 0, VER_NT_= WORKSTATION}; - return !VerifyVersionInfoW(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(= 0, VER_PRODUCT_TYPE, VER_EQUAL)); -} - -#endif /* if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && !defined= (__WIDL__) */ -#endif /* ifndef _INC_VERSIONHELPERS */ diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index 47eb1fc..e998d90 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -45,11 +45,7 @@ #include "memdbg.h" -#ifdef HAVE_VERSIONHELPERS_H #include -#else -#include "compat-versionhelpers.h" -#endif #include "block_dns.h" diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index a47db8a..32c8996 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -34,11 +34,7 @@ #include #include -#ifdef HAVE_VERSIONHELPERS_H #include -#else -#include "compat-versionhelpers.h" -#endif #include "openvpn-msg.h" #include "validate.h" -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/445?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I9c85ccab6d51064ebff2c391740ba8c2d044ed1a Gerrit-Change-Number: 445 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --DVBel8dtU1M= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

Remove compat versionhelpers.h and remove cmake/configure che=
ck for it

The cmake file defined that file to be never present in co= ntrast to the
old msvc-config.h that always had it present. Also interac= tive.c includes
versionhelpers.h without the check, so we always assume = it to be present
anyway. Remove also the comapt implementation taken fro= m mingw

Change-Id: I9c85ccab6d51064ebff2c391740ba8c2d044ed1a
---<= br>M CMakeLists.txt
M config.h.cmake.in
M configure.ac
M src/compa= t/Makefile.am
D src/compat/compat-versionhelpers.h
M src/openvpn/win3= 2.c
M src/openvpnserv/interactive.c
7 files changed, 1 insertion(+), = 131 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn =
refs/changes/45/445/1
diff --git a/CMakeLists.txt b/CMakeLists.txt<=
/span>
index d21c9bd..fa6d623 100644
--- a/CMakeLi= sts.txt
+++ b/CMakeLists.txt
@@ -308,7 +308= ,6 @@
src/compat/compat-dirname.c
= src/compat/compat-gettimeofday.c
src/compat/compat-st= rsep.c
- src/compat/= compat-versionhelpers.h
src/openvpn/argv.c
<= span> src/openvpn/argv.h

src/openvpn/base64.c
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 19b79bc..8edaff4 100644

--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -374,9 +374,6 @@<= /span>
/* Define to 1 if you have the <valgrind/memcheck.h>= header file. */
#undef HAVE_VALGRIND_MEMCHECK_H
-/* Define to = 1 if you have the <versionhelpers.h> header file. */
-#undef HAVE_VERSIONHELPERS_H-
/* Define to = 1 if you have the `vfork' function. */
#undef HAVE_VFO= RK

diff --git a/configure.ac b/configure.= ac
index 84eaad6..94c6654 100644
--- a/conf= igure.ac
+++ b/configure.ac
@@ -455,7 +455,= 6 @@
unistd.h dlfcn.h \
netinet/in.h \<= /span>
netinet/tcp.h arpa/inet.h netdb.h \
- versionhelpers.h \
])
AC_CHECK_HEADERS([ \
sys/time.h sys/ioctl.h= sys/stat.h \
diff --git a/src/compat/Makefile.am b/src/com= pat/Makefile.am
index f5de451..5298dd8 100644
--- a/src/compat/Makefile.am

+++ b/src/compat/Makefile.a= m
@@ -20,5 +20,4 @@
compat-basename.c \
compat-gettimeofday.c \
compat-daemon.c = \
- compat-strsep.c \
- compat-versionhelpers.= h
+ compat-strsep.c
\ No newline at end of file
diff --git a/src= /compat/compat-versionhelpers.h b/src/compat/compat-versionhelpers.h=
deleted file mode 100644
index b071602..0000000
--- a/src/compat/compat-versionhelpers.h
+++= /dev/null
@@ -1,116 +0,0 @@
-/**
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the= file DISCLAIMER within this package.

- */
-
-#ifndef _INC_VERSIONHEL= PERS
-#define _INC_VERS= IONHELPERS
-
= -#include <winapifamily.h><= /span>
-
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITIO= N_DESKTOP) && !defined(__WIDL__)
-
-#i= fdef __cplusplus
-#defi= ne VERSIONHELPERAPI inline bool
-#else
-#defin= e VERSIONHELPERAPI FORCEINLINE BOOL
-#endif
-<= /span>
-#define _WIN32_WINNT_W= INBLUE 0x0603
-
-#ifndef _WIN32_WINNT_WINTH= RESHOLD
-#define _WIN32= _WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
-#endif
-
-VERSIONHELP= ERAPI
-IsWindowsVersion= OrGreater(WORD major, WORD minor, WORD servpack)
-{
- OSVERSIONINFOEXW vi =3D {sizeof(vi), major, minor, 0, 0, {0}, se= rvpack};
- return Ve= rifyVersionInfoW(&vi, VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACK= MAJOR,
- = VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(= 0,
- = VER_= MAJORVERSION, VER_GREATER_EQUAL),
- = VER_MINORVERSION, VER_GREATER_EQUAL),
- VE= R_SERVICEPACKMAJOR, VER_GREATER_EQUAL));
-}
-<= /span>
-VERSIONHELPERAPI
-IsWindowsXPOrGreater(void)<= /span>
-{
- return IsWindowsVersionOrGreater(HIBYT= E(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
-}
-
-VERSIONH= ELPERAPI
-IsWindowsXPSP= 1OrGreater(void)
-{
- return IsWindowsVersi= onOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1);
-}
-
-VERSIONHELPERAPI
-IsWindowsXPSP2OrGreater(void)
-{
- re= turn IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WI= NNT_WINXP), 2);
-}
-
-VERSIONHELPERAPI
-IsWindowsXPSP3OrGreater(void)
-{
- return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP)= , LOBYTE(_WIN32_WINNT_WINXP), 3);
-}
-<= br>-VERSIONHELPERAPI
-IsWindowsVistaOrGreater(void)
-{
- return IsWindowsVersionOrGreater(HIBYTE(_W= IN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
-}
-
-VERSIONHELPE= RAPI
-IsWindowsVistaSP1= OrGreater(void)
-{
- return IsWindowsVersio= nOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1);
-}
-
-VERSIONHELPERAPI
-{
- re= turn IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WI= NNT_VISTA), 2);
-}
-
-VERSIONHELPERAPI
-IsWindows7OrGreater(void)
-{
- return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBY= TE(_WIN32_WINNT_WIN7), 0);
-}
-
-VERSIONHELPERAPI

-IsWindows7SP1OrGreater(void)
-{

- return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WIN= NT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1);
-}
-<= /span>
-VERSIONHELPERAPI
-IsWindows8OrGreater(void)
-{
- return IsWindowsVersionOrGreater(HIBYTE= (_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
-}
-
-VERSIONHE= LPERAPI
-IsWindows8Poin= t1OrGreater(void)
-{

- return IsWindowsVers= ionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0)= ;
-}
-
-VERSIONHELPERAPI
-IsWindows10OrGreater()
-{
- return= IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LOBYTE(_WIN32= _WINNT_WINTHRESHOLD), 0);
-}
-
-VERSIONHELPERAPI

-IsWindowsServer(void)
-{
- OSVERSIONINFOEXW vi =3D {sizeof(vi), 0, 0, 0, 0, {0}, 0, 0= , 0, VER_NT_WORKSTATION};
- return !VerifyVersionInfoW(&vi, VER_PRODUCT_TYPE, VerSetConditi= onMask(0, VER_PRODUCT_TYPE, VER_EQUAL));
-}
-<= /span>
-#endif /* if WINAPI_FA= MILY_PARTITION(WINAPI_PARTITION_DESKTOP) && !defined(__WIDL__) */
-#endif /* ifndef _INC_V= ERSIONHELPERS */
diff --git a/src/openvpn/win32.c b/src/ope= nvpn/win32.c
index 47eb1fc..e998d90 100644
= --- a/src/openvpn/win32.c
+++ b/src/openvpn/win32.c<= br>@@ -45,11 +45,7 @@

#include &qu= ot;memdbg.h"

-#ifdef HAVE_VERSIONHELPERS_H
#include <ve= rsionhelpers.h>
-#el= se
-#include "comp= at-versionhelpers.h"
-#endif

#include "block_dns.h&qu= ot;

diff --git a/src/openvpnserv/interact= ive.c b/src/openvpnserv/interactive.c
index a47db8a..32c899= 6 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c

@@ -34,11 +34,7 @@
#include <shellapi.h>
#include <ms= tcpip.h>

-#ifdef HAVE_VERSIONHELPERS_H
#include <versionh= elpers.h>
-#else
-#include "compat-ver= sionhelpers.h"
-#e= ndif

#include "openvpn-msg.h"<= /span>
#include "validate.h"

To view, visit change 445. To unsubscribe, or for help writing mail fi= lters, visit settings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9c85ccab6d51064ebff2c391740= ba8c2d044ed1a
Gerrit-Change-Number: 445
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--DVBel8dtU1M=--