April 28th, 2011, 02:15 AM
Get Rotation Speed of Disk Sample Code
Hi all! Im not really good at VC++ but does anyone have a sample code to get the rotation speed of disk in a computer. I have been working on detecting SSD drives and one solution from researching all day was to get the rotation speed and since SSD have 0 rpm this might be the only way to detect SSD drive.
April 28th, 2011, 04:17 PM
Re: Get Rotation Speed of Disk Sample Code
I don't know the answer, but I suspect that it is likely to be OS-specific.
For Windows, I would start looking at the DeviceIoControl function, which can retrieve pertinent information from the driver for the device. Perhaps there is something in there that would allow you to differentiate between an SSD and a HDD.
As one possible example, I notice that the DeviceIoControl function has a IOCTL_STORAGE_QUERY_PROPERTY Control Code, and that one of the PropertyId values is DEVICE_SEEK_PENALTY_DESCRIPTOR. If that returns a FALSE value, then it's probable that the device is a SSD device and not a HDD.
One article that mentions this technique is "Windows 7 Disk Defragmenter User Interface Overview", at http://blogs.technet.com/b/filecab/a...-overview.aspx . The article is very slow to load. However, it also mentions some backup ideas in case DEVICE_SEEK_PENALTY_DESCRIPTOR fails. One of those backup ideas involves something called "NominalMediaRotationRate", but I have not been able to find any information on this topic other than a MS reference page: "IDENTIFY_DEVICE_DATA Structure" at http://msdn.microsoft.com/en-us/library/ff559006.aspx
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!