skris
asked on
Perform a IDE bus reset using SPTI on Windows 2K/XP
I would like to do a IDE bus reset (NT4/Win2K/XP using SPTI).
What have I got so far (also see code below) :
- This code works just fine in NT4 and resets any IDE bus just fine.
- This code does not work with the standard IDE drivers on Win2K and WinXP (if you however try it with e.g. a Promise IDE controller it will work ; apparently those drivers accept a bus reset request using the method below).
What would I like to do ?
- Perform a reset of any IDE bus in Win2K and WinXP (using the standard IDE drivers which are installed by default by the OS).
Thanks,
#include <windows.h>
#include <iostream.h>
void main()
{
unsigned long ByteCount,Status;
HANDLE DeviceHandle;
DeviceHandle=CreateFile("\ \\\.\\Scsi 2:",
GENERIC_READ|GENERIC_WRITE ,FILE_SHAR E_READ|FIL E_SHARE_WR ITE,
NULL,OPEN_EXISTING,0,NULL) ;
if(DeviceHandle==INVALID_H ANDLE_VALU E) {
cout<<"Unable to open "<<GetLastError()<<endl;
return;
}
cout<<"DeviceHandle="<<Dev iceHandle< <endl;
STORAGE_BUS_RESET_REQUEST rreq={0};
Status=DeviceIoControl(Dev iceHandle, OBSOLETE_I OCTL_STORA GE_RESET_B US,&rreq,s izeof(rreq ),
NULL,0,&ByteCount,FALSE);
cout<<Status<<' '<<GetLastError()<<endl;
CloseHandle(DeviceHandle);
}
What have I got so far (also see code below) :
- This code works just fine in NT4 and resets any IDE bus just fine.
- This code does not work with the standard IDE drivers on Win2K and WinXP (if you however try it with e.g. a Promise IDE controller it will work ; apparently those drivers accept a bus reset request using the method below).
What would I like to do ?
- Perform a reset of any IDE bus in Win2K and WinXP (using the standard IDE drivers which are installed by default by the OS).
Thanks,
#include <windows.h>
#include <iostream.h>
void main()
{
unsigned long ByteCount,Status;
HANDLE DeviceHandle;
DeviceHandle=CreateFile("\
GENERIC_READ|GENERIC_WRITE
NULL,OPEN_EXISTING,0,NULL)
if(DeviceHandle==INVALID_H
cout<<"Unable to open "<<GetLastError()<<endl;
return;
}
cout<<"DeviceHandle="<<Dev
STORAGE_BUS_RESET_REQUEST rreq={0};
Status=DeviceIoControl(Dev
NULL,0,&ByteCount,FALSE);
cout<<Status<<' '<<GetLastError()<<endl;
CloseHandle(DeviceHandle);
}
Oh, I forgot to say...
How to do this now? Write a device driver of your own that can send an IRP to the IDE device (in kernel mode) to request that it do a IOCTL_STORAGE_RESET_BUS.
How to do this now? Write a device driver of your own that can send an IRP to the IDE device (in kernel mode) to request that it do a IOCTL_STORAGE_RESET_BUS.
This appears to be a "work in progress" of some complexity so this may well be relevant to this pursuit:
qid=10947941
If I'm incorrect, skris, please advise. Just trying to help you achieve our goal and allow all participating experts to be apprised of the details that may have led to this.
Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
qid=10947941
If I'm incorrect, skris, please advise. Just trying to help you achieve our goal and allow all participating experts to be apprised of the details that may have led to this.
Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
This appears to be a "work in progress" of some complexity so this may well be relevant to this pursuit:
qid=10947941
If I'm incorrect, skris, please advise. Just trying to help you achieve our goal and allow all participating experts to be apprised of the details that may have led to this.
Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
qid=10947941
If I'm incorrect, skris, please advise. Just trying to help you achieve our goal and allow all participating experts to be apprised of the details that may have led to this.
Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's correct ; qid=10947941 is related to this question.
Writing a device driver is (at least to me) a very complex, if not impossible, task and I have the feeling that this is a too drastic measure.
So, the issues I'm having with a device driver :
- Too complex ; overkill
- A device driver needs to be installed (and thus probably requiring a reboot)
- If some (hidden) problems with the driver exist (and there surely will, since this is a complex matter) you could mess things up pretty bad.
I really would like to keep it simple and use the functionality offered by the OS as much as possible.
Writing a device driver is (at least to me) a very complex, if not impossible, task and I have the feeling that this is a too drastic measure.
So, the issues I'm having with a device driver :
- Too complex ; overkill
- A device driver needs to be installed (and thus probably requiring a reboot)
- If some (hidden) problems with the driver exist (and there surely will, since this is a complex matter) you could mess things up pretty bad.
I really would like to keep it simple and use the functionality offered by the OS as much as possible.
Sorry, but sometimes reality intrudes on what we would like to be true. Not all solutions have simple answers.
isnt a solution a answer?
Please update/finalize this question.
Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
Unresponsive to my follow up request of 11/20/01, therefore I have finalized this and closed it. Sometimes the correct "A" response is, indeed, sorry that cannot be done, or is not supported.
Moondancer
Community Support Moderator @ Experts Exchange
Moondancer
Community Support Moderator @ Experts Exchange
IOCTL_STORAGE_RESET_BUS
or
OBSOLETE_IOCTL_STORAGE_RES
listed in the SDK as being supported by the DeviceIoControl() API. The IOCTL_STORAGE_RESET_BUS is in the DDK as a valid IRP function but this would need a kernel-mode driver to activate it.
I think you are running into a situation where the Promise IDE controller does support this optional command via DeviceIoContol and NT4 does as well but it's been removed from W2K and later. That's what happens when you use undocumented or obsolete stuff. Sometimes they really do turn them off..