⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flush.cpp

📁 这个是串口驱动程序开发包
💻 CPP
字号:
/*++
Abstract:

    This module contains the code that is very specific to flush
    operations in the serial driver
--*/

#include "precomp.h"

NTSTATUS KdSerialDevice::DispatchFlushBuffers(IN KdIrp &Irp)
/*++

Routine Description:

    This is the dispatch routine for flush.  Flushing works by placing
    this request in the write queue.  When this request reaches the
    front of the write queue we simply complete it since this implies
    that all previous writes have completed.

Arguments:

    Irp - Pointer to the IRP for the current request

Return Value:

    Could return status success, cancelled, or pending.
--*/

{
    DebugDump(DBG_DIAG6, ("Dispatch entry for: %x\n",Irp) );
    Irp.Information() = 0L;

    if (CompleteIfError(Irp) != STATUS_SUCCESS)
        return STATUS_CANCELLED;

    return StartOrQueue(
               Irp,
               &m_WriteQueue,
               &m_CurrentWriteIrp,
               StartFlush
               );
}

NTSTATUS KdSerialDevice::StartFlush()
/*++

Routine Description:

    This routine is called if there were no writes in the queue.
    The flush became the current write because there was nothing
    in the queue.  Note however that does not mean there is
    nothing in the queue now!  So, we will start off the write
    that might follow us.

Return Value:

    This will always return STATUS_SUCCESS.

--*/
{
    KdIrp NewIrp;

    m_CurrentWriteIrp.Status() = STATUS_SUCCESS;

    // The following call will actually complete the flush.
    GetNextWrite(
        &m_CurrentWriteIrp,
        &m_WriteQueue,
        &NewIrp,
        TRUE
        );

    if (NewIrp) 
    {
        ASSERT(NewIrp == m_CurrentWriteIrp);
        StartWrite();
    }
    return STATUS_SUCCESS;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -