Search code examples
ndis

How to prepend headers to a NetBuffer in NDIS 6?


We are upgrading our NDIS 5.1 Intermediate Miniport driver to NDIS 6.

We need to prepend some header information to a packet that is goind to be sent. In 5.1 we used NdisChainBufferAtFront().

We already did the entire kitchen to traverse and clone the entire NetBufferLists structure, we are down to preparing each cloned NetBuffer.

What is the correct way to prepend (means, at front!) a 22-byte header to a packet (NetBuffer) that is going to be sent? (We would prefer a method that avoids copying original MDL data)


Solution

  • You can use NdisRetreatNetBufferDataStart to add bytes for header information.

    read this link till remarks to know how its done. It will surely help:

    http://msdn.microsoft.com/en-in/library/windows/hardware/ff564527%28v=vs.85%29.aspx

    ps: you dont at all need to copy mdl