#pragma once
|
#include <windows.h>
|
#include <winioctl.h>
|
typedef struct _IDINFO
|
{
|
USHORT wGenConfig; // WORD 0: »ù±¾ÐÅÏ¢×Ö
|
USHORT wNumCyls; // WORD 1: ÖùÃæÊý
|
USHORT wReserved2; // WORD 2: ±£Áô
|
USHORT wNumHeads; // WORD 3: ´ÅÍ·Êý
|
USHORT wReserved4; // WORD 4: ±£Áô
|
USHORT wReserved5; // WORD 5: ±£Áô
|
USHORT wNumSectorsPerTrack; // WORD 6: ÿ´ÅµÀÉÈÇøÊý
|
USHORT wVendorUnique[3]; // WORD 7-9: ³§¼ÒÉ趨ֵ
|
CHAR sSerialNumber[20]; // WORD 10-19:ÐòÁкÅ
|
USHORT wBufferType; // WORD 20: »º³åÀàÐÍ
|
USHORT wBufferSize; // WORD 21: »º³å´óС
|
USHORT wECCSize; // WORD 22: ECCУÑé´óС
|
CHAR sFirmwareRev[8]; // WORD 23-26: ¹Ì¼þ°æ±¾
|
CHAR sModelNumber[40]; // WORD 27-46: ÄÚ²¿ÐͺÅ
|
USHORT wMoreVendorUnique; // WORD 47: ³§¼ÒÉ趨ֵ
|
USHORT wReserved48; // WORD 48: ±£Áô
|
struct {
|
USHORT reserved1:8;
|
USHORT DMA:1; // 1=Ö§³ÖDMA
|
USHORT LBA:1; // 1=Ö§³ÖLBA
|
USHORT DisIORDY:1; // 1=¿É²»Ê¹ÓÃIORDY
|
USHORT IORDY:1; // 1=Ö§³ÖIORDY
|
USHORT SoftReset:1; // 1=ÐèÒªATAÈíÆô¶¯
|
USHORT Overlap:1; // 1=Ö§³ÖÖصþ²Ù×÷
|
USHORT Queue:1; // 1=Ö§³ÖÃüÁî¶ÓÁÐ
|
USHORT InlDMA:1; // 1=Ö§³Ö½»²æ´æÈ¡DMA
|
} wCapabilities; // WORD 49: Ò»°ãÄÜÁ¦
|
USHORT wReserved1; // WORD 50: ±£Áô
|
USHORT wPIOTiming; // WORD 51: PIOʱÐò
|
USHORT wDMATiming; // WORD 52: DMAʱÐò
|
struct {
|
USHORT CHSNumber:1; // 1=WORD 54-58ÓÐЧ
|
USHORT CycleNumber:1; // 1=WORD 64-70ÓÐЧ
|
USHORT UnltraDMA:1; // 1=WORD 88ÓÐЧ
|
USHORT reserved:13;
|
} wFieldValidity; // WORD 53: ºóÐø×Ö¶ÎÓÐЧÐÔ±êÖ¾
|
USHORT wNumCurCyls; // WORD 54: CHS¿ÉÑ°Ö·µÄÖùÃæÊý
|
USHORT wNumCurHeads; // WORD 55: CHS¿ÉÑ°Ö·µÄ´ÅÍ·Êý
|
USHORT wNumCurSectorsPerTrack; // WORD 56: CHS¿ÉѰַÿ´ÅµÀÉÈÇøÊý
|
USHORT wCurSectorsLow; // WORD 57: CHS¿ÉÑ°Ö·µÄÉÈÇøÊýµÍλ×Ö
|
USHORT wCurSectorsHigh; // WORD 58: CHS¿ÉÑ°Ö·µÄÉÈÇøÊý¸ßλ×Ö
|
struct {
|
USHORT CurNumber:8; // µ±Ç°Ò»´ÎÐԿɶÁдÉÈÇøÊý
|
USHORT Multi:1; // 1=ÒÑÑ¡Ôñ¶àÉÈÇø¶Áд
|
USHORT reserved1:7;
|
} wMultSectorStuff; // WORD 59: ¶àÉÈÇø¶ÁдÉ趨
|
ULONG dwTotalSectors; // WORD 60-61: LBA¿ÉÑ°Ö·µÄÉÈÇøÊý
|
USHORT wSingleWordDMA; // WORD 62: µ¥×Ö½ÚDMAÖ§³ÖÄÜÁ¦
|
struct {
|
USHORT Mode0:1; // 1=Ö§³Öģʽ0 (4.17Mb/s)
|
USHORT Mode1:1; // 1=Ö§³Öģʽ1 (13.3Mb/s)
|
USHORT Mode2:1; // 1=Ö§³Öģʽ2 (16.7Mb/s)
|
USHORT Reserved1:5;
|
USHORT Mode0Sel:1; // 1=ÒÑÑ¡Ôñģʽ0
|
USHORT Mode1Sel:1; // 1=ÒÑÑ¡Ôñģʽ1
|
USHORT Mode2Sel:1; // 1=ÒÑÑ¡Ôñģʽ2
|
USHORT Reserved2:5;
|
} wMultiWordDMA; // WORD 63: ¶à×Ö½ÚDMAÖ§³ÖÄÜÁ¦
|
struct {
|
USHORT AdvPOIModes:8; // Ö§³Ö¸ß¼¶POIģʽÊý
|
USHORT reserved:8;
|
} wPIOCapacity; // WORD 64: ¸ß¼¶PIOÖ§³ÖÄÜÁ¦
|
USHORT wMinMultiWordDMACycle; // WORD 65: ¶à×Ö½ÚDMA´«ÊäÖÜÆÚµÄ×îСֵ
|
USHORT wRecMultiWordDMACycle; // WORD 66: ¶à×Ö½ÚDMA´«ÊäÖÜÆڵĽ¨ÒéÖµ
|
USHORT wMinPIONoFlowCycle; // WORD 67: ÎÞÁ÷¿ØÖÆʱPIO´«ÊäÖÜÆÚµÄ×îСֵ
|
USHORT wMinPOIFlowCycle; // WORD 68: ÓÐÁ÷¿ØÖÆʱPIO´«ÊäÖÜÆÚµÄ×îСֵ
|
USHORT wReserved69[11]; // WORD 69-79: ±£Áô
|
struct {
|
USHORT Reserved1:1;
|
USHORT ATA1:1; // 1=Ö§³ÖATA-1
|
USHORT ATA2:1; // 1=Ö§³ÖATA-2
|
USHORT ATA3:1; // 1=Ö§³ÖATA-3
|
USHORT ATA4:1; // 1=Ö§³ÖATA/ATAPI-4
|
USHORT ATA5:1; // 1=Ö§³ÖATA/ATAPI-5
|
USHORT ATA6:1; // 1=Ö§³ÖATA/ATAPI-6
|
USHORT ATA7:1; // 1=Ö§³ÖATA/ATAPI-7
|
USHORT ATA8:1; // 1=Ö§³ÖATA/ATAPI-8
|
USHORT ATA9:1; // 1=Ö§³ÖATA/ATAPI-9
|
USHORT ATA10:1; // 1=Ö§³ÖATA/ATAPI-10
|
USHORT ATA11:1; // 1=Ö§³ÖATA/ATAPI-11
|
USHORT ATA12:1; // 1=Ö§³ÖATA/ATAPI-12
|
USHORT ATA13:1; // 1=Ö§³ÖATA/ATAPI-13
|
USHORT ATA14:1; // 1=Ö§³ÖATA/ATAPI-14
|
USHORT Reserved2:1;
|
} wMajorVersion; // WORD 80: Ö÷°æ±¾
|
USHORT wMinorVersion; // WORD 81: ¸±°æ±¾
|
USHORT wReserved82[6]; // WORD 82-87: ±£Áô
|
struct {
|
USHORT Mode0:1; // 1=Ö§³Öģʽ0 (16.7Mb/s)
|
USHORT Mode1:1; // 1=Ö§³Öģʽ1 (25Mb/s)
|
USHORT Mode2:1; // 1=Ö§³Öģʽ2 (33Mb/s)
|
USHORT Mode3:1; // 1=Ö§³Öģʽ3 (44Mb/s)
|
USHORT Mode4:1; // 1=Ö§³Öģʽ4 (66Mb/s)
|
USHORT Mode5:1; // 1=Ö§³Öģʽ5 (100Mb/s)
|
USHORT Mode6:1; // 1=Ö§³Öģʽ6 (133Mb/s)
|
USHORT Mode7:1; // 1=Ö§³Öģʽ7 (166Mb/s) ???
|
USHORT Mode0Sel:1; // 1=ÒÑÑ¡Ôñģʽ0
|
USHORT Mode1Sel:1; // 1=ÒÑÑ¡Ôñģʽ1
|
USHORT Mode2Sel:1; // 1=ÒÑÑ¡Ôñģʽ2
|
USHORT Mode3Sel:1; // 1=ÒÑÑ¡Ôñģʽ3
|
USHORT Mode4Sel:1; // 1=ÒÑÑ¡Ôñģʽ4
|
USHORT Mode5Sel:1; // 1=ÒÑÑ¡Ôñģʽ5
|
USHORT Mode6Sel:1; // 1=ÒÑÑ¡Ôñģʽ6
|
USHORT Mode7Sel:1; // 1=ÒÑÑ¡Ôñģʽ7
|
} wUltraDMA; // WORD 88: Ultra DMAÖ§³ÖÄÜÁ¦
|
USHORT wReserved89[167]; // WORD 89-255
|
} IDINFO, *PIDINFO;
|
//#define DFP_SEND_DRIVE_COMMAND CTL_CODE(IOCTL_DISK_BASE,0x0021,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
|
//#define DFP_RECIEVE_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 0x004D008
|
|
//SCSIÇý¶¯ËùÐèµÄÊäÈëÊä³ö¹²Óýṹ
|
typedef struct _SRB_IO_CONTROL
|
{
|
ULONG HeaderLength; //Í·³¤¶È
|
UCHAR Signature[8]; //ÌØÕ÷Ãû³Æ
|
ULONG Timeout; //³¬Ê±Ê±¼ä
|
ULONG ControlCode; //¿ØÖÆÂë
|
ULONG ReturnCode; //·µ»ØÂë
|
ULONG Length; //»º³åÇø³¤¶È
|
}SRB_IO_CONTROL, *PSRB_IO_CONTROL;
|
const WORD IDE_ATAPI_IDENTIFY = 0xA1; // ¶ÁÈ¡ATAPIÉ豸µÄÃüÁî
|
const WORD IDE_ATA_IDENTIFY = 0xEC; // ¶ÁÈ¡ATAÉ豸µÄÃüÁî
|
const int DISK_PATH_LEN = 128;
|
const int DISK_INFO_BUF_LEN = 128;
|
HANDLE OpenDevice(LPCTSTR sFileName);
|
BOOL GetIdeDriveAsScsiInfoInNT(int nDrive, PIDINFO pIdInfo);
|
int GetHDSerialID(int driver);
|
|
|