Frequently Asked Questions

Q. Can I modify a NDIS packet that I did not allocate myself?
 

A. No.

NDIS packet descriptors, buffer descriptors, chained virtual memory (VM) and OOB data that you did not allocate yourself must be considered to be logically read-only.

Some developers read the DDK documentation and misinterpret references to packet "ownership". For example, the DDK documentation for ProtocolReceivePackets includes this comment:

"The NDIS library maintains the reference count for such an indicated packet, and the protocol retains ownership of the packet until it has called NdisReturnPackets with that packet as many times as the value returned by its ProtocolReceivePacket function."

Here the term "ownership" does not infer "exclusive access" - and does not infer that you can modify the NDIS packet descriptor, buffer descriptor, VM or OOB data.

In fact, multiple protocols can concurrently have "ownership" of the same NDIS packet. If any one protocol modified a NDIS packet concurrently owned by other protocols, the resulting behavior would probably be unpredictable.

Similarly, NDIS packets passed to a miniport or IM driver SendPacketsHandler or SendHandler should be considered read-only. The VM associated with a NDIS packet being sent may very well be mapped versions of memory managed by the TCP/IP driver or a user mode application. If you modify a send packet's VM (that you did not allocate yourself) subsequent retries for reliable transmission pass the modified data instead of the data originally intended to be transmitted.

In other words: If you did not allocate the NDIS packet yourself, then you really cannot "guess" or "assume" what the effects of modifying the packet would be to the component that originally allocated the object.

 

Topic Status

January 3, 2003 Information posted.
 

PCAUSA Home · Privacy Statement · Products · Ordering · Support · Utilities · Resources
Mailing Lists  · PCAUSA Newsletter · PCAUSA Discussion List
Rawether for Windows, Rawether .NET, WinDis 32 and NDIS Press are trademarks of Printing Communications Assoc., Inc. (PCAUSA)
Microsoft, MS, Windows, Windows Vista, Windows 95, Windows 98, Windows Millennium, Windows 2000, and Win32 are registered trademarks and Visual C++ and Windows NT are trademarks of the Microsoft Corporation.
Copyright © 1996-2007 Printing Communications Assoc., Inc. (PCAUSA)
Last modified: January 20, 2007