NTSTATUS
DeviceContext::CommandHardwareEvent(
    _In_ WDFREQUEST Request
    )
{
    TRACE_FUNCTION_ENTRY(LEVEL_VERBOSE);
    NTSTATUS status;

    NFC_CX_HOST_ACTION* param;
    status = WdfRequestRetrieveInputBuffer(Request, sizeof(*param), (void**)&param, nullptr);
    if (!NT_SUCCESS(status))
    {
        TRACE_LINE(LEVEL_ERROR, "WdfRequestRetrieveInputMemory failed. %!STATUS!", status);
        return status;
    }

    // The device's WDF lock provides a convenient way to serialize with the power event callbacks.
    WdfObjectAcquireLock(_Device);

    NFC_CX_HARDWARE_EVENT eventArgs = {};
    eventArgs.HostAction = *param;
    eventArgs.HardwareStatus = STATUS_SUCCESS;

    status = NfcCxHardwareEvent(_Device, &eventArgs);
    if (!NT_SUCCESS(status))
    {
        TRACE_LINE(LEVEL_ERROR, "NfcCxHardwareEvent (%d) failed. %!STATUS!", *param, status);
        WdfObjectReleaseLock(_Device);
        return status;
    }

    WdfRequestComplete(Request, STATUS_SUCCESS);

    WdfObjectReleaseLock(_Device);
    TRACE_FUNCTION_SUCCESS(LEVEL_VERBOSE);
    return STATUS_SUCCESS;
}
示例#2
0
文件: Device.cpp 项目: OpenXT/xc-vusb
VOID
ReleaseFdoLock(
    IN PUSB_FDO_CONTEXT fdoContext)
{
    PETHREAD caller = PsGetCurrentThread();
    if (!HTSASSERT(caller == fdoContext->lockOwner))
    {
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER,
            __FUNCTION__": Assertion failure caller %p == lockOwner %p\n",
            caller,
            fdoContext->lockOwner);
    }
    fdoContext->lockOwner = NULL;
    WdfObjectReleaseLock(fdoContext->WdfDevice);
}
示例#3
0
文件: Interrupt.c 项目: uri247/kmdf
///////////////////////////////////////////////////////////////////////////////
// Deferred procedure call (DPC) event callback function 
// for postprocessing after interrupt on IRQL_DISPATCH_LEVEL
///////////////////////////////////////////////////////////////////////////////
VOID
SmplInterruptEvtDpc(
    IN WDFINTERRUPT Interrupt,
    IN WDFOBJECT AssociatedObject
    )
{
    WDFDEVICE Device = WdfInterruptGetDevice(Interrupt);
    PDEVICE_CONTEXT pSmplDeviceContext = DeviceGetContext(Device);

    DbgPrintEx(DPFLTR_IHVDRIVER_ID, 1234,"SmplInterruptEvtDpc >>\n");

    WdfObjectAcquireLock(pSmplDeviceContext->Queue);

    while(TRUE == SmplIoQueueRequestTryComplete(pSmplDeviceContext));

    WdfObjectReleaseLock(pSmplDeviceContext->Queue);

} // end SmplInterruptEvtDpc
示例#4
0
CWdfObjectLock::~CWdfObjectLock(void)
{
	// Logical inverse:  Release the already-acquired lock
	WdfObjectReleaseLock(m_obj);
}