From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.76077.1597785095914859579 for ; Tue, 18 Aug 2020 14:11:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=bu8/TyRk; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: 8PUdATYpgB7d4PrwC4Ebkgli7rKop8cKVGHjkeILzNKeaPBWPdhlFXLoShglDw3xCcsaMlTzDB mnqFTThVpv5g== X-IronPort-AV: E=McAfee;i="6000,8403,9717"; a="135074578" X-IronPort-AV: E=Sophos;i="5.76,328,1592895600"; d="scan'208";a="135074578" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 14:11:35 -0700 IronPort-SDR: N0Lz/xcf2h+qPyqJDy5jk1nSH2mHRCpvV5lCgv44mA2nEDNpUD5J0K7ccYRgs2/GW+P1BFxBwb s1nga58ZeXJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,328,1592895600"; d="scan'208";a="441363004" Received: from fmsmsx602-2.cps.intel.com (HELO fmsmsx602.amr.corp.intel.com) ([10.18.84.212]) by orsmga004.jf.intel.com with ESMTP; 18 Aug 2020 14:11:34 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 18 Aug 2020 14:11:34 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 18 Aug 2020 14:11:34 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Aug 2020 14:11:34 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Aug 2020 14:11:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZVVyCmVyeTZIn2p+w+/OzgQv01p8M47/xDQyE925CHdI7qPTUU96pbCeR8ca+zkPxkTVXK4250N5YO2uEsIWJAjuNLLvOaRLcYKW3rDTKgVn8/cI9FncLul4tHRMhykq47ejqyX4ZW7mYC6EcHBmr40cNxNkWVMefmFR2X/N/nTXtLjHyYK15pmcbDFE8tD8OXTwrPGB7phlGSOnny+pDZ9XKG1oWG2D5PeosRwaevgSPIbR4/yCZHSdgpaV0EnIOW9QHS1GOeTChvdSGcRGYdoxxHJ+AIn6zbZT5hT7+FAHF12u35YWxXasO5c+dJ+n5lw8G9AzsxglcF5qmNBCtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6+be1S/3gcr4r2LU8X/PWiWxLozRcVyEruHcwyxhvTw=; b=Zn1JdVP4wNoJw2Xpq57sPaaRozHATxcUoxXYheyEPSBCKiA0K4xYEU/o2h7OkByOjL8WHQfvWaYfhrCzuJk0hrVRAHJ9noaRSLhqAXfALdrU2RuX3dIU2JKRu0SbXgMpVDmGkTa0/gjOtQbWxiKnA94foi2x+pfQ7NxVURXXvXgn+uZJapiOZSxRZteDROh+4Z3MTUvE2RQuO2SPVVUptRCJxM7P0OaF7CyBPQPFFdA95fsyh038tTarY0LHby58PVS2MMiunccHVUVbur0ft6dGdQvosZaUibv7XBRoF5todZGliRvDpbWWXZCt/8B+bBG0G/eptp7RA0jZZ1A2Cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6+be1S/3gcr4r2LU8X/PWiWxLozRcVyEruHcwyxhvTw=; b=bu8/TyRk0xUMv9LVqou4qI6qzpFHGBniuzY17U4mvz0ues6cJMX8a8IdAe33HdkIhE03pD9UvMqleIWe6ozgWy2ZBYTc5WcRDzCHvSMYxEQOh7PRITh/btC9wSs1104tBvQnMVdRIpX9L5HEbPnHwRZys+mUav1MaJcNJyNiYyI= Received: from BY5PR11MB3973.namprd11.prod.outlook.com (2603:10b6:a03:185::29) by BYAPR11MB3671.namprd11.prod.outlook.com (2603:10b6:a03:b3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.20; Tue, 18 Aug 2020 21:11:32 +0000 Received: from BY5PR11MB3973.namprd11.prod.outlook.com ([fe80::f586:b5a8:4b3d:1e76]) by BY5PR11MB3973.namprd11.prod.outlook.com ([fe80::f586:b5a8:4b3d:1e76%5]) with mapi id 15.20.3283.028; Tue, 18 Aug 2020 21:11:32 +0000 From: "Ashley E Desimone" To: "Desimone, Nathaniel L" , "devel@edk2.groups.io" CC: "Pandya, Puja" , Bret Barkelew , "Agyeman, Prince" , "Bjorge, Erik C" Subject: Re: [edk2-staging/EdkRepo] [PATCH V1 1/2] EdkRepo: Add function to enumerate subst drives Thread-Topic: [edk2-staging/EdkRepo] [PATCH V1 1/2] EdkRepo: Add function to enumerate subst drives Thread-Index: AQHWa7T9dvX5TZrkIUm8I9yh1uHAVak+cJbw Date: Tue, 18 Aug 2020 21:11:32 +0000 Message-ID: References: <20200806054635.4809-1-nathaniel.l.desimone@intel.com> <20200806054635.4809-2-nathaniel.l.desimone@intel.com> In-Reply-To: <20200806054635.4809-2-nathaniel.l.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [50.53.190.176] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1036976e-4be8-4ff2-974f-08d843bb4878 x-ms-traffictypediagnostic: BYAPR11MB3671: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oyKf13/YL1JOZROz9+/Gy3K1qAKmid2dXrYG4Dz2p6MrTBZF8SL6OsZebD+d8qpZSNUADwWSedosLeOudEKQ78/W1/MER64dKNll/juQ0JblPHelrkjKSquiT/rwWbzCW0gWEsZe+ahZsH7lq/yCOnKQdnddBcPjElbP7RlYIG0++VgZh1aFEixV0c3fTncAcDXAsJKu2uClmGFZbjK4VuSIVsjC0xQiYADL/RNDkiAEclLhi4Kqb5IoUkYI/ZGBb8LjXLC7xHEOlBN54bYPPcG7e70vQiSJ9ZyfmrkTbyeEKU8r80IYl9Ndr3ENlF6w x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB3973.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(136003)(366004)(396003)(346002)(66446008)(64756008)(66556008)(76116006)(86362001)(33656002)(66476007)(66946007)(26005)(478600001)(4326008)(52536014)(83380400001)(110136005)(316002)(6506007)(53546011)(54906003)(8936002)(107886003)(186003)(19627235002)(8676002)(7696005)(9686003)(5660300002)(55016002)(71200400001)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Q5AKBsVhbGKEIziwjJrmZ9QdhvvFKXyMqFXLz19v5OudaRoqu01UNBCmrIZdHnKh+GlS7uC/vke8ak5QnPU4tjwmIOF8ftuS6s3pGEMZnK+4LhsSVEUB2Ouu4xPSdF/mG8X5X9ECFJ4nRB3CgQq7siNgrzzSIFhNyOk/SbC0/FXTq8PNDCJlAyjAvBjv3NKy/Khp8oqeIc6m41z3qCY8/CmZX6Imr58fOfQ4125vkOE6nmziyZx84IAIPdqdoKKLeZgJUk3aZVKS06fH7gq5mJ72jUp8uByqcsbjC9RpgB520aR9Squy3Z0XJeAdR7VII4MfzK+wbRRXYmehIbRAJ+NgOMh7NP43yFLBQWeBwJpvtpVnwmtlZ+BE7TDklygADwmdcYzZF8yX5cTn7TJRYUMjs25d9U9vFxNZF4LER4R5mgaV+sIZ/qQ+SQ1YTY66GLdD2C/hMcEVnXgx5KtdQgF+YINwjKSPYrCd/AYlysgoNkftjDWBsG9/zApphqqFNI1zhN1+BOxbVq3FEkeeDZKETsz0ywUo9Tm4yeYyjV4s2YQ0S4lhJNd4/PPxRz3ak2gFGwxG+9pgzypRDCgEdUFkh7IMvrfmxsN/wk9+L+WOdbGBRUBtuU4969l3qyiPB5QhEDnReJvsSALf5gQWkw== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB3973.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1036976e-4be8-4ff2-974f-08d843bb4878 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Aug 2020 21:11:32.5084 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WIzEIVuZT8IT3NXXupEyXfpyH46a1lXRjwntsBTDRwelq1O7grKq7bbTqTvFofhYrJRZnREOFJ6gEbUlORqi0A/BAqYBi/959gHQY8DEE4E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3671 Return-Path: ashley.e.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Nate, Since get_subst_drive_list() returns a dict I would prefer that we change t= he name of the function to reflect that. Thanks, Ashley=20 -----Original Message----- From: Desimone, Nathaniel L =20 Sent: Wednesday, August 5, 2020 10:47 PM To: devel@edk2.groups.io Cc: Desimone, Ashley E ; Pandya, Puja ; Bret Barkelew ; Agyeman, Prin= ce ; Bjorge, Erik C Subject: [edk2-staging/EdkRepo] [PATCH V1 1/2] EdkRepo: Add function to enu= merate subst drives Cc: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman Cc: Erik Bjorge Signed-off-by: Nate DeSimone --- edkrepo/common/pathfix.py | 50 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/edkrepo/common/pathfix.py b/edkrepo/common/pathfix.py index 1a= 9c20f..69ed1a4 100644 --- a/edkrepo/common/pathfix.py +++ b/edkrepo/common/pathfix.py @@ -3,7 +3,7 @@ ## @file # checkout_command.py # -# Copyright (c) 2018- 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2020, Intel Corporation. All rights=20 +reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # import os @@ -11,6 +11,= 7 @@ import sys if sys.platform =3D=3D "win32": from ctypes import windll, POINTER, byref, GetLastError, Structure, Wi= nError from ctypes import c_void_p, c_ushort, c_int, c_ulong, c_wchar, c_wch= ar_p + from ctypes import create_unicode_buffer =20 def _is_wow64_process(): kernel32 =3D windll.kernel32 @@ -211,3 +212,50 @@ def expanduser(path): userhome =3D os.path.join(os.path.dirname(userhome), path[1:i]) =20 return userhome + path[i:] + +def get_subst_drive_list(): + if sys.platform !=3D "win32": + return {} + def _query_subst_drive(drive_letter): + kernel32 =3D windll.kernel32 + QueryDosDevice =3D kernel32.QueryDosDeviceW + QueryDosDevice.argtypes =3D [c_wchar_p, c_wchar_p, c_ulong] + QueryDosDevice.restype =3D c_ulong + MAX_PATH =3D 260 + + if len(drive_letter) > 1 or len(drive_letter) =3D=3D 0: + raise ValueError("Bad drive letter") + drive =3D '{}:'.format(drive_letter.upper()) + drive_buffer =3D create_unicode_buffer(drive) + target_path_buffer_size =3D c_ulong(MAX_PATH) + target_path_buffer =3D create_unicode_buffer(target_path_buffer_si= ze.value) + while True: + count =3D QueryDosDevice(drive_buffer, target_path_buffer, tar= get_path_buffer_size) + if count =3D=3D 0: + last_error =3D GetLastError() + if last_error =3D=3D 122: #ERROR_INSUFFICIENT_BUFFER + #Increase the buffer size and try again + target_path_buffer_size =3D c_ulong((target_path_buffe= r_size.value * 161) / 100) + target_path_buffer =3D create_unicode_buffer(target_pa= th_buffer_size.value) + elif last_error =3D=3D 2: #ERROR_FILE_NOT_FOUND + #This is an invalid drive, return an empty string + return '' + else: + raise WinError(last_error) + else: + break + target_path =3D target_path_buffer.value + if len(target_path) > 4 and target_path[0:4] =3D=3D '\\??\\': + if (ord(target_path[4]) >=3D ord('A') and ord(target_path[4]) = <=3D ord('Z')) or \ + (ord(target_path[4]) >=3D ord('a') and ord(target_path[4])= <=3D ord('z')): + #This is a SUBST'd drive, return the path + return target_path[4:].strip() + #This is a non-SUBST'd (aka real) drive, return an empty string + return '' + subst_dict =3D {} + for index in range(26): + drive_letter =3D chr(ord('A') + index) + target_path =3D _query_subst_drive(drive_letter) + if target_path !=3D '': + subst_dict[drive_letter] =3D target_path + return subst_dict -- 2.27.0.windows.1