1、I/OVC/MFCDDKLynn McGuireIDEDiskID32ATA/APAPIIDENTIFY DEVICEATA/APAPIT13IDE/EIDE/UDMAATA/APAPI-7ATA/ATAPIATA/ATAPIT13/ IOCTL/ #define DFP_SEND_DRIVE_COMMAND 0x0007c084#define DFP_SEND_DRIVE_COMMAND CTL_CODE(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)/ #define DFP_R
2、ECEIVE_DRIVE_DATA 0x0007c088#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 irDriveRegs.bFeaturesReg = 0;irDriveRegs.bSectorCountReg = 0;ir
3、DriveRegs.bSectorNumberReg = 0;irDriveRegs.bCylLowReg = 0;irDriveRegs.bCylHighReg = 0;irDriveRegs.bDriveHeadReg = 0; pSCIP-irDriveRegs.bCommandReg = IDE_ATA_IDENTIFY;cBufferSize = 0; pSCOP-cBufferSize = sizeof(IDINFO); / IDENTIFY DEVICE bResult = :DeviceIoControl(hDevice, / DFP_RECEIVE_DRIVE_DATA, /
4、 IOCTL pSCIP, sizeof(SENDCMDINPARAMS) - 1, / pSCOP, sizeof(SENDCMDOUTPARAMS) + sizeof(IDINFO) - 1, / &dwOutBytes, / (LPOVERLAPPED)NULL); / I/O / :memcpy(pIdInfo, pSCOP-bBuffer, sizeof(IDINFO);GlobalFree(pSCOP);GlobalFree(pSCIP); return bResult;SCSI MINI-PORTBOOL IdentifyDeviceAsScsi(HANDLE hDevice,
5、int nDrive, PIDINFO pIdInfo) PSRB_IO_CONTROL pSRBIO; / SCSI pSRBIO = (PSRB_IO_CONTROL):GlobalAlloc(LMEM_ZEROINIT, sizeof(SRB_IO_CONTROL)+sizeof(SENDCMDOUTPARAMS)+sizeof(IDINFO)-1); pSCIP = (PSENDCMDINPARAMS)(char *)pSRBIO+sizeof(SRB_IO_CONTROL); pSCOP = (PSENDCMDOUTPARAMS)(char *)pSRBIO+sizeof(SRB_IO