Clear Buffer in the Device

Hello All,

I have a USB Security device which sends and receives data. I developed the driver based on usbbulk sample provided with DDK. I have an application which tests read/writes to the device. My driver is working fine as long as the application is closed properly. The application ends normally when i terminate the application in between read/writes. But when i restart the application, system hangs or some times crashes.

I assume the buffers are not properly handled which does not clear them from the device.

To this i decided to handle a routine which resets the device in my DispatchClean(). I created my own IRP using IoAllocateIrp() and then used MDL which reads the pending buffers from device and clears them. But this does not solve my problem.

Is my approach correct to solve the problem? or Can any one guide me if there is any alternate solution to this kind of problem?

Thanks & Regards,
Sushma


Relax. Yahoo! Mail virus scanning helps detect nasty viruses!