Hello,
I also have a question regarding Irp reusing
which probably goes to Microsoft’s people too.
You probably know that there is a routine called
IoReuseIrp which is able to “cleanup” an Irp used
more than one time. However this routine is not
available on Lite platform and if you are writing
a WDM driver you need something stable across platforms.
There is also another routine IoInitializeIrp.
The main difference between it and IoReuseIrp as I
understand it is that the first routine is used for
Irps not allocated by Io while the second one must be
used for Irps allocated by IoAllocateIrp. Other
difference may be that IoInitializeIrp should be called
befor the Irp is used for the first time while IoAllocateIrp
has already initialized the allocated Irp. Etc. etc. etc…
So what should I do to be as most correct as I can be?
a)
- Allocate my own memory of size IoSizeOfIrp(StackSize)
- Initialize it by IoInitializeIrp(…, IoSizeOfIrp(StackSize),
StackSize) - Use it to pass requests and after every such request has been
completed “clean” the Irp by repeating the step 2.
Q: Last two parameters are already present inside the Irp itself,
so have I to remeber them separately or can I touch the basic
fields of the Irp, concretely Irp->Size and Irp->StackCount?
b) - Allocate the Irp using IoAllocateIrp(StackSize, FALSE)
- Use it to pass requests and after every such request has been
completed “clean” the Irp:
A] only partially, mainly clear Irp->Cancel flag and maybe some
other interesting fields
Q: which?
B] completely, but using some hack by saving Irp->AllocationFlags
(which is probably affected by the following routine), then
call IoInitializeIrp(…) and finally restore the Irp->AllocationFlags
Q: as in a)3.
Or is there some other correct way using only WDM exports?
Thank you for your suggestions.
Paul
PS: My client for this particular problem is USB driver stack
and those Irps are used only for sending down the URBs -
thus breaking many rules for passing buffer pointers and
so on, becuase this is internal device control and from the
definition it can be issued only by kernel mode (and thus
“trusted”) components only - allowing some exceptions.
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com