From: Angela Yan on
Hi,

I need to create an Asyn IRP for IOCTL_HID_GET_FEATURE. But I can't find
any sample in DDK or WDM book for it. Here are the partial codes:


irp = IoAllocateIrp(DeviceExtension->TopOfStackDriver->StackSize + 1,
FALSE);

if(irp == NULL)
{
ExFreePool(report);
return STATUS_INSUFFICIENT_RESOURCES;
}

IoReuseIrp(irp, STATUS_SUCCESS);

irpSp = IoGetNextIrpStackLocation(irp);

irpSp->MajorFunction = IRP_MJ_DEVICE_CONTROL;
irpSp->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_FEATURE;
irpSp->Parameters.DeviceIoControl.OutputBufferLength =
DeviceExtension->FeatureReportLength;
irpSp->FileObject = fileObject;


I want to know how should I allocate the feature report buffer to the
Irp->MdlAddress?
By using IoAllocateMdl()?


When I get back the completed Irp, do I just directly access the MdlAddress
field to
get the feature report buffer, or any Io routine is needed?


And if I were to reuse to Irp to get the feature report, is there any
special handling that I
need to do for the MdlAddress?


Thanks in advance.

Angela


From: Doron Holan [MS] on
you can allocate the MDL with IoAllocateMdl and then if the buffer is a part
of your device extension, use MmBuildMdlFromNonPagedPool. If you go this
route, you should see use MmReuseMdl before reinitializng the MDL. the
bulkusb sample (which is a bit confusing for this, sorry) shows how to to
reuse a MDL.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Angela Yan" <yanyan9(a)hotmail.com> wrote in message
news:OFopLI%23qFHA.2072(a)TK2MSFTNGP14.phx.gbl...
> Hi,
>
> I need to create an Asyn IRP for IOCTL_HID_GET_FEATURE. But I can't find
> any sample in DDK or WDM book for it. Here are the partial codes:
>
>
> irp = IoAllocateIrp(DeviceExtension->TopOfStackDriver->StackSize + 1,
> FALSE);
>
> if(irp == NULL)
> {
> ExFreePool(report);
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> IoReuseIrp(irp, STATUS_SUCCESS);
>
> irpSp = IoGetNextIrpStackLocation(irp);
>
> irpSp->MajorFunction = IRP_MJ_DEVICE_CONTROL;
> irpSp->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_FEATURE;
> irpSp->Parameters.DeviceIoControl.OutputBufferLength =
> DeviceExtension->FeatureReportLength;
> irpSp->FileObject = fileObject;
>
>
> I want to know how should I allocate the feature report buffer to the
> Irp->MdlAddress?
> By using IoAllocateMdl()?
>
>
> When I get back the completed Irp, do I just directly access the
> MdlAddress field to
> get the feature report buffer, or any Io routine is needed?
>
>
> And if I were to reuse to Irp to get the feature report, is there any
> special handling that I
> need to do for the MdlAddress?
>
>
> Thanks in advance.
>
> Angela
>


From: Angela Yan on
Thank you Doron... :)

Angela



"Doron Holan [MS]" <doronh(a)nospam.microsoft.com> wrote in message
news:uXIgAJ$qFHA.2592(a)TK2MSFTNGP09.phx.gbl...
> you can allocate the MDL with IoAllocateMdl and then if the buffer is a
> part of your device extension, use MmBuildMdlFromNonPagedPool. If you go
> this route, you should see use MmReuseMdl before reinitializng the MDL.
> the bulkusb sample (which is a bit confusing for this, sorry) shows how to
> to reuse a MDL.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "Angela Yan" <yanyan9(a)hotmail.com> wrote in message
> news:OFopLI%23qFHA.2072(a)TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> I need to create an Asyn IRP for IOCTL_HID_GET_FEATURE. But I can't find
>> any sample in DDK or WDM book for it. Here are the partial codes:
>>
>>
>> irp = IoAllocateIrp(DeviceExtension->TopOfStackDriver->StackSize + 1,
>> FALSE);
>>
>> if(irp == NULL)
>> {
>> ExFreePool(report);
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> IoReuseIrp(irp, STATUS_SUCCESS);
>>
>> irpSp = IoGetNextIrpStackLocation(irp);
>>
>> irpSp->MajorFunction = IRP_MJ_DEVICE_CONTROL;
>> irpSp->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_GET_FEATURE;
>> irpSp->Parameters.DeviceIoControl.OutputBufferLength =
>> DeviceExtension->FeatureReportLength;
>> irpSp->FileObject = fileObject;
>>
>>
>> I want to know how should I allocate the feature report buffer to the
>> Irp->MdlAddress?
>> By using IoAllocateMdl()?
>>
>>
>> When I get back the completed Irp, do I just directly access the
>> MdlAddress field to
>> get the feature report buffer, or any Io routine is needed?
>>
>>
>> And if I were to reuse to Irp to get the feature report, is there any
>> special handling that I
>> need to do for the MdlAddress?
>>
>>
>> Thanks in advance.
>>
>> Angela
>>
>
>


From: Maxim S. Shatskih on
> I want to know how should I allocate the feature report buffer to the
> Irp->MdlAddress?
> By using IoAllocateMdl()?

No, use Irp->AssociatedIrp.SystemBuffer instead.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim(a)storagecraft.com
http://www.storagecraft.com


From: Angela Yan on
Hi,

The DDK says

"IOCTL_HID_GET_FEATURE
Output
The Irp->MdlAddress member points to the requester-allocated output buffer
that the HID class driver uses to return the feature report."

So I presume if a upper device filter, such as firefly, were to send
IOCTL_HID_GET_FEATURE to Hid miniDriver via HidClass, it should allocate the
Irp->MdlAddress to the output feature report buffer. Am I correct?

Thank you.

Angela



"Maxim S. Shatskih" <maxim(a)storagecraft.com> wrote in message
news:ujljqAJrFHA.908(a)tk2msftngp13.phx.gbl...
>> I want to know how should I allocate the feature report buffer to the
>> Irp->MdlAddress?
>> By using IoAllocateMdl()?
>
> No, use Irp->AssociatedIrp.SystemBuffer instead.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim(a)storagecraft.com
> http://www.storagecraft.com
>
>


 |  Next  |  Last
Pages: 1 2
Prev: OEMUI and OEMUNI
Next: USBSTOR.SYS