Microsoft KB Archive/266403

= How To Enable and Use NDIS Verifier =

Article ID: 266403

Article Last Modified on 1/17/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Professional Edition

-



This article was previously published under Q266403



SUMMARY
Network Driver Interface Specification (NDIS) Verifier is a feature included in the checked build of the Ndis.sys file in the next version of the Microsoft Windows 2000 operating system, which is code named Windows &quot;Whistler.&quot; NDIS Verifier verifies that an NDIS driver is not making invalid or obsolete function calls. NDIS Verifier also checks the validity of values that are passed to certain functions.

This article describes how you can enable and use NDIS Verifier. It also lists the driver types that can be set in NDIS_GFLAG_BREAK_ON_WARNING to cause a warning message to display.



How to Enable and Use the Verifier
To enable and use the NDIS Verifier, perform the following steps:  Install a checked build of the Ndis.sys file. The checked build of Windows Whistler will be provided as part of the MSDN Professional Subscription. Please view the following Web site on the Microsoft Developer Network (MSDN) for more information:

http://msdn2.microsoft.com/en-us/subscriptions/default.aspx

NOTE: It is not necessary to install an entire checked build system to enable NDIS Verifier. You can copy the checked build of the Ndis.sys file from the Windows Whistler CD-ROM to the %SystemRoot%\System32\Drivers folder. However, because Windows File Protection protects against the replacement of any system files, you must start the system in safe mode. Enable the network adapter driver to be verified in the input/output (I/O) manager's Driver Verifier.For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

244617 How to Use Driver Verifier to Troubleshoot Device Drivers in Windows 2000

 To enable NDIS Verifier, add a Flags registry value to the following key:

'''HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NDIS\Parameter

&quot;Flags&quot;:dword:0x00000FFF'''

 Microsoft recommends that you enable the NDIS.sys driver along with the network adapter driver in the Driver Verifier. The NDIS.sys driver performs most of the work on behalf of the network adapter driver.

The values for the Flags are as follows:


 * 1) define NDIS_GFLAG_INIT_TIME                        0x00000001
 * 2) define NDIS_GFLAG_TRACK_PKTS                       0x00000002
 * 3) define NDIS_GFLAG_INJECT_ALLOCATION_FAILURE        0x00000004
 * 4) define NDIS_GFLAG_SPECIAL_POOL_ALLOCATION          0x00000008
 * 5) define NDIS_GFLAG_DONT_VERIFY                      0x00000100
 * 6) define NDIS_GFLAG_BREAK_ON_WARNING                 0x00000200


 * 1) define NDIS_GFLAG_WARNING_LEVEL_MASK               0x00000030

When you set these bits, you can control the behavior of NDIS Verifier. For example, if you set the bit in the Flag to NDIS_GFLAG_BREAK_ON_WARNING, you will experience a break in the debugger on every warning.
 * 1) define NDIS_GFLAG_WARN_LEVEL_0                     0x00000000
 * 2) define NDIS_GFLAG_WARN_LEVEL_1                     0x00000010
 * 3) define NDIS_GFLAG_WARN_LEVEL_2                     0x00000020
 * 4) define NDIS_GFLAG_WARN_LEVEL_3                     0x00000030

The various warning level bits let you specify how strictly you want the NDIS to verify. The higher you set the level, the stricter the NDIS Verifier will be.
 * Warning level 0 breaks on outright bugs only. Examples: Indicate packets before you set the filter, or do not register a ShutdownHandler.
 * Warning level 1 means that you are calling an API that will be removed in the next release of Windows 2000. Example: NdisOverrideBusNumber.
 * Warning level 2 warns you about things that you should not do. Example: Use NdisReadConfiguration instead of NdisMQueryAdapterResources to get the standard resources.
 * Warning level 3 warns you when you call obsolete APIs. Example: Use all the immediate functions such as NdisImmediateRead/WritePciSlotInformation.

Under normal circumstances, you should set the level to &quot;Warning level 3&quot; to detect everything.

What Does NDIS Verifier Detect?
The NDIS Verifier currently DebugPrints a warning message and breaks into the debugger if the NDIS_GFLAG_BREAK_ON_WARNING is set for the following cases:  Drivers that use reserved keywords instead of NdisMQueryAdapterResources to get assigned resources. Drivers that use the following APIs: <ul> NdisImmediateRead/WritePciSlotInformation: Use instead NdisRead/WritePciSlotInformation.</li> NdisImmediateRead/WritePortUchar/Ushort/Ulong: Register the I/O port range and use instead NdisRead/WritePortUchar/Ushort/Ulong.</li> NdisImmediateRead/NdisWriteSharedMemory: Map the I/O space and do a direct read/write.</li> NdisRead/WritePciSlotInformation with SlotNumber of anything but 0 (zero).</li> NdisMPciAssignResources: Use instead NdisMQueryAdapterResources.</li> NdisAllocateMemory: Use instead NdisAllocateMemoryWithTag.</li> NdisQuerymapRegisterCount: Obsolete API.For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

253233 INFO: NdisQueryMapRegisterCount Is Obsolete on Windows 2000

</li></ul> </li> Miniport drivers that specify NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT/NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT in NdisMSetAttributesEx. The NDIS Verifier catches only hardware drivers that use I/O resources. Intermediate drivers and NDISWAN drivers can specify these flags.</li> Drivers that indicate packets (such as NdisMIndicateReceivePacket) before you set the filter.</li> Drivers that do not register AdapterShutdownHandler.</li></ul>

<div class="references_section">