summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/utils.cpp
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2016-01-08 23:40:39 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2016-01-17 18:47:51 +0100
commit0992092a0f3e120ec3fdf911a808cfe8ef93b877 (patch)
treecec3b63fd445fbbe2a828918ab75c157fe645ced /rbutil/rbutilqt/base/utils.cpp
parent2ae94318c634a98bac508fb93708f0a838128e10 (diff)
downloadrockbox-0992092a0f3e120ec3fdf911a808cfe8ef93b877.tar.gz
rockbox-0992092a0f3e120ec3fdf911a808cfe8ef93b877.tar.bz2
rockbox-0992092a0f3e120ec3fdf911a808cfe8ef93b877.zip
rbutil: fix resolveDevicename() on Windows
Solves some eject issues (FSCTL_LOCK_VOLUMEN ioctl failures) ocurring when resolveDevicename() is ejecuted prior to ejectDevice(), tested with Qt5. Change-Id: Iff9240abd9d2f71bec1a1070f4ef194916e13b65
Diffstat (limited to 'rbutil/rbutilqt/base/utils.cpp')
-rw-r--r--rbutil/rbutilqt/base/utils.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 724a1553f1..6bd9e23230 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -502,13 +502,14 @@ QString Utils::resolveDevicename(QString path)
// get the extents
if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
NULL, 0, extents, sizeof(buffer), &written, NULL)) {
- if(extents->NumberOfDiskExtents > 1) {
- LOG_INFO() << "resolving device name: volume spans multiple disks!";
- return "";
+ if(extents->NumberOfDiskExtents == 1) {
+ CloseHandle(h);
+ LOG_INFO() << "device name is" << extents->Extents[0].DiskNumber;
+ return QString("%1").arg(extents->Extents[0].DiskNumber);
}
- LOG_INFO() << "device name is" << extents->Extents[0].DiskNumber;
- return QString("%1").arg(extents->Extents[0].DiskNumber);
+ LOG_INFO() << "resolving device name: volume spans multiple disks!";
}
+ CloseHandle(h);
#endif
return QString("");