what should i do in those functions?
i use DriverEntry only to setup dispatch, unload, and AddDevice.
Should i do anything else?
What about unload routine?
should i do any cleanup there, or just depend on PnP?
if i depend on pnp, i have no guarantee that PnP dispatch function will be called before system unload driver, by NtUnloadDriver for example. And my driver would leak resources.
so should my unload routine do any sort of cleanup, or not?
and how should i handle cancelation? i understand irp queue and i know how to manage it manually (setting context flag 'IsCalceled' and checking if irp is already communicationg with hardware/check for this flag when removing it from queue). Ive found tons of information about this, and i dont understand a bit from it. Its just soo complicated that i give up.
What is IRP->Cancel used for? When is IRP->CancelRoutine called?
what should i do? how cancel safe queue apply to that?
this driver stuff reallyis complicated more that it should be.
|