Tech Support > Microsoft Windows > Drivers > Problems sending requests to IO targets in KMDF
Problems sending requests to IO targets in KMDF
Posted by Gary C on April 22nd, 2008


Hi,

I'm new to writing Windows drivers and already I've hit a brick wall with
what appears to be a fairly fundamental task - sending requests to a local IO
target.

I have an FDO in which I need to send requests to its local IO target, which
is a PDO created by the parent bus driver. When I call WdfRequestSend() the
driver crashes with an access violation.

The following is a code excerpt showing what I'm trying to do ...

status = WdfRequestRetrieveInputMemory (ioRequest, &inputMemory);

if (!NT_SUCCESS(status))
{
KdPrint(("Unable to retrieve input buffer for write request -
0x%x\n", status));
return status;
}

status = WdfIoTargetFormatRequestForIoctl
(ioTarget,
writeRequest,
IOCTL_MODULE_1_WRITE_DATA,
inputMemory,
NULL,
NULL,
NULL);


if (!NT_SUCCESS(status))
{
KdPrint(("Unable to format write request for I/O Target - 0x%x\n",
status));
return status;
}

WdfRequestSetCompletionRoutine (writeRequest,
ACMDrvEvtRequestWriteCompletion, NULL);

if (WdfRequestSend (writeRequest, ioTarget, WDF_NO_SEND_OPTIONS) == FALSE)
{
status = WdfRequestGetStatus(writeRequest);
KdPrint(("WdfRequestSend failed 0x%x\n",status));
return status;
}


In the code above, ioRequest is the request received by the driver,
writeRequest is a request created locally by the driver, ioTarget is the
driver's local I/O target.

Any ideas what I'm doing wrong?

I've tried various things:

1. Forwarding the received request directly to the IO target, by calling
WdfRequestFormatRequestUsingCurrentType() then WdfRequestSend() ...
driver crashes.
2. Calling WdfRequestChangeTarget() just before the send ... this returns a
STATUS_REQUEST_NOT_ACCEPTED code.
3. Creating a remote I/O target and using this to attempt to send the request
directly to the FDO at the top of the parent driver's stack ... again,
this
returns STATUS_REQUEST_NOT_ACCEPTED.

I'm stuck!

Any help or suggestions would be appreciated.

--
Gary C

Posted by Doron Holan [MSFT] on April 22nd, 2008


what is the output of !analyze -v when i crashes? does it crash in your
driver or the bus driver to which you are sending io?

--
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.


"Gary C" <GaryC@discussions.microsoft.com> wrote in message
news:91901241-99E4-4949-9CEE-1EA9865ECDDE@microsoft.com...

Posted by Gary C on April 23rd, 2008


OK, I've run !analyze -v ... from the output of that it seems that the crash
is occurring in the bus driver. This gives me a bit more of a lead to go on -
I'll check what's going on within the bus driver.

Thanks for the pointer ... I'll post further on the outcome of my
investigations.

--
Gary C


"Doron Holan [MSFT]" wrote: