Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/169580

From BetaArchive Wiki

HOWTO: Install Networking Components Programmatically

Q169580



The information in this article applies to:


  • Microsoft Win32 Device Driver Kit (DDK) Windows 95





SUMMARY

Many cutting-edge software products require Internet or network access. Therefore, installation applications need to verify that critical networking components are installed, and possibly initiate installation of these components when necessary. Programmatic detection and installation of networking components can be accomplished using a 16-bit protected mode Setup API on Windows 95. This API is documented in DevInst.Doc in the Win95 DDK.



MORE INFORMATION

DevInst.doc, from the Windows 95 DDK, documents the Setup API itself and the parameters for each API call without illuminating any of the implementation details for installing a device. You can download a sample MFC application from the Microsoft Software Library or from the Microsoft OEM/IHV DDK home page at:

http://msdn.microsoft.com/support/

Follow the links to the WinDDK Samples page. The sample is a MSVC 1.52 MFC application. You should not try to install PCMCIA or PCI devices with this application. These devices are installed when they are inserted for the first time or during boot time. The sample makes use of DiCreateDevRegKey:


   RETERR DiCreateDevRegKey( LPDEVICEINFO lpdi,
                             LPHKEY       lphKey,
                             HINF         hInf,
                             LPCSTR       lpszInfSection,
                             int          iFlags ) 


Create a unique registry key under the class of the associated device.

It returns OK if it has been successful; otherwise, an ERR_DI_xxx error code will be returned. If the return is OK, the lphKey will point to a valid handle to the created key. It is the caller's responsibility to close the returned registry key.

lpdi


  • Pointer to a DEVICE_INFO structure for a device that is being installed.

lphKey


  • Pointer to receive the address of the created registry key handle.

hInf


  • Handle to an opened INF file. hInf and lpszInfSection are rarely used. These would be necessary only if some special information had to be added to the registry when the key is first created.

lpcInfSection


  • Section of the INF file to be executed using the newly-created registry key.

iFlags


  • Indicates which type of registry key to create:


DIREG_DEV
Create a hardware registry key for the device. This is a key that exists in the \\HKLM\\ENUM branch specified by lpdi->lpszRegSubkey. If lpdi->lpszRegSubkey is NULL, then the key will be created in \\HKLM\\ENUM\\ROOT\\lpdi->szClassName.

DIREG_DRV
Create a software, or driver, registry key for the device. This is a key that is in \\HKLM\\System\\CurrentControlSet\\Services\\Class\\ lpdi->szClassName.

The sample will accept several command line arguments:

Ipinst [-a[idstring]] [-<h|?>] [-f<logfile>] [-m[d|idstring]] [- p<COM1|COM2>] [-r] [-s] [-v]

-a[PnP ID String]

Install adapter. A PnP ID String can be specified. If no adapter is specified or detected, the user must select one.

-f<log file name>

Specify a log file. If the log file name is NULL, then the default is Ipdetect.txt.

-<h|?>

Display usage information.

-m[d|Modem PnP String|Unimodem ID String]

Install modem. A PnP ID or Unimodem String can be specified. If no modem is specified or detected, the Modem Wizard is invoked.

-p<COM1|COM2>

Attach modem to COM1 or COM2. The default is COM1. This is to be used with the 'm' option to attach the installed modem to the specified port. This is mainly for legacy modems with valid Unimodem ID's.

-r

Install remote networking. This includes RNA, Dial Up Adapter, and related RAS components.

-s

Show application. By default, the application runs hidden. The application will show up on the desktop only if the 's', 'h' or '?' options are used.

-v

Emit verbose messages to logfile. The contents of the logfile show up on the document client area when the application is visible.



REFERENCES

DDpr.Hlp, DevInst.Doc, Network.Doc

Additional query words:

Keywords : kbnetwork kbsetup kbAPI kbRAS kbSDKPlatform kbGrpDSNet
Issue type : kbhowto
Technology : kbAudDeveloper kbWin95search kbWinDDKSearch kbWin32sSearch kbWin32DDK95 kbWin32DDKSearch


Last Reviewed: November 11, 1999
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.