?
Solved

Perform a IDE bus reset using SPTI on Windows 2K/XP

Posted on 2001-09-01
10
Medium Priority
?
656 Views
Last Modified: 2013-12-04
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("\\\\.\\Scsi2:",
     GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
     NULL,OPEN_EXISTING,0,NULL);

  if(DeviceHandle==INVALID_HANDLE_VALUE) {
     cout<<"Unable to open "<<GetLastError()<<endl;
     return;
  }
  cout<<"DeviceHandle="<<DeviceHandle<<endl;

  STORAGE_BUS_RESET_REQUEST rreq={0};

  Status=DeviceIoControl(DeviceHandle,OBSOLETE_IOCTL_STORAGE_RESET_BUS,&rreq,sizeof(rreq),
     NULL,0,&ByteCount,FALSE);
  cout<<Status<<' '<<GetLastError()<<endl;

  CloseHandle(DeviceHandle);
}
0
Comment
Question by:skris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6447797
I don't find:

IOCTL_STORAGE_RESET_BUS

or

OBSOLETE_IOCTL_STORAGE_RESET_BUS

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..
0
 
LVL 32

Expert Comment

by:jhance
ID: 6447799
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.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6448161
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
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 1

Expert Comment

by:Moondancer
ID: 6448169
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
0
 
LVL 32

Accepted Solution

by:
jhance earned 1200 total points
ID: 6448236
Well, from the looks of that old question this ground has already been covered.  Why this question was asked again is now quite unclear.

Regardless of how many points are offered, it's not likely to make the impossible happen...

Again, I suggest your best action if you really need to do this is to implement a device driver that can interact with the IDE controller on its own level.  If necessary you could even replace the IDE driver with your own driver and gain access to the IDE hardware.  Yes, a drastic measure but it you really need to do this, it might be your only option.
0
 

Author Comment

by:skris
ID: 6448574
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.


0
 
LVL 32

Expert Comment

by:jhance
ID: 6448662
Sorry, but sometimes reality intrudes on what we would like to be true.  Not all solutions have simple answers.
0
 
LVL 8

Expert Comment

by:ViRoy
ID: 6459350
isnt a solution a answer?
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6646330
Please update/finalize this question.

Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6755175
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
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your app took Google’s lash recently, here are the 5 most likely reasons.
Curious about the latest ransomware attack? Check out our timeline of events surrounding the spread of this new virus along with tips on how to mitigate the damage.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question