Reply To: winpkf: stop starting packet reading in tunnel mode

Home Forums Discussions Support Portal winpkf: stop starting packet reading in tunnel mode Reply To: winpkf: stop starting packet reading in tunnel mode

#5673

Vadim Smirnov
Moderator

Please pay attention to the routine below (it is available in PassThru and PacketSniffer samples), which actually stops WinpkFillter operations over the network interface and releases resources:

void ReleaseInterface()
{
// This function releases packets in the adapter queue and stops listening the interface
ADAPTER_MODE Mode;

Mode.dwFlags = 0;
Mode.hAdapterHandle = (HANDLE)AdList.m_nAdapterHandle[iIndex];

// Set NULL event to release previously set event object
api.SetPacketEvent(AdList.m_nAdapterHandle[iIndex], NULL);

// Close Event
if (hEvent)
CloseHandle ( hEvent );

// Set default adapter mode
api.SetAdapterMode(&Mode);

// Empty adapter packets queue
api.FlushAdapterPacketQueue (AdList.m_nAdapterHandle[iIndex]);
}