Re: Question about modifing the NDIS packet?
From: William Ingle (williamingle_at_comcast.net)
Date: Mon, 05 Jul 2004 15:00:33 GMT
A complete answer to your question requires us to know the OS you are
targeting because there are some differences between win98/ME, Win2k, WinXP
In general you need to allocate your own buffers if you are re-trasmitting a
packet FROM a miniport BACK of the net. If your driver is an intermediate
driver and it merely modifies the packet on its way to the protocol driver
or to a miniport then you only need to allocate a new buffer if
1. you driver changes the length of the ndis packet buffer - here you
allocate the appropriate packet buffer, not the packet structure
2. your driver changes the length of the ip header or oob data - here you
allocate the data buffer
3. your driver is not a registered ndis driver. In general ndis doesn't
notify a miniport or protocol to release buffers until all consumers have
indicated they are done with it. But you would have to be a registered
consumer (i.e. a miniport, protocol or intermediate driver) so ndis knew you
were part of the data flow.
If you are merely querying the packet from ndis through IoCallDriver or
DeviceIoControl then ndis assumes you are done with it when you return.
Futhermore modifications you make to the ndis packet may or may not be
passed on to other ndis drivers. This is why you should register your
driver with ndis during initialization and support one of the ndis driver
This is a simplification because protocols often allocate data in their own
buffer pools and perform buffer integrity checks (like checking the internal
pointers of complex structures). Miniports often use memory on the card to
reduce the number of buffer copies. So if you are going to change some of
the internal pointers in the ndis packet structure you may want to create
your own copy if you can't re-assign the original pointer value when the
consumer returns. I haven't played with this in over a year so please
perform your own tests.
Have a great day
"Rajesh Gupta" <firstname.lastname@example.org> wrote in message
> Hi everyone,
> I am trying to modify the NDIS packet. Do i need to allocate new buffers?