From nobody Tue Nov 4 15:25:56 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 1530026036139539.0103478972859; Tue, 26 Jun 2018 08:13:56 -0700 (PDT) Received: from localhost ([::1]:53273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXpfH-0005ud-G5 for importer@patchew.org; Tue, 26 Jun 2018 11:13:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXpcK-0003lO-6t for qemu-devel@nongnu.org; Tue, 26 Jun 2018 11:10:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXpcJ-0008A9-A6 for qemu-devel@nongnu.org; Tue, 26 Jun 2018 11:10:52 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:54820) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXpcJ-00089r-3U for qemu-devel@nongnu.org; Tue, 26 Jun 2018 11:10:51 -0400 Received: by mail-wm0-x244.google.com with SMTP id i139-v6so2365573wmf.4 for ; Tue, 26 Jun 2018 08:10:51 -0700 (PDT) Received: from bark.daynix ([141.226.163.173]) by smtp.gmail.com with ESMTPSA id w15-v6sm2503195wrn.25.2018.06.26.08.10.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 08:10:49 -0700 (PDT) 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:list-id; bh=/O4gma0E9dqpQ1h1/RSYqN4OIOlPX6c9jt2SLCqU6Vw=; b=MEWBdFYa3WqSC1KCwDVl+6YD7xr0O9QyvgzcY/STi1KOTM7Zh+2MszGYrPKDzYsy7d D4O1Ts1VM51ISzWR7Lccnpeyum/g0qGrN0mISxeaJMAQFHPvVKAcLEmhXXchTxmNhU69 0hFCKZTmwRNBEAnkDSz28q0hUWtYk5fHn52w6Bm8MGrro+c1c+n3Oip2EIjKT+2oovQo EYSRyGTULVBKHY+0KqA/H2RbF5751IyK6CLaH9t7D7C6xPqszKzLhEABnZpH4zak0IVZ 0/9W7ZWL8mLtpAa5SolETHJ3yXSOc2NVKJrNoy9AUjpuG2Qff5yopWbqc3ca/Ro+SEq6 8C4A== 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:list-id; bh=/O4gma0E9dqpQ1h1/RSYqN4OIOlPX6c9jt2SLCqU6Vw=; b=ZkaxhZwF9YZ9Mifnr9FwxJ9zlkapCeiEZt5P/Y0YXIK1u5PZsm5dA6rhcIhR8vflgP VyKSlYNrNoBkZNvd1+L8EqrRqJBSR9MSpjuW6SyhpZJYJBuddGLtdVtJ54uBD/3CxzOw FOqfuJNSMlA6Mq4nOe2ivISdytwwzSoR+3Kn0zTh23VMDqn4VdxexuvsaQOPz0as4Lvz X7zqjejiblcgx8WWoLcZ0ZLKskao57T86YLtte4asb6ghywhSfsCkwkWBYIwlqs4e+m4 lu1f06OoPCgeryIyhwVc0+VJt9W6EdtHWH/NpQi4JOiKp78FG13yjlbJ+RUXdW3PQ3oe olQg== X-Gm-Message-State: APt69E3F2em1Ayyrz2ojVKHT2g4AJV8I8cgZNtqyDjMYDbX8MG0vKgoo bJjYNpD94G+gKwmYW4pbN5a1xMRl X-Google-Smtp-Source: AAOMgpdthXbKDLeqZWde+o53DW3xotUiSfKiD6LWviaIocef/uFpOql52Rx0YXrfxw15w8SMXyhuvw== X-Received: by 2002:a1c:1695:: with SMTP id 143-v6mr1941343wmw.12.1530025849975; Tue, 26 Jun 2018 08:10:49 -0700 (PDT) From: Sameeh Jubran To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 18:10:38 +0300 Message-Id: <20180626151038.24771-3-sameeh@daynix.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180626151038.24771-1-sameeh@daynix.com> References: <20180626151038.24771-1-sameeh@daynix.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH 2/2] qga-win: fsinfo: pci-info: allow partial info 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 , Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sameeh Jubran The call to SetupDiGetDeviceRegistryProperty might fail because the value doesn't exist in the registry, in this case we shouldn't exit from the loop but instead continue to look for other available values in the registry and set this value as unavailable (-1). Signed-off-by: Sameeh Jubran --- qga/commands-win32.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index c5f1c884e1..55e460dee3 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -505,7 +505,8 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) =20 dev_info_data.cbSize =3D sizeof(SP_DEVINFO_DATA); for (i =3D 0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++)= { - DWORD addr, bus, slot, func, dev, data, size2; + DWORD addr, bus, slot, data, size2; + int func, dev; while (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_PHYSICAL_DEVICE_OBJECT_N= AME, &data, (PBYTE)buffer, size, @@ -535,21 +536,21 @@ static GuestPCIAddress *get_pci_info(char *guid, Erro= r **errp) */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_BUSNUMBER, &data, (PBYTE)&bus, size, NULL)) { - break; + bus =3D -1; } =20 /* The function retrieves the device's address. This value will be * transformed into device function and number */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_ADDRESS, &data, (PBYTE)&addr, size, NULL)) { - break; + addr =3D -1; } =20 /* This call returns UINumber of DEVICE_CAPABILITIES structure. * This number is typically a user-perceived slot number. */ if (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_UI_NUMBER, &data, (PBYTE)&slot, size, NULL)) { - break; + slot =3D -1; } =20 /* SetupApi gives us the same information as driver with @@ -559,12 +560,12 @@ static GuestPCIAddress *get_pci_info(char *guid, Erro= r **errp) * DeviceNumber =3D (USHORT)(((propertyAddress) >> 16) & 0x0000FFF= F); * SPDRP_ADDRESS is propertyAddress, so we do the same.*/ =20 - func =3D addr & 0x0000FFFF; - dev =3D (addr >> 16) & 0x0000FFFF; + func =3D ((int) addr =3D=3D -1) ? -1 : addr & 0x0000FFFF; + dev =3D ((int) addr =3D=3D -1) ? -1 : (addr >> 16) & 0x0000FFFF; pci->domain =3D dev; - pci->slot =3D slot; + pci->slot =3D (int) slot; pci->function =3D func; - pci->bus =3D bus; + pci->bus =3D (int) bus; break; } =20 --=20 2.13.6