From 9833a753ddab074654e6002332a6605bce29b13e Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 9 Jul 2017 09:45:50 +0200 Subject: Windows: when listing connected devices, consider that a partition exists if CreateFile returns ERROR_ACCESS_DENIED --- src/Common/Dlgcode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Common') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 8ea025e5..702ba4e9 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -12106,10 +12106,11 @@ void UpdateMountableHostDeviceList () OPEN_EXISTING, 0, NULL ); - if (handle != INVALID_HANDLE_VALUE) + if ((handle != INVALID_HANDLE_VALUE) || (GetLastError () == ERROR_ACCESS_DENIED)) { AddDeviceToList (mountableDevices, It->SystemNumber, layout->PartitionEntry[i].PartitionNumber); - CloseHandle (handle); + if (handle != INVALID_HANDLE_VALUE) + CloseHandle (handle); } } } -- cgit v1.2.3