From patchwork Fri Jul 24 04:14:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 1331 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.27.255.58]) by backend30.mail.ord1d.rsapps.net with LMTP id kLfgCR/tGl/oFQAAIUCqbw for ; Fri, 24 Jul 2020 10:15:59 -0400 Received: from proxy17.mail.iad3a.rsapps.net ([172.27.255.58]) by director8.mail.ord1d.rsapps.net with LMTP id EBN6CB/tGl83YQAAfY0hYg (envelope-from ) for ; Fri, 24 Jul 2020 10:15:59 -0400 Received: from smtp13.gate.iad3a ([172.27.255.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy17.mail.iad3a.rsapps.net with LMTP id eOHmAB/tGl/8GgAAR4KW9A ; Fri, 24 Jul 2020 10:15:59 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp13.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 31a97b28-cdb8-11ea-a99a-5254004b83b1-1-1 Received: from [216.105.38.7] ([216.105.38.7:58374] helo=lists.sourceforge.net) by smtp13.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id F6/34-12063-E1DEA1F5; Fri, 24 Jul 2020 10:15:58 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1jyyTg-0007lU-Lc; Fri, 24 Jul 2020 14:15:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyyTf-0007lI-9S for openvpn-devel@lists.sourceforge.net; Fri, 24 Jul 2020 14:15:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Npl2n3UuM3Yl0dwtmF3Q4WPqoUcs/pfjYSrgdWjnAZY=; b=a1k20+bX+iNxZQvoPOCefKpsXt HRRsMuuaFtVtqW1p4wsuthvV5ucXW5Wh9G8gTiUZwPWCdsSoLkVQCG1GnwEKqI6RRdZeFBqIkhgiU BtGn9bFDLGMlTPKNF0uupInPEQ4xVcaz5PIuLr/Z6v5+sTCfDYPS84qg9HO5knFRD09E=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Npl2n3UuM3Yl0dwtmF3Q4WPqoUcs/pfjYSrgdWjnAZY=; b=LF6jCmp7NNG5H/PaWZlibBcLKv BDdZlT/6zQD8HCwkOIlRa6S1mOr65wV/pw0VTgFeFSN01gcI0P1E2dq/mT0Xyi0lqAv34W8rxkJyP PZ6SQjGWJsJbAVIM4K+T1Slc0ZwIzQVsljD2fTd+ZSJI5fgro8ueg7UkNjlQQMKwPOYY=; Received: from mail-wr1-f50.google.com ([209.85.221.50]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1jyyTd-007d1Y-SS for openvpn-devel@lists.sourceforge.net; Fri, 24 Jul 2020 14:15:11 +0000 Received: by mail-wr1-f50.google.com with SMTP id f7so8480437wrw.1 for ; Fri, 24 Jul 2020 07:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Npl2n3UuM3Yl0dwtmF3Q4WPqoUcs/pfjYSrgdWjnAZY=; b=QiYE0j7zTO2Gtz1IkZVaPde3POyNTkBz9PS9KjPI3vcHa9SAmC0zoc/xTwF/tr95aT BgjBwfG8lq4niUtfW6fDMRnSaUPVr6nVL7SSRjyfdOeBrnnx+0B8o2JAESYuQlRNLa8/ dk7b+4hiI9AuEjzRN6H7gmkkztW6emW2mqFs2K60TK1XIwEF63GVECBG4izUGuq1DA4l i3GMNutJST+9Akz2pnmTJkkF+jdV014Tpe3/uRHOgtHSnZYxmMDfXyC5LMhbzdmOuxNn BCyjMYRFg9cG9W0Ljpiik7fB7j5kSNq3u/Ul4feT0qYAPqB4AlR+YE/IwIB4jMuifcz0 i1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Npl2n3UuM3Yl0dwtmF3Q4WPqoUcs/pfjYSrgdWjnAZY=; b=pibQNFAos3Zizy4VxOc67GWu7lfmLB5CRCHgsvfn/yD3oc3suiiFD3L/GBlWxzrgXx 0vI/MuxCK/+T81zZGth15aU7vFDOMdeUro/FdsjQfsTwFPRwHrpLih57vLOmTSyx7MTl crLtYxW9di2bfPzu7QchW399BdwUf0bj+WsnmcvdCFshGnEa4t9EI/jUxwfZTXnFpIRo A0SaA0FHQrGdYWOULZ3bM0kjZW6M8tq0jf5gBIqOqLUwRnD1vyQ8ZgX9cB+Iwy6rFDsF odjbHFh/RbbMQXFPpPOlIo5Cfp59S8ZIex6vXEIRr77walURhmvxHGFh38Q6B4hWOBEa xI1g== X-Gm-Message-State: AOAM530peV87Pg2ksyDhTisl83skBYbxmirPj2AZxnFSsBJ3bY0li0ax v40OoQAvn8IyJCUJHlU3qJ8eXDVa X-Google-Smtp-Source: ABdhPJwHgoLYD2wEyfpJqdBVGJGGbNMbJgNwtENGqWNlZW1fQM+skWLpCh4wq7FXOUyiUXTNfk4mcg== X-Received: by 2002:a05:6000:12c5:: with SMTP id l5mr9568480wrx.219.1595600102910; Fri, 24 Jul 2020 07:15:02 -0700 (PDT) Received: from LAPTOP-4L3N7KFS.localdomain (nat4.panoulu.net. [185.38.2.4]) by smtp.gmail.com with ESMTPSA id z12sm1483505wrp.20.2020.07.24.07.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 07:15:01 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Fri, 24 Jul 2020 17:14:45 +0300 Message-Id: <20200724141445.302-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.50 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.50 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1jyyTd-007d1Y-SS Subject: [Openvpn-devel] [PATCH] Improve Windows version detection with manifest X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lev Stipakov MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov Add manifest file to detect Windows versions greater than Windows 8. Below is an example output on Windows 10. Before: Windows version 6.2 (Windows 8 or greater) 64bit After: Windows version 10.0 (Windows 10 or greater) 64bit Signed-off-by: Lev Stipakov --- src/compat/compat-versionhelpers.h | 6 +++++ src/openvpn/openvpn.manifest | 33 ++++++++++++++++++++++++++ src/openvpn/openvpn.vcxproj | 15 ++++++++++++ src/openvpn/openvpn.vcxproj.filters | 5 ++++ src/openvpn/openvpn_win32_resources.rc | 2 ++ src/openvpn/win32.c | 20 ++++++++++++++-- src/openvpn/win32.h | 8 ++++--- 7 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 src/openvpn/openvpn.manifest diff --git a/src/compat/compat-versionhelpers.h b/src/compat/compat-versionhelpers.h index 251fb047..c8511d0f 100644 --- a/src/compat/compat-versionhelpers.h +++ b/src/compat/compat-versionhelpers.h @@ -95,6 +95,12 @@ IsWindows8Point1OrGreater(void) return IsWindowsVersionOrGreater(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) { diff --git a/src/openvpn/openvpn.manifest b/src/openvpn/openvpn.manifest new file mode 100644 index 00000000..fa5b3d7f --- /dev/null +++ b/src/openvpn/openvpn.manifest @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj index bd1a5844..5367979d 100644 --- a/src/openvpn/openvpn.vcxproj +++ b/src/openvpn/openvpn.vcxproj @@ -70,6 +70,18 @@ <_ProjectFileVersion>10.0.30319.1 + + false + + + false + + + false + + + false + ..\compat;$(TAP_WINDOWS_HOME)/include;$(OPENSSL_HOME)/include;$(LZO_HOME)/include;$(PKCS11H_HOME)/include;%(AdditionalIncludeDirectories) @@ -311,6 +323,9 @@ false + + + diff --git a/src/openvpn/openvpn.vcxproj.filters b/src/openvpn/openvpn.vcxproj.filters index e0bc7d5e..cf5748c7 100644 --- a/src/openvpn/openvpn.vcxproj.filters +++ b/src/openvpn/openvpn.vcxproj.filters @@ -515,4 +515,9 @@ Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/src/openvpn/openvpn_win32_resources.rc b/src/openvpn/openvpn_win32_resources.rc index e4f1ee95..1ea5f878 100644 --- a/src/openvpn/openvpn_win32_resources.rc +++ b/src/openvpn/openvpn_win32_resources.rc @@ -7,6 +7,8 @@ #pragma code_page(65001) /* UTF8 */ +1 RT_MANIFEST "openvpn.manifest" + LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL VS_VERSION_INFO VERSIONINFO diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index eb4c0307..7e913165 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -1417,10 +1417,18 @@ win32_version_info(void) { return WIN_7; } - else + + if (!IsWindows8Point1OrGreater()) { return WIN_8; } + + if (!IsWindows10OrGreater()) + { + return WIN_8_1; + } + + return WIN_10; } bool @@ -1458,7 +1466,15 @@ win32_version_string(struct gc_arena *gc, bool add_name) break; case WIN_8: - buf_printf(&out, "6.2%s", add_name ? " (Windows 8 or greater)" : ""); + buf_printf(&out, "6.2%s", add_name ? " (Windows 8)" : ""); + break; + + case WIN_8_1: + buf_printf(&out, "6.3%s", add_name ? " (Windows 8.1)" : ""); + break; + + case WIN_10: + buf_printf(&out, "10.0%s", add_name ? " (Windows 10 or greater)" : ""); break; default: diff --git a/src/openvpn/win32.h b/src/openvpn/win32.h index 79504776..da85ed4d 100644 --- a/src/openvpn/win32.h +++ b/src/openvpn/win32.h @@ -298,10 +298,12 @@ bool win_wfp_block_dns(const NET_IFINDEX index, const HANDLE msg_channel); bool win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel); -#define WIN_XP 0 +#define WIN_XP 0 #define WIN_VISTA 1 -#define WIN_7 2 -#define WIN_8 3 +#define WIN_7 2 +#define WIN_8 3 +#define WIN_8_1 4 +#define WIN_10 5 int win32_version_info(void);