Hi,
Consider following sequence of calls:
////////////
//+Code
pQIRP = TdiBuildInternalDeviceControlIrp // allocate an IRP
:
:
“some processing”
:
:
TdiBuildQueryInformation // Setup internal device IO control IRP
IoCallDriver
done:
if(pQIRP)
IoFreeIrp
//-
////////////
We must not free the IRP allocated by TdiBuildInternalDeviceControlIrp (since it is just a macro around IoBuildDeviceIoControlRequest).
Is it that only the IRPs passed to other drivers using IoCallDriver must not be freed
OR
Any IRP allocated by TdiBuildInternalDeviceControlIrp must not be freed (even if we don’t call IoCallDriver)
In the above code:
if something goes wrong in “some processing”. Then I will have to jump to “done” and free the IRP. Is it OK to free the IRP. Because (since it hasn’t been sent, i.e. IoCallDriver isn’t called yet).
TIA
Abhijit
No. Call IoCompleteRequest, and the IO Manager will free it for you,
after doing some post processing.
Srin.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Abhijit
Sent: Thursday, April 15, 2004 12:20 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Freeing IRP allocated by
TdiBuildInternalDeviceControlIrp
Hi,
Consider following sequence of calls:
////////////
//+Code
pQIRP = TdiBuildInternalDeviceControlIrp // allocate an IRP
:
:
“some processing”
:
:
TdiBuildQueryInformation // Setup internal device IO control
IRP
IoCallDriver
done:
if(pQIRP)
IoFreeIrp
//-
////////////
We must not free the IRP allocated by
TdiBuildInternalDeviceControlIrp (since it is just a macro around
IoBuildDeviceIoControlRequest).
Is it that only the IRPs passed to other drivers using
IoCallDriver must not be freed
OR
Any IRP allocated by TdiBuildInternalDeviceControlIrp must not
be freed (even if we don’t call IoCallDriver)
In the above code:
if something goes wrong in “some processing”. Then I will have
to jump to “done” and free the IRP. Is it OK to free the IRP. Because
(since it hasn’t been sent, i.e. IoCallDriver isn’t called yet).
TIA
Abhijit
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com