Available since: Windows Packet Filter 3.6.1
The AddStaticFilterFront function inserts a static filter rule at the head (index 0) of the driver’s active static filter table at runtime. Because static filter rules are evaluated linearly from first to last, rules placed at the front take precedence over previously configured filters.
Syntax
BOOL WINAPI AddStaticFilterFront(
_In_ HANDLE hOpen,
_Inout_ PSTATIC_FILTER pFilter
);
Parameters
hOpen
[in] Opaque library-object handle returned by OpenFilterDriver.
pFilter
[in, out] Pointer to a STATIC_FILTER structure defining the packet matching criteria and filter action (e.g. FILTER_PACKET_PASS, FILTER_PACKET_DROP, FILTER_PACKET_REDIRECT, FILTER_PACKET_PASS_RDR, FILTER_PACKET_DROP_RDR).
Return Value
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. For a failed OS I/O request, call GetLastError() immediately for error information. Library prechecks can also return FALSE without setting a fresh last-error value.
Remarks
This function transmits the IOCTL_NDISRD_ADD_PACKET_FILTER_FRONT control code to ndisrd.sys. Unlike SetPacketFilterTable, which wipes and completely replaces the active filter table, AddStaticFilterFront adds an individual rule at the front without requiring the caller to submit a complete replacement table.
The method returns the result of the driver request. The public user-mode SDK does not specify cache invalidation timing when the filter list changes.
See Also
AddStaticFilterBack, InsertStaticFilter, RemoveStaticFilter, STATIC_FILTER, Managing Individual Static Filters
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.