EVT_SERCX_FILEOPEN callback function (sercx.h)

The EvtSerCxFileOpen event callback function notifies the serial controller driver that a client opened a file handle on the serial controller device and that a file object has been created to represent the device.

Syntax

EVT_SERCX_FILEOPEN EvtSercxFileopen;

NTSTATUS EvtSercxFileopen(
  [in] WDFDEVICE Device
)
{...}

Parameters

[in] Device

A WDFDEVICE handle to the framework device object that represents the serial controller.

Return value

The EvtSerCxFileOpen function returns STATUS_SUCCESS if the call is successful. Otherwise, it returns an appropriate error status code.

Remarks

The serial framework extension (SerCx) calls this function to prepare the serial controller hardware to accept requests for I/O operations. This function should configure the controller in a state in which it is ready to receive and transmit data. If interrupts are required, this function should enable interrupts. In addition, this function should allocate any memory that is required only during the lifetime of the file object. For example, this function can allocate an interrupt data buffer.

To register an EvtSerCxFileOpen callback function, the driver must call the SerCxInitialize method.

For more information, see Framework File Objects.

Examples

The function type for this callback is declared in Sercx.h, as follows.

typedef NTSTATUS
  EVT_SERCX_FILEOPEN(
    __in WDFDEVICE Device
    );

To define an EvtSerCxFileOpen callback function that is named MyEvtSerCxFileOpen, you must first provide a function declaration that Static Driver Verifier (SDV) and other verification tools require, as follows.

EVT_SERCX_FILEOPEN MyEvtSerCxFileOpen;

Then, implement your callback function as follows.

NTSTATUS
  MyEvtSerCxFileOpen(
    __in WDFDEVICE Device
    )
{ ... }

For more information about SDV requirements for function declarations, see Declaring Functions Using Function Role Types for KMDF Drivers.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 8.
Target Platform Desktop
Header sercx.h
IRQL Called at IRQL <= DISPATCH_LEVEL

See also

SerCxInitialize