Microsoft KB Archive/266403

From BetaArchive Wiki

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 "Whistler." 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.

MORE INFORMATION

How to Enable and Use the Verifier

To enable and use the NDIS Verifier, perform the following steps:

  1. 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: 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.
  2. 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

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

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NDIS\Parameter
    "Flags":dword:0x00000FFF

  4. 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:

#define NDIS_GFLAG_INIT_TIME                         0x00000001
#define NDIS_GFLAG_TRACK_PKTS                        0x00000002
#define NDIS_GFLAG_INJECT_ALLOCATION_FAILURE         0x00000004
#define NDIS_GFLAG_SPECIAL_POOL_ALLOCATION           0x00000008
#define NDIS_GFLAG_DONT_VERIFY                       0x00000100
#define NDIS_GFLAG_BREAK_ON_WARNING                  0x00000200

#define NDIS_GFLAG_WARNING_LEVEL_MASK                0x00000030

#define NDIS_GFLAG_WARN_LEVEL_0                      0x00000000
#define NDIS_GFLAG_WARN_LEVEL_1                      0x00000010
#define NDIS_GFLAG_WARN_LEVEL_2                      0x00000020
#define NDIS_GFLAG_WARN_LEVEL_3                      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.

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 "Warning level 3" 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:
    • NdisImmediateRead/WritePciSlotInformation: Use instead NdisRead/WritePciSlotInformation.
    • NdisImmediateRead/WritePortUchar/Ushort/Ulong: Register the I/O port range and use instead NdisRead/WritePortUchar/Ushort/Ulong.
    • NdisImmediateRead/NdisWriteSharedMemory: Map the I/O space and do a direct read/write.
    • NdisRead/WritePciSlotInformation with SlotNumber of anything but 0 (zero).
    • NdisMPciAssignResources: Use instead NdisMQueryAdapterResources.
    • NdisAllocateMemory: Use instead NdisAllocateMemoryWithTag.
    • 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

  • 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.
  • Drivers that indicate packets (such as NdisMIndicateReceivePacket) before you set the filter.
  • Drivers that do not register AdapterShutdownHandler.


REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

248413 INFO: NDIS Kernel Debugger Extensions


Keywords: kbhowto kbndis KB266403