Call function from thread with PIRP

hello

I’m quite beginner level driver development system.

question:
If I create a PIRP with Ioallocateirp,
Do I initialize with ExAllocatePool the AssociatedIrp.SystemBuffer ?
How do set the size of SystemBuffer ?
I need allocate a pointer systembuffer from IRP , how do i ?

I wish to create a PIRP with IoallocateIrp and make a IoCompleteRequest on another thread without using the function IoCallDriver knowing that the event function "Completerequest"should be called (IoSetCompletionRoutine).

IoSetCompletionRoutine (irp,

Completerequest,

Event, / / pass object as Context Transfer

TRUE, / / Invoke on Success

TRUE, / / Invoke on Error

TRUE) / / Invoke it Cancel

Conclusion
If I create a PIRP with IoAllocateIrp and I run IoSetCompletionRoutine and IoCompleteRequest without calling IoCallDriver , is what my function CompleteRequest finally calling???

I call a function of my driver internally without going through IoCallDriver function.

Thank you .

You need to do some serious studying and reading.

First, I’d *strongly* suggest you use KMDF or UMDF instead of WDM (if at all possible). Your life will be simpler. Much simpler.

Yes.

The length in the IoStackLocation, specific to the I/O Function Code.

For example IoStack->Parameters.Read.Length

No. The driver that calls IoCompleteRequest *never* gets a completion routine callback. Ever.

I suggest you re-think your approach. But you probably want to do some studying first. Driver writing is not amenable to “grabbing some code and hacking it to make it work” the way writing applications in C# is, for example. I feel an NT Insider article coming on this topic.

Peter
OSR