mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-17 17:12:39 -05:00
Add w32 mountpoint resolving based on disc number correctly this time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17873 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6f6fcfc3a8
commit
788d01ef7f
3 changed files with 44 additions and 53 deletions
|
|
@ -99,41 +99,3 @@ QString resolvePathCase(QString path)
|
|||
return realpath;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
QString getMountpointByDevice(int drive)
|
||||
{
|
||||
QString result;
|
||||
for(int letter = 'A'; letter <= 'Z'; letter++) {
|
||||
DWORD written;
|
||||
HANDLE h;
|
||||
TCHAR uncpath[MAX_PATH];
|
||||
UCHAR buffer[0x400];
|
||||
PVOLUME_DISK_EXTENTS extents = (PVOLUME_DISK_EXTENTS)buffer;
|
||||
|
||||
_stprintf(uncpath, _TEXT("\\\\.\\%c:"), letter);
|
||||
h = CreateFile(uncpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if(h == INVALID_HANDLE_VALUE) {
|
||||
qDebug() << "error getting extents for" << uncpath;
|
||||
continue;
|
||||
}
|
||||
// get the extents
|
||||
if(DeviceIoControl(h, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
|
||||
NULL, 0, extents, sizeof(buffer), &written, NULL)) {
|
||||
for(int a = 0; a < extents->NumberOfDiskExtents; a++) {
|
||||
qDebug() << "Disk:" << extents->Extents[a].DiskNumber;
|
||||
if(extents->Extents[a].DiskNumber == drive) {
|
||||
result = letter;
|
||||
qDebug("found: %c", letter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue