MUX.DLL – Sample Notify Object

[This is preliminary documentation and subject to change.]

SUMMARY

MUX Notify Object

This sample demonstrates how to write a notify object for installing and configuring an NDIS MUX intermediate miniport (IM) driver that implements a N:1 relationship between upper and lower bindings i.e. it creates multiple virtual network devices on top of a single lower adapter. Protocols bind to these virtual adapters as if they are real adapters. Examples of Intermediate Miniport drivers that can use this type of notify objects are Virtual LAN (VLAN) drivers.

Operation

During installation, the notify object performs the following operations.

·         It creates one virtual adapter for each physical adapter the MUX protocol edge binds to.

·         It disables the bindings of other protocols such as TCP/IP to physical adapters if it has been compiled with DISABLE_PROTOCOLS_TO_PHYSICAL defined in the Sources file. This is the most commonly desired behavior for N:1 MUX drivers.

·         It disables the bindings of the protocol edge of the MUX IM driver with all its virtual adapters.

The notify object provides a custom property page for the MUX IM driver. The custom property page allows the user to add one or more virtual adapters on top of a physical adapter or delete an existing virtual adapter.

When the MUX IM driver is uninstalled, binding is disabled, or the user deletes all the virtual adapters on top of a physical adapter, the notify object restores the bindings of other protocols to the physical adapter if it has been compiled with the preprocessor flag DISABLE_PROTOCOLS_TO_PHYSICAL defined in the Sources file.

Windows 2000 Specific

During the installation, the notify object copies the INF file for the virtual adapter from the installation media to the system INF directory by using the SetupCopyOEMInf function. This is done because Windows 2000 does not support the CopyINF directive to copy INF files from another INF file.

BUILDING THE SAMPLE

To build the sample, type build -ceZ. This command produces the binary mux.dll, which is the sample notify object.

The sample compiles properly for 32-bit and 64-bit, and builds properly with Microsoft® Visual C® 6.0.

Preprocessor Flags:

DISABLE_PROTOCOLS_TO_PHYSICAL

When this flag is defined in the Sources file, the notify object disables the bindings of other protocols such as TCP/IP to the physical adapters during the installation. When all the virtual adapters are removed either through the custom property page or as a result of uninstalling the MUX driver, the notify object re-enables those bindings.

PASSTHRU_NOTIFY

This is defined to allow the MUX driver to be used in a passthru mode. When this flag is defined, the notify object:

1)     Creates only one virtual miniport for every physical adapter the MUX protocol edge binds to.

2)     Disables the property page to prevent adding of additional virtual miniports.

3)     Stores the device name of the virtual adapter in REG_SZ registry value under HKLM\System\CurrentControlSet\Services\muxp\Parameters\Adapters\{PhysicalAdaptersInstanceGuid}\UpperBindings, because there is one to one binding. In the MUX mode (when this flag is not defined), the notify object stores the device name in a REG_MULTI_SZ registry value as there could be more than one virtual miniports.

You can also use this notify object with the Passthru driver by doing the following:

1)     Change the protocol name in file src\network\ndis\passthru\passthru.c from PASSTHRU to MUXP.

2)     Change the driver name from Passthru to MUX in the sources file.

3)     Rebuild the driver to obtain a mux.sys driver binary.

4)     Build the MUX notify object with PASSTHRU_NOTIFY defined.

5)     Use the MUX inf files, muxp.inf and mux_mp.inf, to install the driver and dll.

The benefit of using techniques in the MUX notify object for a 1:1 intermediate driver (e.g. Passthru) is to be able to exercise higher level of control over the bindings of MUX with other components in the system, which is not possible with the IM filter driver.

CUSTOM_EVENTS

When this macro is defined, the notify object shows how to send custom events to the MUX IM driver when a virtual miniport is added or removed.

CODE TOUR

File Manifest

File           Description
Dllmain.cpp    File containing implementations of DLL entry point and exports. 
Implinc.cpp    File including source code for ATL utilities.
mux.htm        The documentation for this sample.
Pch.h          Pre-compiled header file.
Resource.h     The resource header.
notify.cpp     Notify object implementation.
virtual.cpp    Virtual adapter class implementation.
adapter.cpp    Physical adapter class implementation.
common.cpp     Global functions, variables and macro definitions.
mux.def        The sample's linker definition file.
mux.h          The header file for mux.cpp.
virtual.h      Virtual adapter class declaration.
Adapter.h      Physical adapter class declaration.
notify.rc      The resource file.
notify.rgs     Script-based registry.
notifyn.idl    The notify object's .idl file.
setupdi.cpp    Functions to copy the miniport INF file to the system.
 

Top of page

 

© Microsoft Corporation 2001