Hi!
I’m seeing cases on WIndows 7 where NdisGetDataBuffer returns NULL
unexpectedly. I provide a storage buffer (DnsFrame) that should be large
enough to get the data I want (in this case, a DNS payload). I have also
advanced the ND (referenced by pNetBuffer) to be past the L3/L4 header.
Also, when I hit the assert for a NULL return, I’ve verified that the number
of bytes requested is much smaller than the size of the storage buffer.
Here’s my code:
numDnsBytes = NET_BUFFER_DATA_LENGTH(pNetBuffer);
//
// We should expect that we are getting a pointer within the net buffer
and
// that NDIS will not need to copy fragmented data into the DnsFrame
buffer
//
pDnsHdr = NdisGetDataBuffer(
pNetBuffer,
numDnsBytes,
DnsFrame, // uint8 array of 1500 bytes
2,
0
);
DBG_ASSERT(pDnsHdr != NULL);
Are there other reasons that NdisGetDataBuffer() would return NULL other
than those documented in the WDK? BTW, this code is executed for processing
of rx packets, which (for the most part) should be contained in on one mdl.
Thanks!