コード例 #1
0
ファイル: qdriveinfo_win.cpp プロジェクト: ABBAPOH/libs
QDriveInfo QDriveInfoPrivate::rootDrive()
{
    DWORD dwBufferSize = 128;
    QVarLengthArray<wchar_t, 128> profilesDirectory(dwBufferSize);
    bool ok;
    do {
        if (dwBufferSize > (DWORD)profilesDirectory.size())
            profilesDirectory.resize(dwBufferSize);
        ok = ::GetProfilesDirectory(profilesDirectory.data(), &dwBufferSize);
    } while (!ok && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
    if (ok)
        return QDriveInfo(QString::fromWCharArray(profilesDirectory.data(), profilesDirectory.size()));

    return QDriveInfo();
}
コード例 #2
0
                    foreach (const QString &drive, drives) {
#ifdef QDRIVECONTROLLER_DEBUG
                        if (db_volume->dbcv_flags & DBTF_MEDIA)
                            qWarning("Drive %c: Media has been removed.", drive.at(0).toLatin1());
                        else if (db_volume->dbcv_flags & DBTF_NET)
                            qWarning("Drive %c: Network share has been unmounted.", drive.at(0).toLatin1());
                        else
                            qWarning("Drive %c: Device has been removed.", drive.at(0).toLatin1());
#endif
                        watcher->emitDriveRemoved(drive);
                        // fix for unmounting virtual drive using Daemon tools
                        if (QDriveInfo(drive).type() == QDriveInfo::CdromDrive) {
                            watcher->emitDriveAdded(drive);
                        }
                    }