Hi,
I have a design where i have a Multifunction driver which creates 2 PDOs and is a function driver for USB device(Parents FDO). I have 2 fucntion driver(child FDO) which sits on top of these PDOs created. One is a UMDF Driver and another is KMDF function driver.
The requirment is requests should flow from both the child FDO and should come to parent FDO and then should be sent to device.
I have 2 approach to do this.
- I have created a queue and associated it with PDO
status = WdfFdoAddStaticChild(Device, hChild);
if (!NT_SUCCESS(status))
{
goto Cleanup;
}
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE( &ioQueueConfig,
WdfIoQueueDispatchParallel);
ioQueueConfig.EvtIoDeviceControl = Someother1;
ioQueueConfig.DefaultQueue = TRUE;
ioQueueConfig.AllowZeroLengthRequests = TRUE;
status = WdfIoQueueCreate( hChild,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
WDF_NO_HANDLE);
if (!NT_SUCCESS(status))
{
KdPrint((“WdfIoQueueCreate failed %!STATUS!\n”, status));
return status;
}
2. I have created a io target and have stored it in PDO’s extension so that Fucntion driver can retrieve it andcan send the data. This is working fine.
parentWdmDeviceObject =
WdfDeviceWdmGetDeviceObject(WdfPdoGetParent(hChild));
WdfDeviceWdmGetDeviceObject(hChild)->StackSize +=
parentWdmDeviceObject->StackSize;
status =
WdfIoTargetCreate(hChild,
WDF_NO_OBJECT_ATTRIBUTES,
&pdoData->IoTargetForParentFdo);
if (!NT_SUCCESS (status))
{
goto Cleanup;
}
WDF_IO_TARGET_OPEN_PARAMS_INIT_EXISTING_DEVICE(&openParams,
parentWdmDeviceObject );
status =
WdfIoTargetOpen(pdoData->IoTargetForParentFdo, &openParams);
if (!NT_SUCCESS (status))
{
goto Cleanup;
}
The UMDF Driver is written in such a way that it gets the default io target (IWDFDevice::GetDefaultIoTarget) and creates and
its sends the IOCTL request (IWDFIoRequest::Send). The send function crashes saying (CWudfDeviceStack::Forward):pHostFileObj
should not be NULL.
Now i have the following questions
-
Is this approach correct, I should get the request to my PDO if i do the send and my “Someother1( )” should be called.
-
Which of the above two approach is correct and do we have any API to convert IOTarget object created in KMDF to UMDF IOtarget.
-
Is there any other setting ,may be in INF or anything that i should do to make this work.
Regards,
Sup