Howto clone an IRP?

Hello,

I have the task to change the behaviour of an existing WDM filter driver.

I just know a little bit about this driver, since I am not the origin developer
of this driver. I already added a little modification to that driver. This little
modification works fine.
And I also do not know a lot about WDM driver development, just some basics.
Ok, those basics has been enough, to add the first modification.

Here is the current task, that I have (and where I need a little bit help):

Currently the WDM filter driver filters IRPs, which are sent from a specific USB-device.
The following feature has to be added:

Step 1:

In some cases when the CompletionRoutine() is called, I have to create a second IRP.

This second IRP must be idendical to the IRP with which the CompletionRoutine()
was called.

Step 2:

Then I have to change some values in “Irp->UserBuffer”.

I) So the question is, how can I do that?

II) Can you please tell me A L L the points, that I have to do / to consider?

Thanks in advance for all your help!

I recommend to you to make a search on word “IoAllocateIrp” in WDK source code. You could find samples how drivers allocate and use a new Irp. I also recommend to you to study of any Windows driver development books which cover this question. For example, Walter Oney “Programming the Microsoft Windows Driver Model” is good one.

Igor Sharovar

xxxxx@live.com wrote:

Hello,

I have the task to change the behaviour of an existing WDM filter driver.

I already answered this question somewhere. Was it on the MSDN forum?

Currently the WDM filter driver filters IRPs, which are sent from a specific USB-device.
The following feature has to be added:

Step 1:

In some cases when the CompletionRoutine() is called, I have to create a second IRP.

This second IRP must be idendical to the IRP with which the CompletionRoutine()
was called.

Step 2:

Then I have to change some values in “Irp->UserBuffer”.

What do you intend to do with that second IRP? It’s very easy to create
a new IRP to send down the driver stack, but if (for example) you are
hoping to send the results of that IRP back up to the original
application, you can’t do that. Also, once you complete that first IRP,
the UserBuffer is no longer safe to access. You will need to make a
copy of it for your new IRP.

II) Can you please tell me A L L the points, that I have to do / to consider?

No, we can’t do that. This is not a free consulting service. We can
offer you hints and pointers, but only YOU know how this driver will be
used and what interactions it might have with applications.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.