Know how fast a Hard Drive is in Delphi

送分小仙女□ 提交于 2019-11-30 07:21:11

Rafael to obtain the S.M.A.R.T data you can use the WMI or the Windows API.

using the WMI

the WMI classes to obtain S.M.A.R.T data are

  • MSStorageDriver_ATAPISmartData
  • MSStorageDriver_FailurePredictData
  • MSStorageDriver_FailurePredictStatus
  • MSStorageDriver_FailurePredictThresholds
  • MSStorageDriver_ScsiInfoExceptions

All are located in the root\WMI namespace. unfortunately these classes are not very well documented.

using the WINAPI

To access the S.M.A.R.T data from the Windows API requires a little more of work, you must use the DeviceIoControl and CreateFile functions passing the respective structures to holding the data. you can find many sample of this on the net.

To calculate the speed of a Hard Disk

there is not a Windows api which expose directly this information. so you must calculate this your self. for an example you can check this application DISKSPEED which include the source code in C++. they uses the CreateFile function setting the FILE_FLAG_NO_BUFFERING ($20000000) flag, to make which any writes and read made to the file handle be done directly without being buffered.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!