question about WdfRequestCreateFromIrp

Hi, doron and other folks,
I am developing my first kmdf driver. In some of my event callbacks, I
have to send out a WdfRequest created by myself. However, there is not
an easy way to format this request since the request I have to send out
is a IRP_MJ_SCSI request just as the disk class driver does. I have
thought about a workaround for this issue:

  1. I allocate a normal wdm IRP by IoAllocateIrp and format it as the
    normal WDM driver according to the corresponding DeviceObject returned
    by *WdfIoTargetWdmGetTargetDeviceObject* .
  2. I create a WdfRequest by WdfRequestCreateFromIrp and set
    /RequestFreesIrp to FALSE
  3. I set the completion routine for the WdfRequest and send it out by
    WdfSend.
    In my completion routine:
  4. I invoke WdfObjectDelete to destroy the WdfRequest.
  5. I invoke IoFreeIrp to free the IRP allocated.
    Is it safe for this workaround?
    Thanks a lot.
    /


Best Regards,
hanzhu

I am not ignoring your request…I will blog about this soon (hopefully
today) so that you have your answer. I have a couple of things to take
care of first…

Thx
d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of hanzhu
Sent: Monday, August 14, 2006 6:28 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] question about WdfRequestCreateFromIrp

Hi, doron and other folks,
I am developing my first kmdf driver. In some of my event callbacks, I
have to send out a WdfRequest created by myself. However, there is not
an easy way to format this request since the request I have to send out
is a IRP_MJ_SCSI request just as the disk class driver does. I have
thought about a workaround for this issue:

  1. I allocate a normal wdm IRP by IoAllocateIrp and format it as the
    normal WDM driver according to the corresponding DeviceObject returned
    by *WdfIoTargetWdmGetTargetDeviceObject* .
  2. I create a WdfRequest by WdfRequestCreateFromIrp and set
    /RequestFreesIrp to FALSE
  3. I set the completion routine for the WdfRequest and send it out by
    WdfSend.
    In my completion routine:
  4. I invoke WdfObjectDelete to destroy the WdfRequest.
  5. I invoke IoFreeIrp to free the IRP allocated.
    Is it safe for this workaround?
    Thanks a lot.
    /


Best Regards,
hanzhu


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer