Question

I'm trying to get system information in a QT project, I want to know the hard disk partition in Windows and the different properties of each partition.

Here is my code:

QString drivename=QString(FileInfo.absolutePath().at(0))+":\\\\";
    ULARGE_INTEGER freeBytesToCaller;
    ULARGE_INTEGER TotalBytes;
    ULARGE_INTEGER FreeBytes;
    freeBytesToCaller.QuadPart = 0L;
    TotalBytes.QuadPart = 0L;
    FreeBytes.QuadPart = 0L;

    if( !GetDiskFreeSpaceEx( drivename.toStdWString().c_str(), &freeBytesToCaller,&TotalBytes,&FreeBytes ) )
    {
        qDebug() <<drivename<< "ERROR: Call to GetDiskFreeSpaceEx() failed.";

    }
   // qDebug()<<"drive type of "<<drivename<<"  "<<GetDriveTypeW(drivename.toStdWString().c_str());
     int TotalBytes_gb = TotalBytes.QuadPart/(1024*1024*1024) ;

It lets me know the partition name (eg. C:\) the size and type but what I want also is to get information about the partition (\Device\Harddisk0\Partition1 C:\ 232GB)

How can I get the information about the partition?

Was it helpful?

Solution

I find a solution that I think is more helpful Displaying Volume Paths

thank you all any way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top