Any suggestions for a good "wineish" way to implement an IOCTL_ call for an IDE disk?
My winelib app is hosting a Windows DLL that is making an IOCTL_DISK_DRIVE_GET_GEOMETRY call on an IDE hard disk. ntdll/file.c NtDeviceIoControlFile is passing this off to ntdll/cdrom.c CDROM_DeviceIoControl and, of course, since it is not a cdrom disk, that fails.
I have some code that reads geometry information out of /proc/ide/hd?/geometry that is working fine. But I am not sure how to integrate it into ntdll.
Should I put my code in CDROM_DeviceIoControl? Or handle it in NtDeviceIoControlFile? Should I pass all other IoControlCodes except IOCTL_DISK_DRIVE_GET_GEOMETRY for a verifiable IDE drive on to the CDROM_... function?
If anyone has a background in this code, you probably have an idea straight off how best to fit it in.
Thanks for any help. Patch against wine-20050419 is attached for illustrative purposes. ... mo
Tuesday, September 20, 2005, 6:11:49 PM, Michael Ost wrote:
Any suggestions for a good "wineish" way to implement an IOCTL_ call for an IDE disk?
Use SCSI ioctls I think they should work on IDE drives as well.
I have some code that reads geometry information out of /proc/ide/hd?/geometry that is working fine. But I am not sure how to integrate it into ntdll.
This is not portable. Does it really need to know geometry? Could you just tell it some fake stuff?
Should I put my code in CDROM_DeviceIoControl? Or handle it in NtDeviceIoControlFile? Should I pass all other IoControlCodes except IOCTL_DISK_DRIVE_GET_GEOMETRY for a verifiable IDE drive on to the CDROM_... function?
I don't it make any sense to create the whole new file to parse just one IOCTL. So you might just add it to the cdrom.c I think that might get accepted.
Thanks for any help. Patch against wine-20050419 is attached for illustrative purposes. ... mo
No this will not work. You can't add your function at front of what's there. This will slow down and add unnecessary fixmis. For onw IOCTL you might as well put into the cdrom.c
But before you go too far, pleas look at kernel/oldconfig.c. It does some parsing of /proc already. So all you need to do is to find where this information is stored on windows (it has to be somewhere in registry) and add to that. Then you don't need to parse /proc all the time but just read info from the registry. One possible option would be to use IOCTL_SCSI_GET_INQUIRY_DATA to get the hdd info. I think it does work on IDE HDDs. And as I remember it has the info you need. And also all that info stored in registry as well.
Vitaliy
From: Vitaliy Margolen
So all you need to do is to find where this information is stored on windows (it has to be somewhere in registry
It's an IOCTL, so it is passed to the disk driver on Windows. Although it is possible that the driver caches the info in the registry, I don't think that's very likely (and it would be driver-dependent). That doesn't mean that Wine can't store the info where it pleases (e.g. in the registry).
Ge van Geldorp.