文档详情

获取硬盘的详细信息(Get detailed information about the drive).doc

发布:2017-07-21约1.37万字共26页下载文档
文本预览下载声明
获取硬盘的详细信息(Get detailed information about the drive) Get detailed information about the drive Q can only get very few disk parameters with IOCTL_DISK_GET_DRIVE_GEOMETRY or IOCTL_STORAGE_GET_MEDIA_TYPES_EX. I want to get more detailed information including the serial number of the hard disk. What can I do about it? A indeed, with what you call the I/O control code, you can only get the most basic disk parameters. Get the I/O control code of the disk factory information, Microsoft is not open in the VC/MFC environment, you can find some clues in DDK. Earlier, Lynn McGuire wrote a well known program for getting detailed information about IDE drives, DiskID32, and the example below was based on additions and deletions and improvements. In this example, we will use the IDENTIFY DEVICE ATA/APAPI instructions. ATA/APAPI is the international organization T13 drafted and published IDE/EIDE/UDMA hard disk and other removable storage devices and host interface standards, so far has come to the ATA/APAPI-7 version. The interface standard specifies the input and output registers and the instruction set of the ATA/ATAPI device. For more detailed ATA/ATAPI technical information, visit the T13 site. The constants and data structures used are listed below: / / IOCTL control code DFP_SEND_DRIVE_COMMAND 0x0007c084 / / #define #define DFP_SEND_DRIVE_COMMAND CTL_CODE (IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) DFP_RECEIVE_DRIVE_DATA 0x0007c088 / / #define #define DFP_RECEIVE_DRIVE_DATA CTL_CODE (IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) #define FILE_DEVICE_SCSI 0x0000001b #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI, 16) + 0x0501) #define IOCTL_SCSI_MINIPORT 0x0004D008 NTDDSCSI.H for definition / / see / / ATA/ATAPI instruction #define IDE_ATA_IDENTIFY 0xEC / / ATA ID instruction (IDENTIFY DEVICE) / / IDE command register Typedef struct _IDEREGS { BYTE bFeaturesReg; / / register (for SMART command) BYTE
显示全部
相似文档