From 0c9a87b8a2fe977ea0082da05e5d0ef02196320a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 5 May 2021 11:25:30 +0200 Subject: [PATCH] api: skip requested GUID if !win10 Signed-off-by: Jason A. Donenfeld --- api/adapter.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/api/adapter.c b/api/adapter.c index a85d17b..ba4467c 100644 --- a/api/adapter.c +++ b/api/adapter.c @@ -898,15 +898,19 @@ _Return_type_success_(return != INVALID_HANDLE_VALUE) HANDLE WINAPI return OpenDeviceObject(Adapter->DevInstanceID); } +static BOOL +IsWindows10(void) +{ + DWORD MajorVersion; + RtlGetNtVersionNumbers(&MajorVersion, NULL, NULL); + return MajorVersion >= 10; +} + static BOOL HaveWHQL(void) { if (HAVE_WHQL) - { - DWORD MajorVersion; - RtlGetNtVersionNumbers(&MajorVersion, NULL, NULL); - return MajorVersion >= 10; - } + return IsWindows10(); return FALSE; } @@ -1418,6 +1422,9 @@ static _Return_type_success_(return != NULL) WINTUN_ADAPTER *CreateAdapter( { LOG(WINTUN_LOG_INFO, L"Creating adapter"); + if (!IsWindows10()) + RequestedGUID = NULL; + if (RequestedGUID) { WCHAR RegPath[MAX_REG_PATH];