From nobody Wed May 8 06:01:31 2024 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@gnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506676362666943.1729463233079; Fri, 29 Sep 2017 02:12:42 -0700 (PDT) Received: from localhost ([::1]:34279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxrLZ-0002xb-0c for importer@patchew.org; Fri, 29 Sep 2017 05:12:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxrKf-0002aD-TR for qemu-devel@nongnu.org; Fri, 29 Sep 2017 05:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxrKb-00015b-TW for qemu-devel@nongnu.org; Fri, 29 Sep 2017 05:11:41 -0400 Received: from m15-114.126.com ([220.181.15.114]:37094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxrKb-00013I-2w for qemu-devel@nongnu.org; Fri, 29 Sep 2017 05:11:37 -0400 Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp7 (Coremail) with SMTP id DsmowAAXvoo6Ds5ZcgE_AA--.22306S2; Fri, 29 Sep 2017 17:11:27 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=49He/EEMAJ3hU/QHqN /AkdH0CHBIHL7k23SLrAYRCpQ=; b=ExL0+MjLhZ2CeyinloC3Fz64tl7RN+Rs4V W0mzuGsWMq8Th2aqqJ6b5pkslhhnuON/Vrh7MDp0HWsnBP8du3Sk4d/hzYkmIXYn HoEVsjcDsaz9NH4w/S3+nb7njiZzZ95ZQOmWY0NIAytzVqR7GNhWUlTrWw0HjV/2 fknkVVooI= From: Chen Hanxiao To: mdroth@linux.vnet.ibm.com Date: Fri, 29 Sep 2017 17:11:22 +0800 Message-Id: <20170929091122.22726-1-chen_han_xiao@126.com> X-Mailer: git-send-email 2.13.5 X-CM-TRANSID: DsmowAAXvoo6Ds5ZcgE_AA--.22306S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tw1xuF47tFyfAw17ZrWrZrb_yoW8WF13pF 4Sk397Ka95trW8trsFqrWftr1akFZ2gw4DC3ykJa47uF13Jr40gwsak34kWr17Gw4Ykr95 ZFW09FZ7CF4Yy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jUZ2-UUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiaAdirlQ9DkwTKQABsz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.15.114 Subject: [Qemu-devel] [PATCH] qga-win: fall back to hardcoded user and group names if LookupAccountSidW failed X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Chen Hanxiao Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @126.com) X-ZohoMail: RDKM_0 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao On some of windows (win08 sp2), it doesn't work by calling LookupAccountSidW with well-known SIDs, We got an error: error 997 overlapped I/O operation is in progress But hardcoded names work. This patch introduces a workaroud for this issue: if LookupAccountSidW failed, try hardcoded one. Signed-off-by: Chen Hanxiao Reviewed-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD --- qga/vss-win32/install.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index ba7c94eb25..dcf6299af9 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -312,7 +312,10 @@ STDAPI COMRegister(void) =20 /* Setup roles of the applicaion */ =20 - chk(getNameByStringSID(administratorsGroupSID, buffer, &bufferLen)); + hr =3D getNameByStringSID(administratorsGroupSID, buffer, &bufferLen); + if (FAILED(hr)) { + wsprintfW(buffer, L"%ls", L"Administrators"); + } chk(pApps->GetCollection(_bstr_t(L"Roles"), key, (IDispatch **)pRoles.replace())); chk(pRoles->Populate()); @@ -333,7 +336,10 @@ STDAPI COMRegister(void) chk(put_Value(pObj, L"User", _bstr_t(".\\") + name)); =20 bufferLen =3D BUFFER_SIZE; - chk(getNameByStringSID(systemUserSID, buffer, &bufferLen)); + hr =3D getNameByStringSID(systemUserSID, buffer, &bufferLen); + if (FAILED(hr)) { + wsprintfW(buffer, L"%ls", L"SYSTEM"); + } chk(pUsersInRole->Add((IDispatch **)pObj.replace())); chk(put_Value(pObj, L"User", buffer)); chk(pUsersInRole->SaveChanges(&n)); --=20 2.13.5