CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011
    Posts
    3

    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.

  2. #2
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    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

    Mike

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured