Notify Object Sample (PASSTHRU)

[This is preliminary documentation and subject to change.]

SUMMARY

This sample demonstrates how to write a notify object for installing and configuring an NDIS intermediate driver (Passthru) that implements a 1:1 relationship between lower and upper bindings. Note that writing a notify object is optional, and is not required for proper installation of such a driver.

A notify object should only be used if one needs to provide custom property sheet pages or if one needs non-default binding behavior. Note that in almost all cases, the default binding behavior afforded through the .inf is sufficient. The .inf supplied has ample documentation lines that clearly specify the parts of the .inf general to any networking component and the parts that are essential for installing an IM driver.

The notify object code shows how to:

·  Write a basic notify object to configure an IM driver.

·  Defer registry operations until the "ApplyRegistryChanges" method is called, so that a "Cancel" operation will not result in unnecessary changes to the registry.

·  Receive notifications when other components are added, removed, bound, or unbound.

·  Provide a custom property sheet page that will be used by the Connections UI to configure your component.

 

Windows 2000 Specific:

 

Notify object is required to support the CopyINF directive on Windows 2000 as it is not natively supported by the system. The notify object in its CPassthru::Initialize handler, during installation, gets virtual adapter INF file and copies it to the system INF directory by using SetupCopyOEMInf function. On Windows XP the notify object is optional because the CopyINF directive is natively supported and used by the installer to copy the miniport INF file referenced in the netsf_m.inf file to the system INF directory.

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

Related samples

1.      The Passthru driver (built as Passthru.sys) at network\ndis\Passthru. The INFs for the driver are located along with the driver sources.

2.      The Snetcfg utility (built as snetcfg.exe) at network\config\netcfg.

BUILDING THE SAMPLE

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

INSTALLING THE SAMPLE

Following are installation instructions for the Passthru sample through the connection folder.

1. Create a local directory on the machine (for instance, d:\sample).

2. Copy Passthru.dll, Netsf.inf, Netsf_m.inf, and Passthru.sys to the directory.

3. Open the connection folder.

4. Raise the properties for a LAN connection, click the Install button, select Service, and click Add.

5. Click Have Disk, and then specify the path to the local directory you just created.

6. Select Passthru Driver, and then click OK in the Select Network Service dialog box.

An alternate way is to install the Passthru driver using Snetcfg.exe. To install, type snetcfg -l d:\sample\netsf.inf -c s -i ms_passthru. To uninstall, type snetcfg -u ms_passthru

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
notifyob.htm   The documentation for this sample
Pch.h          Pre-compiled header file
Resource.h     The resource header
passthru.cpp   Notify object implementation for the Passthru IM driver
passthru.def   The sample's def file
passthru.h     The header file for passthru.cpp
passthru.rc    The resource file
passthru.rgs   Script-based registry 
passthrn.idl   The notify object's .idl file
setupdi.cpp    Functions to copy the miniport INF file to the system.
 
 
 

Top of page

 

© Microsoft Corporation 1999