From nobody Fri Nov 7 01:54:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1545208954805541.5472591020344; Wed, 19 Dec 2018 00:42:34 -0800 (PST) Received: from localhost ([::1]:58308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZXR3-0005eg-0Y for importer@patchew.org; Wed, 19 Dec 2018 03:42:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZXPd-0004pi-1Y for qemu-devel@nongnu.org; Wed, 19 Dec 2018 03:41:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZXPZ-0005Pl-1c for qemu-devel@nongnu.org; Wed, 19 Dec 2018 03:41:04 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34157) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZXPY-0005Om-Og for qemu-devel@nongnu.org; Wed, 19 Dec 2018 03:41:00 -0500 Received: by mail-wr1-x442.google.com with SMTP id j2so18604297wrw.1 for ; Wed, 19 Dec 2018 00:41:00 -0800 (PST) Received: from howl.redhat.com ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id c10sm4415666wrw.49.2018.12.19.00.40.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 00:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rppVPnscum54GUTivxhJITFnSws4o6yAAfSIIaIpC7U=; b=lSouPc2no4+0g7dzpQX3rIX6sUxbN9P6Lg/3hzr4R4TM/6uBMIkWu2OPs7s2jFijLN oTOG5S7mwyI8odrxV+BXK7DqOC725rpsqQlHC8N01xwXbh0Pvcb+wJt0npXleNFWSk/q PkcZyzhWwU51uxjHmR3uxKFXUGeiLK5MllsvGdbMwb/uJRdBOZs7T8wRxVANUWrt0GXj HiPy26e2nlWQ/TlqTCaymNzm5uJ2PmJx5E8WBMPOVURxk7BldyjfCez4IzYSul7WWciL oqNp3CRjtBBaokHaFf7DYrm+IU0zjkISZs4T9MUqAiYngGlJGK7EE2YjFcZEPEKa6WOp rgZg== 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:in-reply-to :references; bh=rppVPnscum54GUTivxhJITFnSws4o6yAAfSIIaIpC7U=; b=jdKwDpHySw6jcEl2uOrmi6wTf49ANoE4H4DcrsOSsdrjYft0IH7ecyipV1zYJHuiwA nF1MNIzeXOFjg/L7oWM561eqYQ6u1FaVV0byNZPyFSa+0/RFnswPkqDKE0ZUEwMp/1sM L+skLeLwUCVU+xG/pHoleM1d5BZB14URd9Ol+AUeogFSLQKUylEuxP365rzLqmPO2TF7 PoQ6Gfo1YytHCgFnMYp4TiEg8wlM/2RKz97QLNN1WMDQZDRYxtzoIhNi6lsBQllWdgu4 ftk080N40V9rlvH/bqIziuIAuiz7VyZqVHudar2qSyDrerbNKLBMpxRzl5/5CHiX+Oiw dEtQ== X-Gm-Message-State: AA+aEWac3+6jrnJHp7B4VwoPpS4z5mN2Vn2kUYIS4sznB7HkB1q0XRdY Y2896X2MWTKkpqt95H20ri6KeeIkqTc= X-Google-Smtp-Source: AFSGD/Vwr+qVYTd8BGw83acjtOavfCiKjFYoxSrK3NSHGOkrhnETabbkLYB0qGjaLVqi7EVoMq9b4A== X-Received: by 2002:a5d:6907:: with SMTP id t7mr17215783wru.226.1545208859343; Wed, 19 Dec 2018 00:40:59 -0800 (PST) From: Bishara AbuHattoum To: , Michael Roth Date: Wed, 19 Dec 2018 10:40:51 +0200 Message-Id: <1545208851-6906-2-git-send-email-bishara@daynix.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1545208851-6906-1-git-send-email-bishara@daynix.com> References: <1545208851-6906-1-git-send-email-bishara@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH] qga-win: Adding support for Windows Server 2019 get-osinfo command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Samee Jubran Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since Windows Server 2016, Microsoft stopped upgrading the major and minor versions of their new Windows Server product, so, the current functionality of checking major and minor version numbers to determine the Windows Server version wont work as expected. The implemented solution here is to use the build number in addition to the major and minor version numbers of the product to determine the Windows Server product version. The final build number of Windows Server 2016 is 14939, and the final build number of Windows Server 2019 is 17764, so any Windows Server product that has the major version of 10 and minor version of 0 with a build number lower or equal to 14939 will resemble 2016 and if the build number is lower or equal to 17763 will resemble 2019. Reference: https://techcommunity.microsoft.com/t5/Windows-Server-Insiders/Windows-Serv= er-2019-version-info/m-p/293112/highlight/true#M859 Signed-off-by: Bishara AbuHattoum --- qga/commands-win32.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 62e1b51..3985b40 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -2009,12 +2009,24 @@ static ga_matrix_lookup_t const WIN_VERSION_MATRIX[= 2][8] =3D { { 6, 1, "Microsoft Windows Server 2008 R2", "2008r2"}, { 6, 2, "Microsoft Windows Server 2012", "2012"}, { 6, 3, "Microsoft Windows Server 2012 R2", "2012r2"}, - {10, 0, "Microsoft Windows Server 2016", "2016"}, + { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0} } }; =20 +typedef struct _ga_win_10_0_server_t { + int final_build; + char const *version; + char const *version_id; +} ga_win_10_0_server_t; + +static ga_win_10_0_server_t const WIN_10_0_SERVER_VERSION_MATRIX[3] =3D { + {14393, "Microsoft Windows Server 2016", "2016"}, + {17763, "Microsoft Windows Server 2019", "2019"}, + {0, 0} +}; + static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp) { typedef NTSTATUS(WINAPI * rtl_get_version_t)( @@ -2039,10 +2051,23 @@ static char *ga_get_win_name(OSVERSIONINFOEXW const= *os_version, bool id) { DWORD major =3D os_version->dwMajorVersion; DWORD minor =3D os_version->dwMinorVersion; + DWORD build =3D os_version->dwBuildNumber; int tbl_idx =3D (os_version->wProductType !=3D VER_NT_WORKSTATION); ga_matrix_lookup_t const *table =3D WIN_VERSION_MATRIX[tbl_idx]; + ga_win_10_0_server_t const *win_10_0_table =3D WIN_10_0_SERVER_VERSION= _MATRIX; while (table->version !=3D NULL) { - if (major =3D=3D table->major && minor =3D=3D table->minor) { + if (major =3D=3D 10 && minor =3D=3D 0 && tbl_idx) { + while (win_10_0_table->version !=3D NULL) { + if (build <=3D win_10_0_table->final_build) { + if (id) { + return g_strdup(win_10_0_table->version_id); + } else { + return g_strdup(win_10_0_table->version); + } + } + win_10_0_table++; + } + } else if (major =3D=3D table->major && minor =3D=3D table->minor)= { if (id) { return g_strdup(table->version_id); } else { --=20 1.8.3.1