SAMPLE: Programmatically Install Drivers for Non-PNP Modems on Windows 2000

Article translations Article translations
Article ID: 304294 - View products that this article applies to.
This article was previously published under Q304294
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SUMMARY

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).

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
Collapse this imageExpand this image
MdmInst.exe
Download Modem.exe now
Release Date: AUG-03-2001

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:
Collapse this tableExpand this table
FileDescription
Mdminst.cSource file
MakefileStandard Windows NT makefile
SourcesDependency and include file

Build the Sample

  1. Download and run Modem.exe to extract the files.
  2. 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
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\000n
“AttachedTo" = REG_SZ : COMx

where 000 represents the instance of a installed modem (for example, 0000,0001...) and n represents a number between 1 and 255.
The application then calls UpdateDriverForPlugAndPlayDevices() to attach a driver for the newly created devnode.

Properties

Article ID: 304294 - Last Review: February 27, 2014 - Revision: 4.3
APPLIES TO
  • Microsoft Win32 Device Driver Kit for Windows 2000, when used with:
    • Microsoft Windows 2000 Standard Edition
Keywords: 
kbnosurvey kbarchive kbfile KB304294

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com