Leaked source code of windows server 2003
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.
 
 
 
 
 
 

299 lines
13 KiB

<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="irclass_files/filelist.xml">
<title>Irclass</title>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>90</w:Zoom>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Courier;
panose-1:2 7 4 9 2 2 5 2 4 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-format:other;
mso-font-pitch:fixed;
mso-font-signature:3 0 0 0 1 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:536871559 0 0 0 415 0;}
@font-face
{font-family:"MS Sans Serif";
panose-1:0 0 0 0 0 0 0 0 0 0;
mso-font-alt:"Times New Roman";
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:auto;
mso-font-signature:0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:black;}
h2
{color:black;}
h3
{color:black;}
h4
{color:black;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
p
{font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
color:black;}
pre
{margin-top:0in;
margin-bottom:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
color:black;}
span.SpellE
{mso-style-name:"";
mso-spl-e:yes;}
span.GramE
{mso-style-name:"";
mso-gram-e:yes;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:810489118;
mso-list-template-ids:-2052968106;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->
<meta name=Template content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white lang=EN-US link=blue vlink=purple style='tab-interval:.5in'
leftmargin=8>
<div class=Section1>
<h2><a name=MYSAMPLE><span style='font-family:Verdana'>Infrared (Network) Class
</span></a><span class=SpellE><span style='mso-bookmark:MYSAMPLE'><span
style='font-family:Verdana'>Coinstaller</span></span></span><span
style='mso-bookmark:MYSAMPLE'><span style='font-family:Verdana'> </span></span><span
style='font-family:Verdana'><o:p></o:p></span></h2>
<h3><span style='font-family:Verdana'>SUMMARY<o:p></o:p></span></h3>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Verdana'>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. <o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>BUILDING THE SAMPLE<o:p></o:p></span></h3>
<p><span style='font-size:10.0pt;font-family:Verdana'>To build Irclass.dll,
select either the checked or free DDK environment, change to the directory <span
class=SpellE>Irclass</span>, and type <b>BUILD</b>.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>This sample is included
as part of Windows® 2000 for installing and configuring serial infrared
devices. The corresponding .<span class=SpellE>inf</span> file, <span
class=SpellE>Netirsir.inf</span>, can be found in the \<span class=SpellE>WinNt\Inf</span>
directory after installation of the operating system.<o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>CODE TOUR<o:p></o:p></span></h3>
<h4><span style='font-family:Verdana'>File Manifest<o:p></o:p></span></h4>
<pre><o:p>&nbsp;</o:p></pre><pre><u><span style='font-family:Courier'>Files<span style='mso-spacerun:yes'>        </span>Description</span><o:p></o:p></u></pre><pre><span
class=GramE><span style='font-family:Courier'>Irclass.htm<span style='mso-spacerun:yes'>  </span>The</span></span><span
style='font-family:Courier'> documentation for this sample (this file)</span><u><o:p></o:p></u></pre><pre><span
style='font-family:Courier'>Sources<span style='mso-spacerun:yes'>      </span>The generic file for building the code sample<o:p></o:p></span></pre><pre><span
class=SpellE><span style='font-family:Courier'>Irclass.c</span></span><span
style='font-family:Courier'><span style='mso-spacerun:yes'>    </span>The only source code for this sample<o:p></o:p></span></pre><pre><span
class=SpellE><span style='font-family:Courier'>Irclass.h</span></span><span
style='font-family:Courier'><span style='mso-spacerun:yes'>    </span>Header for <span
class=SpellE>Irclass.c</span><o:p></o:p></span></pre><pre><span class=SpellE><span
class=GramE><span style='font-family:Courier'>Irclass.def</span></span></span><span
class=GramE><span style='font-family:Courier'><span style='mso-spacerun:yes'>  </span>DLL</span></span><span
style='font-family:Courier'> definition and exports<o:p></o:p></span></pre><pre><span
class=SpellE><span style='font-family:Courier'>Irclass.rc</span></span><span
style='font-family:Courier'><span style='mso-spacerun:yes'>   </span>Dialogs and string tables<o:p></o:p></span></pre><pre><span
class=SpellE><span style='font-family:Courier'>Irexe.ico</span></span><span
style='font-family:Courier'><span style='mso-spacerun:yes'>    </span>Icon for infrared devices<o:p></o:p></span></pre><pre><span
class=SpellE><span style='font-family:Courier'>Makefile</span></span><span
style='font-family:Courier'><span style='mso-spacerun:yes'>     </span>Standard <span
class=SpellE>makefile</span><o:p></o:p></span></pre><pre><span class=SpellE><span
style='font-family:Courier'>Resource.h</span></span><span style='font-family:
Courier'><span style='mso-spacerun:yes'>   </span>Microsoft Developer Studio generated include file<o:p></o:p></span></pre>
<h4><span style='font-family:Verdana'>Programming Tour</span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>This code tour focuses on
insertion of page into the install wizard.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>The major topics covered
in this tour include the following. <o:p></o:p></span></p>
<ul type=disc>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l0 level1 lfo1;tab-stops:list .5in'><span style='font-size:10.0pt;
font-family:Verdana'>Device <span class=SpellE>Coinstaller</span><o:p></o:p></span></li>
<li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
mso-list:l0 level1 lfo1;tab-stops:list .5in'><span style='font-size:10.0pt;
font-family:Verdana'>Property Page Provider<o:p></o:p></span></li>
</ul>
<h4><span style='font-size:10.0pt;font-family:Verdana'>Device <span
class=SpellE>Coinstaller</span><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>Device <span
class=SpellE>Coinstallers</span> are meant to handle special cases of
installation of which a generic class installer may not be aware.&nbsp;
Infrared devices are essentially network devices, and so the majority of the
installation is handled by the network class installer.&nbsp; 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 device <span
class=SpellE>coinstaller</span> mechanism is provided to extend the
functionality of a more generic class installer in these situations.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>A device <span
class=SpellE>coinstaller</span> is very similar to a regular class installer.&nbsp;
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.&nbsp; In this sample, <span
class=SpellE>IrSIRClassCoinstaller</span> is the main <span class=SpellE>coinstaller</span>
function, and it only handles two calls, DIF_INSTALLDEVICE and
DIF_NEWDEVICEWIZARD_FINISHINSTALL.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>DIF_INSTALLDEVICE is
handled by the <span class=SpellE>coinstaller</span> to allow it to check and
modify the UPPERFILTER and LOWERFILTER values for the <span class=SpellE>Irsir.sys</span>
driver. &nbsp; <span class=SpellE>Irsir.sys</span> may use <span class=SpellE>Serial.sys</span>
as a lower filter, and it sets this value here. &nbsp; It reads the <span
class=SpellE>LowerFilters</span> entry from <span class=SpellE>Netirsir.inf</span>,
and writes this value to the registry.&nbsp; It also clears the UPPERFILTER
value because <span class=SpellE>Serial.sys</span> may use <span class=SpellE>Serenum.sys</span>
as an upper filter, which is inappropriate for <span class=SpellE>Irsir.sys</span>.
&nbsp; DIF_INSTALLDEVICE is the most convenient place to do this because at
this point the driver has not yet been loaded.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>DIF_NEWDEVICEWIZARD_FINISHINSTALL
is the <span class=SpellE>coinstaller's</span> best opportunity to prompt for
special parameters for the driver.&nbsp; 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.&nbsp; This function allows us to insert a final
page into the wizard to query the user.&nbsp; The <span class=SpellE>PortSelectionDlg</span>
function handles inserting the page, which will subsequently be invoked by the
install mechanism.<o:p></o:p></span></p>
<h4><span style='font-size:10.0pt;font-family:Verdana'>Property Page Provider</span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>You should note that the
Property Page Provider and the Wizard page share a common message handling
function, <span class=SpellE>PortDlgProc</span>.&nbsp; Minor differences are
handled by the <span class=SpellE>FirstTimeInstall</span> flag which is set to
TRUE in the wizard page initialization code, and FALSE otherwise.&nbsp; At the
dialog completion, it calls <span class=SpellE>WriteRegistrySettings</span>,
which sets the flag DI_FLAGSEX_PROPCHANGE_PENDING. &nbsp; 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.<o:p></o:p></span></p>
<p align=center style='text-align:center'><a href="#top"><span
style='font-size:10.0pt;font-family:Verdana'>Top of page</span></a><span
style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=624
style='width:6.5in;mso-cellspacing:0in'>
<tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:1.5pt'>
<td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
<p class=MsoNormal><o:p>&nbsp;</o:p></p>
</td>
</tr>
</table>
<p><span style='font-size:7.5pt;font-family:"MS Sans Serif"'>© 1999 Microsoft
Corporation</span><span style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>
</div>
</body>
</html>