locked
Queue callback gets hangs RRS feed

  • Question

  • Hi all,

    i am trying to send the request from one driver to another driver using wdfrequestsend in asyn format, below is my code snifset

    NTSTATUS
    CaifMuxEvtDeviceAdd(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit)
    {

    ........code

      //To Create Remote IO target
     status = WdfIoTargetCreate(device,
          &objAttributes,
          &ioTarget);
     if(!NT_SUCCESS(status)) {
      MUXDBG(("\nRFM WdfIoTargetCreate Failed 0x%0x\n",status));
      return (status);
     }

     WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(&openParams,
           (PUNICODE_STRING)&remoteviceName,
           STANDARD_RIGHTS_ALL);

     status = WdfIoTargetOpen(ioTarget,
           &openParams);
     if(!NT_SUCCESS(status)) {
      MUXDBG(("\nRFM WdfIoTargetOpen Failed 0x%0x\n",status));
      WdfObjectDelete(ioTarget);
      return (status);
     }

    ..........create queue

    }

    VOID
    MuxEvtWrite(WDFQUEUE  Queue, WDFREQUEST  Request, size_t  Length)
    {
     NTSTATUS status;
     WDFREQUEST localRequest;
     PCAIFMUX_DEVICE_CONTEXT devContext;
     WDFMEMORY inBuffer;
     WDF_OBJECT_ATTRIBUTES reqAttributes;


     UNREFERENCED_PARAMETER(Length);

        devContext = CaifMuxGetContextFromDevice(
                                    WdfIoQueueGetDevice(Queue) );


     status = WdfRequestRetrieveInputMemory(Request, &inBuffer);
     if(!NT_SUCCESS(status))
     {
      MUXDBGERR(("\n MUX WdfRequestRetrieveInputBuffer Failed 0x%0x\n",status));
      WdfRequestCompleteWithInformation(Request, status, 0);
      return;
     }
     WDF_OBJECT_ATTRIBUTES_INIT(&reqAttributes);
     reqAttributes.ParentObject = devContext->fTarget;
     status = WdfRequestCreate(&reqAttributes, devContext->fTarget, &localRequest);
     if(!NT_SUCCESS(status)) {
      MUXDBGERR(("\n MUX WdfRequestCreate failed 0x%0x\n",status));
     }

     status = WdfIoTargetFormatRequestForWrite(devContext->fTarget,localRequest, inBuffer, NULL, NULL);
     if(!NT_SUCCESS(status)) {
      MUXDBGERR(("\n MUX WdfIoTargetFormatRequestForWrite failed 0x%0x\n",status));
     }


     WdfRequestSetCompletionRoutine(localRequest, EvtMuxWriteCompletionRoutine, devContext);

     if(!WdfRequestSend(localRequest, devContext->fTarget, WDF_NO_SEND_OPTIONS)) {
      MUXDBGERR(("\n MUX WdfRequestSend failed\n"));
      //To Get the status
      status = WdfRequestGetStatus(localRequest);
      if(!NT_SUCCESS(status)) {
       MUXDBGERR(("\n MUX WdfRequestGetStatus failed 0x%0x\n",status));
      }
      MUXDBG(("\n WdfRequestComplete start\n"));
      WdfRequestComplete(localRequest, status);
      MUXDBG(("\n WdfRequestComplete End\n"));
     }

    }


    VOID
    EvtMuxWriteCompletionRoutine(
        IN WDFREQUEST                  Request,
        IN WDFIOTARGET                 Target,
        PWDF_REQUEST_COMPLETION_PARAMS CompletionParams,
        IN WDFCONTEXT                  Context
        )
    {
     UNREFERENCED_PARAMETER(Request);
     UNREFERENCED_PARAMETER(Target);
     UNREFERENCED_PARAMETER(CompletionParams);
     UNREFERENCED_PARAMETER(Context);
     WdfObjectDelete(Request);
    }

    after the callback funtion called EvtMuxWriteCompletionRoutine and i am calling wdfobject(request) after this point system will hang

    Tuesday, March 6, 2012 11:17 AM

Answers

  • attach a debugger and see what is going on. perhaps you are stuck in a breakpoint. have you enabled kmdf verifier? that will probably help you figure out what is going wrong. you are also not completing the Request passed to MuxEvtWrite when you are in the completion routine, perhaps that is your hang (if it is a sequential queue, it won't present the next request until the current is completed).

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, March 6, 2012 5:13 PM