erwan2212 / windivert-fpc

freepascal unit and demo to use windivert
3 stars 2 forks source link

Support for 2.2.2? #1

Open CCRDude opened 1 year ago

CCRDude commented 1 year ago

Nice to see pascal headers for WinDivert! They were easy to use, thank you.

It would be great to see support for the latest version, 2.2.2, instead of the supplied 1.4.3, e.g. because it supports WinDivertShutdown, which would help to cleanly get out of a waiting WinDivertRecv call.

Simply using the new .dll/.sys files with the existing headers does not seem to work, probably some parameters have changed?

CCRDude commented 1 year ago

Update: Send and Recv indeed have a changed parameter order.

{$IFDEF WinDivert222}
function WinDivertSend(handle: THandle; pPacket: pointer; packetLen: uint; pSendLen: puint; pAddr: PWINDIVERT_ADDRESS): bool; stdcall; external 'windivert.dll';
function WinDivertRecv(Handle: THandle; pPacket: pointer; packetLen: uint; pRecvLen: puint; pAddr: PWINDIVERT_ADDRESS): bool; stdcall; external 'windivert.dll';
function WinDivertRecvEx(handle: THandle; pPacket: pointer; packetLen: uint; pRecvLen: puint; flags: uint64; pAddr: PWINDIVERT_ADDRESS; pAddrLen: puint; lpOverlapped: LPOVERLAPPED): bool; stdcall; external 'windivert.dll';
function WinDivertShutdown(handle: THandle; how: WINDIVERT_SHUTDOWN): bool; cdecl; external 'windivert.dll';
function WinDivertClose(handle: THandle): bool; cdecl; external 'windivert.dll';
{$ENDIF WinDivert222}