Question

I made a device driver. But my system crashed at the moment when it was deleting the device object. I think the symbolic link was deleted and it crashed after it was trying to delete the device as I can't see the symbolic link in the Global. How do I delete this device now. It also gives me a error popup(system cannot find the file specified Device\Mydriver) when I try to open the listed Mydriver under devices from Winobj.

I tried starting the driver's service again. I do get a handle back when opening the service. But it wont start now. giving the error value of Cannot find the file specified. I was working fine, i mean starting the driver before this crash.

I am a beginner with drivers and doing this to learn, please guide.

Was it helpful?

Solution

I have taken this from : Programming microsoft windows driver 2nd edition by woney I hope this helps.

Removability of devices in a Plug and Play environment is the ultimate source of the early-unload problem mentioned in the text. it’s your responsibility to avoid sending an IRP to a driver that might no longer be in memory and to prevent the PnP manager from unloading a driver that’s still processing an IRP you’ve sent to that driver. One aspect of how you fulfill that responsibility is shown in the text: take an extra reference to the file object returned by IoGetDeviceObjectPointer around the call to IoCallDriver. In most drivers, you’ll probably need the extra reference only when you’re sending an asynchronous IRP. In that case, the code that ordinarily dereferences the file object is likely to be in some other part of your driver that runs asynchronously with the call to IoCallDriver—say, in the completion routine you’re obliged to install for an asynchronous IRP. If you send a synchronous IRP, you’re much more likely to code your driver in such a way that you don’t dereference the file object until the IRP completes.

OTHER TIPS

Use the interactive boot option and don't load the troublesome driver. Then you can experiment perhaps by adding diagnostic instrumentation to the driver or other debugging techniques to determine the underlying problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top