Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
I want to send UDP packet from my filter driver, and use the following code:
NET_BUFFER_LIST_POOL_PARAMETERS PoolParameters; NdisZeroMemory(&PoolParameters, sizeof(NET_BUFFER_LIST_POOL_PARAMETERS)); PoolParameters.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; PoolParameters.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; PoolParameters.Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; PoolParameters.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT; PoolParameters.ContextSize = 0; PoolParameters.DataSize = 0x100; // My packet size PoolParameters.fAllocateNetBuffer = TRUE; PoolParameters.PoolTag = 'KFLT'; NDIS_HANDLE hPoolHandle = NdisAllocateNetBufferListPool(g_NdisFilterDeviceHandle, &PoolParameters); PNET_BUFFER_LIST pMyNbl = NdisAllocateNetBufferAndNetBufferList(hPoolHandle, 0, 0, NULL, 0, 0);
NdisAllocateNetBufferListPool returns valid handle, but NdisAllocateNetBufferAndNetBufferList returns NULL, and outputs the debug string:
NdisAllocateNetBufferAndNetBufferList: Pool <address> wrong pool type
Can you explain what's wrong?
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Writing WDF Drivers | 7 Dec 2020 | LIVE ONLINE |
Internals & Software Drivers | 25 Jan 2021 | LIVE ONLINE |
Developing Minifilters | 8 March 2021 | LIVE ONLINE |
Comments
I know LESS than nothing about NDIS anymore. But I can read the documentation:
Peter
Peter Viscarola
OSR
@OSRDrivers
Good point, but a bit below, opposite thing is written:
However, in this case, NdisAllocateNetBufferList should be used, that makes sense, since NET_BUFFER is already pre-allocated by NdisAllocateNetBufferListPool.
Now it works , thanks again, Peter!
That’s why I’m here: To work miracles. By reading the MSDN pages. ;-)
Peter
Peter Viscarola
OSR
@OSRDrivers