Network Architecture in Windows NT-based Operating Systems

May 2002

Contents

Introduction

This document describes the
Microsoft Windows NT/2000/XP/.NET network subsystem architecture. It is intended to be used in the process of writing windows network drivers. I'm really confused by the installation and binding process of Network components (particularly IM drivers), so this is also an attempt for me to get my facts straight. Don't take what you read here as gospel, and please feel free to point out problems or improvements.

The Windows networking subsystem is composed of a set of kernel-mode drivers, a set of user-mode services and DLLs, and their configuration data stored in the registry. Most of this document is devoted to understanding the registry-based configuration details.

Drivers

There are lots of drivers that make up the networking subsystem. In general, they are divided into two classes: These drivers are all kernel-mode .sys files that communicate with one another via either callback functions or IRPs. Like all drivers, they have entries in the Service Control Manager (SCM) database found at HKLM\System\CurrentControlSet\Services in the registry. Most of the driver files themselves are located in the standard place, %SystemRoot%\System32\Drivers.

NDIS

NDIS (Network Device Interface Specification). The NDIS subsystem forms most of the nuts and bolts of the networking on the computer. NDIS is responsible for getting packets from hardware up to TDI drivers for handing to apps. It's big and complicated.

NDIS is primarily implemented via callback functions. There is a main subsystem driver (ndis.sys), which sets up the framework for packet handling, and there are drivers that are basically just libraries of callbacks that the NDIS system calls when certain things happen.

The NDIS subsystem takes care of much of what network drivers used to have to do. For example, ndis.sys provides the ISR for all incoming packets. It also provides commonly-used data structures such as packets, and takes care of driver-to-driver communication across a well-defined interface.

There are several kinds of NDIS drivers:

These components associate themselves with one another via "binding". The binding process informs the NDIS framework about the order in which packets are to be passed from one driver to the next.

The Registry

All NDIS configuration is contained in the registry. The data is contained in several places:

INF files

All of the madness that we just went through in the registry happened because INF files told it to. In particular, network INF files are interpreted in combination between the Network Device Installer and Device Manager. Device Manager does the generic stuff like PnP identification and driver selection, and it looks like it also handles the basics of file copying, service creation, registry modifications, etc. Then, at some point after Device Manager is done, the Network Device Installer is invoked and takes another pass through the system at configuration of the network components. Here, bindings are processed and components are logically linked together to form the networking subsystem.

As can be imagined, INFs are very flexible, but they're not very well documented. The best source of documentation of the INF format is in the DDK (with overlapping but slightly different info in Win9x and WinNt versions). The platform SDK also has some INF-related info. Beyond that, the best references are sample INFs provided in the DDK and third-party INFs from other vendors.

Reference

GUIDs
[1] NDIS Intermediate drivers are one binary with two parts. The "lower edge" looks like a protocol (like TCP/IP or something). The "upper edge" looks like a miniport. This binary is installed with a pair of INFs. The weird part is that one INF is a NetService INF and the other is a Net inf. The NetService is the one that gets fed to the network control panel since the Net component is hidden by its INF. However, there is not an entry in the NetService GIUD. Marking the driver as filter does weird things to the NDI.