I have a filter driver working and filtering IP packets.
These packets are depicted in instances of a struct, based on the IP filter example in the DDK and contain other stucts defined in ntddk.h
I want to return instances of these structs back to user mode app via buffered IO.
I can return simple structs back to user mode successfully, but wondered about thinks like linked lists (LIST_ENTRY) etc defined in ntddk.h
Can this be done? Is there an api in user mode to walk and manage the linked list?
Or am I in cloud cookoo land?
For into, this is the struct I want to return to user mode
typedef struct TL_INSPECT_PENDED_PACKET_
{
LIST_ENTRY listEntry;
ADDRESS_FAMILY addressFamily;
TL_INSPECT_PACKET_TYPE type;
FWP_DIRECTION direction;
UINT32 authConnectDecision;
HANDLE completionContext;
//
// Common fields for inbound and outbound traffic.
//
UINT8 protocol;
NET_BUFFER_LIST\* netBufferList;
COMPARTMENT_ID compartmentId;
union
{
FWP_BYTE_ARRAY16 localAddr;
UINT32 ipv4LocalAddr;
};
union
{
UINT16 localPort;
UINT16 icmpType;
};
union
{
UINT16 remotePort;
UINT16 icmpCode;
};
//
// Data fields for outbound packet re-injection.
//
UINT64 endpointHandle;
union
{
FWP_BYTE_ARRAY16 remoteAddr;
UINT32 ipv4RemoteAddr;
};
SCOPE_ID remoteScopeId;
WSACMSGHDR\* controlData;
ULONG controlDataLength;
//
// Data fields for inbound packet re-injection.
//
BOOLEAN ipSecProtected;
ULONG nblOffset;
UINT32 ipHeaderSize;
UINT32 transportHeaderSize;
IF_INDEX interfaceIndex;
IF_INDEX subInterfaceIndex;
} TL_INSPECT_PENDED_PACKET;