Source code of Windows XP (NT5)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> <META NAME="Generator" CONTENT="Microsoft Word 97"> <TITLE>Irclass</TITLE> <META NAME="Template" CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot"> </HEAD> <BODY TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff" leftmargin="8"> <FONT FACE="Verdana"><H2><A NAME="MYSAMPLE">Infrared (Network) Class Coinstaller </A> </H2>
<h3>SUMMARY</h3> </font><font FACE="Verdana" SIZE="2"> This sample demonstrates the handling of DIF_ calls during device installation and the insertion of a property page into the install wizard and into the device properties. </p>
<h3>BUILDING THE SAMPLE</h3> </font><font FACE="Verdana" SIZE="2">
<p>To build Irclass.dll, select either the checked or free DDK environment, change to the directory Irclass, and type <B>BUILD</B>.</p>
<p>This sample is included as part of Windows® 2000 for installing and configuring serial infrared devices. The corresponding .inf file, Netirsir.inf, can be found in the \WinNt\Inf directory after installation of the operating system.</p> </font><font FACE="Verdana">
<h3>CODE TOUR</h3>
<h4>File Manifest</h4> </font>
<pre> <u><font face="Courier">Files Description</font> </u><font face="Courier">Irclass.htm The documentation for this sample (this file)</font><u> </u><font FACE="Courier">Sources The generic file for building the code sample Irclass.c The only source code for this sample Irclass.h Header for Irclass.c Irclass.def DLL definition and exports Irclass.rc Dialogs and string tables Irexe.ico Icon for infrared devices Makefile Standard makefile Resource.h Microsoft Developer Studio generated include file </pre> </font>
<h4><font face="Verdana">Programming Tour</font></h4> <font face="Verdana" size="2">
<p>This code tour focuses on insertion of page into the install wizard.</p>
<p>The major topics covered in this tour include the following.
<ul> <li>Coinstaller</font><font FACE="Verdana" SIZE="2"></li> <li>Property Page Provider</font><font FACE="Verdana" SIZE="2"></li> </ul>
<h4><font face="Verdana" size="2">Coinstaller</h4> </font>
<p><font face="Verdana" size="2">Coinstallers are meant to handle special cases of installation of which a generic class installer may not be aware. Infrared devices are essentially network devices, and so the majority of the installation is handled by the network class installer. There are details about an infrared device of which the network class installer is unaware, such as the selection of the serial port the device is attached to, and the coinstaller mechanism is provided to extend the functionality of a more generic class installer in these situations.</font></p>
<p><font face="Verdana" size="2">A coinstaller is very similar to a regular class installer. It receives each DIF_* call before the regular class installer does, but it only needs to provide handlers for those DIF_* calls where it desires to modify or extend the behavior or the regular class installer. In this sample, IrSIRClassCoinstaller is the main coinstaller function, and it only handles two calls, DIF_INSTALLDEVICE and DIF_NEWDEVICEWIZARD_FINISHINSTALL.</font></p>
<p><font face="Verdana" size="2">DIF_INSTALLDEVICE is handled by the coinstaller to allow it to check and modify the UPPERFILTER and LOWERFILTER values for the Irsir.sys driver. Irsir.sys may use Serial.sys as a lower filter, and it sets this value here. It reads the LowerFilters entry from Netirsir.inf, and writes this value to the registry. It also clears the UPPERFILTER value because Serial.sys may use Serenum.sys as an upper filter, which is inappropriate for Irsir.sys. DIF_INSTALLDEVICE is the most convenient place to do this because at this point the driver has not yet been loaded.</font></p>
<p><font face="Verdana" size="2">DIF_NEWDEVICEWIZARD_FINISHINSTALL is the coinstaller's best opportunity to prompt for special parameters for the driver. The driver may have already been started at this point, so you should ensure that your driver does not crash if any parameter is not set yet. This function allows us to insert a final page into the wizard to query the user. The PortSelectionDlg function handles inserting the page, which will subsequently be invoked by the install mechanism.</font></p>
<h4><font face="Verdana" size="2">Property Page Provider</font></h4>
<p><font face="Verdana" size="2">You should note that the Property Page Provider and the Wizard page share a common message handling function, PortDlgProc. Minor differences are handled by the FirstTimeInstall flag which is set to TRUE in the wizard page initialization code, and FALSE otherwise. At the dialog completion, it calls WriteRegistrySettings, which sets the flag </font>DI_FLAGSEX_PROPCHANGE_PENDING. This is the cue to the OS that a driver's settings have changed, and the driver needs to either reload them or be restarted depending on its capabilities.</p>
</FONT><P ALIGN="CENTER"><A HREF="#top"><FONT FACE="Verdana" SIZE=2>Top of page</FONT></A><FONT FACE="Verdana" SIZE=2> </P></FONT> <TABLE CELLSPACING=0 BORDER=0 WIDTH=624> <TR><TD VALIGN="MIDDLE" BGCOLOR="#00ffff" HEIGHT=2> <P></TD> </TR> </TABLE>
<FONT FACE="MS Sans Serif" SIZE=1><P>© 1999 Microsoft Corporation</FONT><FONT FACE="Verdana" SIZE=2> </P></FONT></BODY> </HTML>
|