Modifier

Partager via


PFLT_CONNECT_NOTIFY callback function (fltkernel.h)

FltMgr calls a minifilter's ConnectNotifyCallback callback function to notify the minifilter when a new connection to a communication port is being requested.

Syntax

PFLT_CONNECT_NOTIFY PfltConnectNotify;

NTSTATUS PfltConnectNotify(
  PFLT_PORT ClientPort,
  PVOID ServerPortCookie,
  PVOID ConnectionContext,
  ULONG SizeOfContext,
  PVOID *ConnectionPortCookie
)
{...}

Parameters

ClientPort

[in] Opaque, FltMgr-generated handle for the new client port that is being established between the user-mode application and the kernel-mode minifilter.

The minifilter must pass this handle as the ClientPort parameter to FltSendMessage when sending and replying to messages on this client port.

The minifilter must eventually call FltCloseClientPort to close this client port, typically from its DisconnectNotifyCallback routine.

ClientPort isn't the same as the ServerPort handle return byFltCreateCommunicationPort.

ServerPortCookie

[in] Pointer to context information defined by the minifilter. The minifilter can use this information to distinguish among multiple communication server ports that it might create. When the server port was created, the minifilter driver passed this context pointer as the ServerPortCookie parameter to FltCreateCommunicationPort.

ConnectionContext

[in] Context information pointer that the user-mode application passed in the lpContext parameter to FilterConnectCommunicationPort.

SizeOfContext

[in] Size, in bytes, of the buffer that ConnectionContext points to.

ConnectionPortCookie

[out] Pointer to the miniport's information that uniquely identifies this client port. The minifilter can use this cookie to identify the connection when FltMgr passes it in subsequent calls to MessageNotifyCallback and DisconnectNotifyCallback.

Return value

ConnectNotifyCallback returns STATUS_SUCCESS if the operation succeeds and the connection has been accepted. Otherwise, it returns an appropriate NTSTATUS value such as:

Return code Meaning
STATUS_INSUFFICIENT_RESOURCES There aren't enough resources to complete the operation.
STATUS_INVALID_PARAMETER One or more of the input parameters are invalid.

Remarks

FltMgr calls this routine whenever a user-mode application calls FilterConnectCommunicationPort to send a connection request to the minifilter driver.

The minifilter should perform any necessary validation of the connection attempt.

For more information, see Communication between user-mode and minifilters.

Requirements

Requirement Value
Header fltkernel.h
Library FltMgr.lib
DLL FltMgr.sys
IRQL PASSIVE_LEVEL

See also

FilterConnectCommunicationPort

FltCloseClientPort

FltCreateCommunicationPort

FltSendMessage

DisconnectNotifyCallback

MessageNotifyCallback