hd获取硬盘序列号_如何获取硬盘序列号

'============================================

'模块功能:取得硬盘的信息

'编    程:来自互联网,阿勇修改

'更新日期:2005/7/8

'调用方法:

'   GetDiskVolume() 取得逻辑盘的序列号

'   GetHardDiskInfo() 取得物理盘的型号或序列号

'============================================

Private Const MAX_IDE_DRIVES As Long = 4   ' Max number of drives assuming primary/secondary, master/slave topology

Private Const READ_ATTRIBUTE_BUFFER_SIZE As Long = 512

Private Const IDENTIFY_BUFFER_SIZE As Long = 512

Private Const READ_THRESHOLD_BUFFER_SIZE As Long = 512

Private Const DFP_GET_VERSION As Long = &H74080

Private Const DFP_SEND_DRIVE_COMMAND As Long = &H7C084

Private Const DFP_RECEIVE_DRIVE_DATA As Long = &H7C088

Private Type GETVERSIONOUTPARAMS

bVersion As Byte       ' Binary driver version.

bRevision As Byte      ' Binary driver revision.

bReserved As Byte      ' Not used.

bIDEDeviceMap As Byte  ' Bit map of IDE devices.

fCapabilities As Long  ' Bit mask of driver capabilities.

dwReserved(3) As Long  ' For future use.

End Type

Private Const CAP_IDE_ID_FUNCTION As Long = 1               ' ATA ID command supported

Private Const CAP_IDE_ATAPI_ID As Long = 2                  ' ATAPI ID command supported

Private Const CAP_IDE_EXECUTE_SMART_FUNCTION As Long = 4    ' SMART commannds supported

Private Type IDEREGS

bFeaturesReg As Byte       ' Used for specifying SMART "commands".

bSectorCountReg As Byte    ' IDE sector count register

bSectorNumberReg As Byte   ' IDE sector number register

bCylLowReg As Byte         ' IDE low order cylinder value

bCylHighReg As Byte        ' IDE high order cylinder value

bDriveHeadReg As Byte      ' IDE drive/head register

bCommandReg As Byte        ' Actual IDE command.

bReserved As Byte          ' reserved for future use.  Must be zero.

End Type

Private Type SENDCMDINPARAMS

cBufferSize As Long        ' Buffer size in bytes

irDriveRegs As IDEREGS     ' Structure with drive register values.

bDriveNumber As Byte       ' Physical drive number to send

' command to (0,1,2,3).

bReserved(2) As Byte       ' Reserved for future expansion.

dwReserved(3) As Long      ' For future use.

bBuffer(0) As Byte         ' Input buffer.

End Type

Private Const IDE_ATAPI_ID As Long = &HA1  ' Returns ID sector for ATAPI.

Private Const IDE_ID_FUNCTION As Long = &HEC  ' Returns ID sector for ATA.

Private Const IDE_EXECUTE_SMART_FUNCTION As Long = &HB0  ' Performs SMART cmd.

Private Const SMART_CYL_LOW As Long = &H4F

Private Const SMART_CYL_HI As Long = &HC2

Private Type DRIVERSTATUS

bDriverError As Byte       ' Error code from driver,

bIDEStatus As Byte         ' Contents of IDE Error register.

bRes

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值