回调驱动程序必须打开一个过滤器引擎的会话才能执行管理任务,例如向过滤器引擎添加过滤器。 插件驱动程序通过调用 FwpmEngineOpen0 函数打开与筛选器引擎的会话。 例如:
HANDLE engineHandle;
NTSTATUS status;
// Open a session to the filter engine
status =
FwpmEngineOpen0(
NULL, // The filter engine on the local system
RPC_C_AUTHN_WINNT, // Use the Windows authentication service
NULL, // Use the calling thread's credentials
NULL, // There are no session-specific parameters
&engineHandle // Pointer to a variable to receive the handle
);
在回调驱动程序成功打开筛选器引擎的会话后,它可以使用返回的句柄调用其他 Windows 筛选平台管理功能。