Device Driver does not close cleanly

Device Driver does not close cleanly

Post by Q3lib3J » Wed, 22 Nov 2006 12:10:02


I wrote an ISA Device Driver with Visual C++ and the Windows 98 DDK that runs
OK. The application that calls the Device Driver was written in Borland C++.

When the application is closed, it takes several minutes for the task to be
removed from the Windows task list (although it went off screen straight
away). The application could not be renamed or overwritten until it had
finally exited from the Windows task list. Also Windows 98 does a ScanDisk
when rebooting after running this application.

I followed Walter Oney's advice in "Programming the Microsoft Windows Driver
Model" when closing the Device Driver by calling:
DispatchCleanup (fdo, Irp);
StopDevice (fdo);
RemoveDevice (fdo);

Also the application uses "CloseHandle" to close the handles that were
created for the Interface Card and the Event Flag used by the Interrupt
Handler inside the Device Driver. Furthermore the application also uses the
"DeviceIoControl" to tell the Device Driver to call "ObDereferenceObject
(pdx->event)" to release this Event Flag that was used by the Interrupt
Handler to synchronize the Ionosonde hardware with the software.

However the application does still not close cleanly. Any clues or
suggestions would be appreciated.