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.
 
 
 
 
 
 

233 lines
12 KiB

<html 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=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./diagfilt_files/filelist.xml">
<title>WMIFilt</title>
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"MS Sans Serif";
panose-1:0 0 0 0 0 0 0 0 0 0;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:3 0 0 0 1 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;}
/* 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";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;
text-underline:single;}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
pre
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Courier New";}
@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:458034950;
mso-list-type:hybrid;
mso-list-template-ids:-1909678538 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
<div class=Section1>
<h2><span style='font-family:Verdana'>DiagFilt<o:p></o:p></span></h2>
<p><span style='font-size:10.0pt;font-family:Arial;color:red'>[This is
preliminary documentation and subject to change.]</span><span style='font-size:
10.0pt;font-family:Verdana'><o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>SUMMARY<o:p></o:p></span></h3>
<p><span style='font-size:10.0pt;font-family:Verdana'>This is a sample Plug and
Play filter driver that provides WMI data blocks and methods to the CDM
provider. This allows the CDM provider to expose diagnostic tests via the Common
Diagnostic Model. Typically, driver writers will copy the sample code into
their own driver and make any minor modifications so that the WMI data blocks
are always available when the driver is loaded. Alternatively, WmiSamp can be
left as a filter driver if WMI data blocks should only be made available when
the filter driver is loaded. Or it can be included in a different driver.<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'>Follow these steps to
WMI-enable a driver with the sample code.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>1. Determine what
diagnostics needs to be provided.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>2. Write one or more
Managed Object Format (.mof) files that describe the WDM data blocks and
methods for those diagnostics. In doing this, the driver writer will need to
run the GUIDgen tool to create globally unique GUIDs that are assigned to the
data blocks. GUIDgen <i>must</i> be run so that no two data block formats have
the same GUID. Compile the .mof files into .bmf files by using the Mofcomp
tool. The resulting .bmf files are platform-independent binaries, and can be
reported as resources attached to the .sys file or as one or more instances of
a data block queried by WMI. Note that one of the byproducts of generating the
binary .mof file is a header file that contains GUID and structure definitions
for the data blocks. Use this header because it will always be up to date with
the .mof. <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>3. Write the Managed
Object Format (.mof) file containing the CDM classes that refererence the WDM
shadow classes described by the MOF written in step 1.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>4. Build the
WMIGUIDREGINFO structure with the GUIDs for the data blocks defined in the WDM
.mof file. If the device should be notified when to start and stop collection
of a data block, the WMIREG_FLAG_EXPENSIVE flag should be set for the data
block in the WMIGUIDREGINFO structure.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>5. Implement the six WMI
function callback routines and reference them in a WMILIB_CONTEXT structure.
Note that some of them are optional.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>6. Modify the sources and
makefile.inc files so that the .mof file is compiled into the .bmf, .x, .vbs
and .h file. <o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>RUNNING THE SAMPLE<o:p></o:p></span></h3>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
font-family:Verdana'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>Build
and install the CDMProv DDK sample on target machine<o:p></o:p></span></p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
font-family:Verdana'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>On
target machine change the value Provider class qualifier from CdmProv to the
name of your provider. Next run <b><i>mofcomp sample.mof</i></b>. This will
include the CDM mof into the WMI schema.<o:p></o:p></span></p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
font-family:Verdana'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>Install
the DiagFilt sample driver as a filter driver on your device stack<o:p></o:p></span></p>
<p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
font-family:Verdana'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>Modify
listem.vbs to contain the correct CIM RelPath that your device maps to. Run <b><i>start
/wait listem.vbs</i></b> to invoke your driver<o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>RESOURCES<o:p></o:p></span></h3>
<p><span style='font-size:10.0pt;font-family:Verdana'>Please see the DDK CDM
Provider sample and the Kernel-Mode driver section of DDK documentation for
more information on WMI. <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><u>File<span style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Description<o:p></o:p></u></pre><pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre><pre>Filter.c<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>NULL filter driver (boilerplate code)</pre><pre>Filter.h<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Header file for the filter driver</pre><pre>Filter.mof <span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp; </span>Managed Object Format file that contains descriptions of the data blocks events and methods implemented by the driver</pre><pre>Filter.rc<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Resource file containing version information</pre><pre>Inf.txt<span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Sections of the .inf file to change</pre><pre>Makefile<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Standard Windows NT makefile</pre><pre>Pnp.c<span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Plug and Play routines</pre><pre>Power.c<span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Power Management routines</pre><pre>Sources<span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Sources for build</pre><pre>Util.c<span
style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>NULL filter driver&#8212;boilerplate code</pre><pre>Wmisamp.c<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Sample device driver that shows various mechanisms for using WMI in a kernel-mode driver<span
style='mso-tab-count:1'> </span></pre><pre>Sample.Mof<span style='mso-tab-count:
1'>&nbsp;&nbsp;&nbsp;&nbsp; </span>MOF for CDM classes associated with this driver</pre><pre>Listem.Vbs<span
style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp; </span>VBS script that is useful for testing CDM provider and driver implementation</pre>
<p style='margin:0in;margin-bottom:.0001pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:"Courier New"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p align=center style='margin:0in;margin-bottom:.0001pt;text-align:center;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:"Courier New"'><a
href="#top"><span style='font-family:Verdana'>Top of page</span></a></span><span
style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:"Courier New";
mso-bidi-font-family:"Courier New"'> <o:p></o:p></span></p>
<pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre>
<table border=0 cellspacing=0 cellpadding=0 width=624 style='width:6.5in;
mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in'>
<tr style='height:1.5pt'>
<td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</td>
</tr>
</table>
<pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre><pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre>
<p style='margin:0in;margin-bottom:.0001pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:7.5pt;font-family:"MS Sans Serif";mso-fareast-font-family:
"Courier New";mso-bidi-font-family:"Courier New"'>&copy; 2000 Microsoft Corporation</span><span
style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:"Courier New";
mso-bidi-font-family:"Courier New"'> <o:p></o:p></span></p>
</div>
</body>
</html>