Why does NdisAllocatePacket fail unexpectedly on Windows 2000?

 

Knowledge Base ID

KB07130002
Category INFORMATION

Effected Product

Any NDIS Protocol Driver

Effected Versions

N/A
Effected Platforms Windows 2000

 

Symptoms

When a NDIS protocol driver built under the Windows NT 4.0 DDK is run on Windows 2000 calls to NdisAllocatePacket will eventually fail unexpectedly and prematurely.

Cause

Basically, prior to Windows 2000 Beta 3 RC1 the NdisFreePacket MACRO defined in the Windows NT 4.0 NDIS.H file was functionally identical to the NdisFreePacket function exported by the NDIS library. So, NdisAllocatePacket/NdisFreePacket worked correctly for NDIS protocol drivers, which use the MACRO.

The behavior changed with the final RTM Windows 2000. With the final Windows 2000 the NdisFreePacket MACRO from Windows NT 4.0 DDK *IS NOT* equivalent to the Windows 2000 NdisFreePacket function.

Calling the NdisFreePacket MACRO does not actually return the NDIS_PACKET to the free pool on Windows 2000. As a result, calls to NdisAllocatePacket will eventually fail prematurely.

Resolution

The most highly recommended solution to this problem is to build drivers intended for the Windows 2000 platform under the Windows 2000 DDK. This approach is required by Microsoft and is used by PCAUSA.

Do NOT use the Windows NT 4.0 DDK to build NDIS protocol drivers targeted for the Windows 2000 platform!!!

In you must use Windows NT4.0 DDK for your Windows 2000 protocol driver, you can add this fragment after #include NDIS.H but before any reference to NdisFreePacket:

#if defined(NdisFreePacket)
#undef NdisFreePacket

VOID
NdisFreePacket(
   IN PNDIS_PACKET Packet
   );

#endif

This forces use of the NdisFreePacket exported by the NDIS library instead of using the MACRO.

If you follow the route of using the Windows NT 4.0 DDK for your Windows 2000 NDIS protocol driver, then you will almost certainly encounter other problems similar to this one.

Apparently Microsoft has a Knowledge Base article on the same topic. See:

NdisFreePacket Macro Causes NDIS Protocol Drivers to Fail in Windows 2000

 

It is a shame that one can only find these KB articles after spending time debugging...

 

Status

January 11, 2001 Added comment about Microsoft KB Q247154
July 17, 2000, 2000 Information posted.

 

Comments

Please click the following link to send e-mail relating to this PCAUSA Knowledge Base topic:

<Send Mail To KB07130002 Technical Contact>

 

Keywords NDIS, NdisAllocatePacket
Created July 13, 2000
Last Reviewed January 11, 2001

 
 

PCAUSA Home · Privacy Statement · Products · Ordering · Support · Utilities · Resources
Mailing Lists  · PCAUSA Newsletter · PCAUSA Discussion List
 
Rawether for Windows and WinDis 32 are trademarks of Printing Communications Assoc., Inc. (PCAUSA)
Microsoft, MS, Windows, 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.
Send mail to webmaster@pcausa.com with questions or comments about this web site.
Copyright © 1996-2010 Printing Communications Assoc., Inc. (PCAUSA)
Last modified: February 04, 2010