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