I need to find the i/o port and status port for each IDE hard drive
connected to a system. So far I've been able to get these from the standard
primary/secondary IDE controller by using the following method:
1. Open \??\PhysicalDriveX, where X is the drive number I'm intersted in.
2. Send it an IOCTL_SCSI_GET_ADDRESS
3. Open \Device\ScsiPortX, where X is the PortNumber returned by
IOCTL_SCSI_GET_ADDRESS.
4. Send it IRP_MN_QUERY_DEVICE_RELATIONS with relation type of
TargetDeviceRelation
5. Use IoGetDeviceProperty to send the DEVICE_OBJECT returned by #4 a
DevicePropertyBootConfiguration query.
6. Walk through the CM_RESOURCE_LIST returned by #5 I can find the port
resources for the drive.
However, this doesn't work for a serial ATA drive for some reason. It works
fine up to #5, but the IoGetDeviceProperty returns
STATUS_OBJECT_NAME_NOT_FOUND (0xC0000034).
So, is there a better way to get this information for each IDE drive?
I've only been working with Windows device drivers for the past 3 weeks, so
if anything doesn't sound right, it probably isn't. Let me know if I can
provide more clarification to the question.
Thanks,
Josh