コード例 #1
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
コード例 #2
0
ファイル: Device.cpp プロジェクト: OpenXT/xc-vusb
VOID
AcquireFdoLock(
    IN PUSB_FDO_CONTEXT fdoContext)
{
    PETHREAD caller = PsGetCurrentThread();
    if (!HTSASSERT(fdoContext->lockOwner != caller))
    {
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER,
            __FUNCTION__": Assertion failure lockowner %p != caller %p\n",
            fdoContext->lockOwner,
            caller);
    }
    WdfObjectAcquireLock(fdoContext->WdfDevice);
    if (!HTSASSERT(fdoContext->lockOwner == NULL))
    {
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER,
            __FUNCTION__": Assertion failure lockowner %p == NULL\n",
            fdoContext->lockOwner);
    }
    fdoContext->lockOwner = PsGetCurrentThread();
}
コード例 #3
0
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;
}
コード例 #4
0
CWdfObjectLock::CWdfObjectLock(WDFOBJECT obj):
	m_obj(obj)
{
	// Acquire a lock on the object
	WdfObjectAcquireLock(m_obj);
}