Exemplo n.º 1
0
VOID
OsrFxEvtIoStop(
    _In_ WDFQUEUE         Queue,
    _In_ WDFREQUEST       Request,
    _In_ ULONG            ActionFlags
    )
/*++

Routine Description:

    This callback is invoked on every inflight request when the device
    is suspended or removed. Since our inflight read and write requests
    are actually pending in the target device, we will just acknowledge
    its presence. Until we acknowledge, complete, or requeue the requests
    framework will wait before allowing the device suspend or remove to
    proceeed. When the underlying USB stack gets the request to suspend or
    remove, it will fail all the pending requests.

Arguments:

Return Value:
    None

--*/
{
    UNREFERENCED_PARAMETER(Queue);
    UNREFERENCED_PARAMETER(ActionFlags);

    if (ActionFlags &  WdfRequestStopActionSuspend ) {
        WdfRequestStopAcknowledge(Request, FALSE); // Don't requeue
    } else if(ActionFlags &  WdfRequestStopActionPurge) {
        WdfRequestCancelSentRequest(Request);
    }
    return;
}
Exemplo n.º 2
0
VOID
BthEchoRepeatReaderCancel(
    _In_ PBTHECHO_REPEAT_READER RepeatReader    
    )
/*++

Description:

    This routine cancels repeat reader
    but it does not wait for repeat reader to stop.

    This wait must be performed separately.

Arguments:

    RepeatReader - Repeat reader to be cancelled

--*/
{
    //
    // Signal that we are transitioning to stopped state
    // so that we don't resubmit pending read
    //
    
    InterlockedIncrement(&RepeatReader->Stopping);

    //
    // Cancel the pending read.
    //
    // If BthEchoRepeatReaderSubmit misses the setting of Stopping
    // flag, cancel would cause the request to complete quickly and
    // repeat reader will subsequently be stopped.
    //
    WdfRequestCancelSentRequest(RepeatReader->RequestPendingRead);    
}
Exemplo n.º 3
0
/*++
Routine Description:

This callback is invoked on every inflight request when the device
is suspended or removed. Since our inflight read and write requests
are actually pending in the target device, we will just acknowledge
its presence. Until we acknowledge, complete, or requeue the requests
framework will wait before allowing the device suspend or remove to
proceed. When the underlying USB stack gets the request to suspend or
remove, it will fail all the pending requests.

Arguments:

Return Value:
None
--*/
VOID PSDrvEvtIoStop(__in WDFQUEUE Queue, __in WDFREQUEST Request, __in ULONG ActionFlags)
{
	PREQUEST_CONTEXT reqContext;

	UNREFERENCED_PARAMETER(Queue);

	reqContext=GetRequestContext(Request);

	if (ActionFlags & WdfRequestStopActionSuspend ) {
		WdfRequestStopAcknowledge(Request, FALSE); // Don't requeue
	} else if(ActionFlags & WdfRequestStopActionPurge) {
		WdfRequestCancelSentRequest(Request);
	}
	return;
}
Exemplo n.º 4
0
/* EvtIoStop
Invoked for every inflight pipe write request.  The callback executes when:
1) libusbK will stop the queue because of queue policy changes.
2) The system requests stand-by
3) The device is removed
*/
VOID Queue_OnStop(
    __in WDFQUEUE Queue,
    __in WDFREQUEST Request,
    __in ULONG ActionFlags)
{
	PQUEUE_CONTEXT queueContext;
	PREQUEST_CONTEXT requestContext;

	if (Request == NULL || Queue == NULL)
	{
		USBERRN("Invalid wdf object.");
		return;
	}
	if ((queueContext = GetQueueContext(Queue)) == NULL)
	{
		USBERRN("Invalid queue context.");
		return;
	}
	if ((requestContext = GetRequestContext(Request)) == NULL)
	{
		USBERRN("Invalid request context.");
		return;
	}

	// None of the libusbK transfer functions set EvtRequestCancel, hence this should never happen.
	if (ActionFlags & WdfRequestStopRequestCancelable)
	{
		USBERRN("WdfRequestStopRequestCancelable! pipeID=%02Xh", queueContext->Info.EndpointAddress);
		WdfVerifierDbgBreakPoint();
		return;
	}

	if (ActionFlags & WdfRequestStopActionSuspend)
	{

		USBDBGN("StopAcknowledge for ActionSuspend. pipeID=%02Xh request=%p timeout=%d", 
			queueContext->Info.EndpointAddress, Request, requestContext->Timeout);

		WdfRequestStopAcknowledge(Request, FALSE);
	}
	else if(ActionFlags & WdfRequestStopActionPurge)
	{
		USBDBGN("CancelSentRequest for ActionPurge. pipeID=%02Xh request=%p timeout=%d", 
				queueContext->Info.EndpointAddress, Request, requestContext->Timeout);

		WdfRequestCancelSentRequest(Request);
	}
}