InsertStaticFilter

Since 3.6.1

Available since: Windows Packet Filter 3.6.1

The InsertStaticFilter function inserts a static filter rule at a specific zero-based index in the driver’s active static filter table. Existing rules at and after the specified position are shifted down by one slot.

Syntax

BOOL WINAPI InsertStaticFilter(
    _In_ HANDLE         hOpen,
    _Inout_ PSTATIC_FILTER pFilter,
    _In_ unsigned long  Position
);

Parameters

hOpen
[in] Opaque library-object handle returned by OpenFilterDriver.

pFilter
[in, out] Pointer to a STATIC_FILTER structure defining the filter criteria and action.

Position
[in] Zero-based index specifying where to insert the filter in the active table. If Position is 0, the filter is placed at the front. Use AddStaticFilterBack when an append is intended; the public user-mode SDK does not specify out-of-range insertion behavior.

Return Value

Returns TRUE if the filter was successfully inserted; otherwise returns FALSE.

Remarks

Internally, this function wraps the filter and target position into a STATIC_FILTER_WITH_POSITION structure and issues IOCTL_NDISRD_INSERT_FILTER_BY_INDEX to the driver.

See Also

AddStaticFilterFront, AddStaticFilterBack, RemoveStaticFilter, STATIC_FILTER_WITH_POSITION

WOW64: The native SDK converts nonzero adapter handles in the supplied filter or table in place before sending the request. Pass a copy if the original structure must be preserved.