Share via


IOCTL_SERIAL_PURGE (Compact 2013)

3/26/2014

This I/O control message discards characters from the output or input buffer of a specified communications resource. It can also terminate pending read or write operations on the resource. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to the device
    DWORD dwIoControlCode,    // use IOCTL_ IOCTL_SERIAL_PURGE
    LPVOID lpInBuffer,        // pointer to input buffer
    DWORD nInBufferSize,      // input buffer size
    LPVOID lpOutBuffer,       // pointer to output buffer
    DWORD nOutBufferSize,     // output buffer size
    LPDWORD lpBytesReturned,  // number of bytes returned
    OVERLAPPED lpOverlapped   // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device. To obtain a device handle, call COM_Open.
  • dwIoControlCode
    [in] Control code for the operation. Use IOCTL_SERIAL_PURGE for this operation.
  • lpInBuffer
    [in] Pointer to a DWORD variable containing the action.

    The following table shows the flags that this DWORD variable can contain.

    Flag

    Description

    PURGE_TXABORT

    Terminates all outstanding write operations and returns immediately, even if the write operations have not been completed.

    PURGE_RXABORT

    Terminates all outstanding read operations and returns immediately, even if the read operations have not been completed.

    PURGE_TXCLEAR

    Clears the output buffer if the driver has one.

    PURGE_RXCLEAR

    Clears the input buffer if the driver has one.

  • nInBufferSize
    Set to sizeof(DWORD).
  • lpOutBuffer
    Ignored.
  • nOutBufferSize
    Ignored.
  • lpBytesReturned
    Ignored.
  • lpOverlapped
    Ignored.

Return Values

Returns TRUE if successful; otherwise, returns FALSE.

Remarks

To get extended error information, call GetLastError. GetLastError may return other standard error messages as appropriate.

Requirements

Header

pegdser.h

See Also

Reference

Serial Port Driver IOCTLs
COM_IOControl
COM_Open
DeviceIoControl