Problems sending requests to IO targets in KMDF

Tech-Archive recommends: Speed Up your PC by fixing your registry



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
.



Relevant Pages

  • Re: Problems sending requests to IO targets in KMDF
    ... does it crash in your driver or the bus driver to which you are sending io? ... I have an FDO in which I need to send requests to its local IO target, ... When I call WdfRequestSend() the ... In the code above, ioRequest is the request received by the driver, ...
    (microsoft.public.development.device.drivers)
  • 2.6.0-test7: suspend to disk: no mouse or sound after suspend
    ... Using Gentoo with kernel 2.6.0-test7. ... Sound, no output after suspend. ... completing PM request, suspend ... registered new driver usbfs ...
    (Linux-Kernel)
  • [git pull] IDE updates #1
    ... which there is a better driver available. ... Use special driver requests for handling IDE settings. ... * Generate a new packet command request in front of the request queue, ... unsigned int alignment; ...
    (Linux-Kernel)
  • [Q] Bio traversal trouble?
    ... unable to handle kernel paging request at virtual address 8c1d2071 ... Since the last time this driver was posted it changed considerably and as one of the chances it's now requesting just one hardware sector at a time from the drive as requesting multiple didn't actually work -- I seemed to have fouled up earlier tests somehow. ... I'd also simply like to understand it, so this is doing a manual bio traversal, requesting frames from the hardware as it goes along. ...
    (Linux-Kernel)
  • Re: Problem with UMDF driver and disable/enable
    ... I am able to get the OnCleanup callback in my driver in this case. ... IoTarget 00286F68, Request 002871F8 ... has lpcmsg 0x893B38E8 ...
    (microsoft.public.development.device.drivers)