forked from len0rd/rockbox
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
This commit is contained in:
parent
2ae94318c6
commit
0992092a0f
1 changed files with 6 additions and 5 deletions
|
@ -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() << "resolving device name: volume spans multiple disks!";
|
||||
}
|
||||
CloseHandle(h);
|
||||
#endif
|
||||
return QString("");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue