FilterConnectCommunicationPort function

Download EaseFilter Filter Driver SDK Setup File
Download EaseFilter Filter Driver SDK Zip File

FilterConnectCommunicationPort opens a new connection to a communication server port that is created by a file system minifilter.


HRESULT FilterConnectCommunicationPort(
  LPCWSTR               lpPortName,
  DWORD                 dwOptions,
  LPCVOID               lpContext,
  WORD                  wSizeOfContext,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  HANDLE                *hPort



Pointer to a NULL-terminated wide-character string containing the fully qualified name of the communication server port (for example, L"\MyFilterPort").


Connection options for the communication port. Prior to Windows 8.1, this value is set to 0.

Value Meaning
The handle returned in hPort is for synchronous I/O. This flag is available starting with Windows 8.1.


Pointer to caller-supplied context information to be passed to the kernel-mode minifilter's connect notification routine. (See the ConnectNotifyCallback parameter in the reference page for FltCreateCommunicationPort.) This parameter is optional and can be NULL.


Size, in bytes, of the structure that the lpContext parameter points to. If the value of lpContext is non-NULL, this parameter must be nonzero. If lpContext is NULL, this parameter must be zero.


Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. For more information about the SECURITY_ATTRIBUTES structure, see the Microsoft Windows SDK documentation. This parameter is optional and can be NULL. If this parameter is NULL, the handle cannot be inherited.


Pointer to a caller-allocated variable that receives a handle for the newly created connection port if the call to FilterConnectCommunicationPort succeeds; otherwise, it receives INVALID_HANDLE_VALUE.

Return value

FilterConnectCommunicationPort returns S_OK if successful. Otherwise, it returns an error value.


FilterConnectCommunicationPort opens a connection to a minifilter's communication server port on behalf of a user-mode application. The application uses the resulting connection port handle to communicate with the minifilter.

After it successfully calls FilterConnectCommunicationPort, the application can send messages to the minifilter through the connection port by calling FilterSendMessage. It can also receive and reply to messages from the minifilter by calling FilterGetMessage and FilterReplyMessage, respectively. The connection port handle returned in the hPort parameter is passed as the first parameter to FilterSendMessageFilterGetMessage, and FilterReplyMessage.

Any handle that is obtained from FilterConnectCommunicationPort must eventually be released by calling CloseHandle.


Target Platform Universal
Header fltuser.h (include Fltuser.h)
Library FltLib.lib
DLL FltLib.dll