This article was previously published under Q304294
This article has been archived. It is offered "as is" and will no longer be updated.
The sample program that is provided through this article can be used to programmatically install a driver for a legacy nonplug-and-play modem on Windows 2000. This sample is a modified version of the "Install" sample included in the Windows 2000 DDK (Src\General\Setup\Install).
The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. Modem.exe contains the following files:
Standard Windows NT makefile
Dependency and include file
Build the Sample
Download and run Modem.exe to extract the files.
To build this sample, select the free or checked build environment and run the build from the directory where you have extracted the files in step 1. This sample links with Newdev.lib, which is present in the DDK library directories. Once built, this sample produces MdmInst.exe.NOTE: If the user requires a program that has no console window, the Sources file can be changed from "UMTYPE=console" to "UMTYPE=windows".
After the application validates the command line arguments, it uses the port name supplied by the user to call the PortExists() function. If the port name is not valid, the application exits. If the port name is valid, the application validates the .inf file and tries to see if the driver for the device that is being installed has already been installed. To do so, it checks whether a devnode for that device already exists. If so, the application updates the driver with the current supplied driver by using UpdateDriverForPlugAndPlayDevices(). If the devnode is not already present, the application calls InstallRootEnumeratedDriver(...), which creates a devnode and registers it. The application adds an ""AttachedTo" = COMx" entry for the port to which the modem is being attached, such as