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

  1. <html xmlns:o="urn:schemas-microsoft-com:office:office"
  2. xmlns:w="urn:schemas-microsoft-com:office:word"
  3. xmlns="http://www.w3.org/TR/REC-html40">
  4. <head>
  5. <meta http-equiv=Content-Type content="text/html; charset=us-ascii">
  6. <meta name=ProgId content=Word.Document>
  7. <meta name=Generator content="Microsoft Word 9">
  8. <meta name=Originator content="Microsoft Word 9">
  9. <link rel=File-List href="./diagfilt_files/filelist.xml">
  10. <title>WMIFilt</title>
  11. <style>
  12. <!--
  13. /* Font Definitions */
  14. @font-face
  15. {font-family:"MS Sans Serif";
  16. panose-1:0 0 0 0 0 0 0 0 0 0;
  17. mso-font-charset:0;
  18. mso-generic-font-family:swiss;
  19. mso-font-format:other;
  20. mso-font-pitch:variable;
  21. mso-font-signature:3 0 0 0 1 0;}
  22. @font-face
  23. {font-family:Verdana;
  24. panose-1:2 11 6 4 3 5 4 4 2 4;
  25. mso-font-charset:0;
  26. mso-generic-font-family:swiss;
  27. mso-font-pitch:variable;
  28. mso-font-signature:536871559 0 0 0 415 0;}
  29. /* Style Definitions */
  30. p.MsoNormal, li.MsoNormal, div.MsoNormal
  31. {mso-style-parent:"";
  32. margin:0in;
  33. margin-bottom:.0001pt;
  34. mso-pagination:widow-orphan;
  35. font-size:12.0pt;
  36. font-family:"Times New Roman";
  37. mso-fareast-font-family:"Times New Roman";}
  38. a:link, span.MsoHyperlink
  39. {color:blue;
  40. text-decoration:underline;
  41. text-underline:single;}
  42. a:visited, span.MsoHyperlinkFollowed
  43. {color:blue;
  44. text-decoration:underline;
  45. text-underline:single;}
  46. p
  47. {margin-right:0in;
  48. mso-margin-top-alt:auto;
  49. mso-margin-bottom-alt:auto;
  50. margin-left:0in;
  51. mso-pagination:widow-orphan;
  52. font-size:12.0pt;
  53. font-family:"Times New Roman";
  54. mso-fareast-font-family:"Times New Roman";}
  55. pre
  56. {margin:0in;
  57. margin-bottom:.0001pt;
  58. mso-pagination:widow-orphan;
  59. 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;
  60. font-size:10.0pt;
  61. font-family:"Courier New";
  62. mso-fareast-font-family:"Courier New";}
  63. @page Section1
  64. {size:8.5in 11.0in;
  65. margin:1.0in 1.25in 1.0in 1.25in;
  66. mso-header-margin:.5in;
  67. mso-footer-margin:.5in;
  68. mso-paper-source:0;}
  69. div.Section1
  70. {page:Section1;}
  71. /* List Definitions */
  72. @list l0
  73. {mso-list-id:458034950;
  74. mso-list-type:hybrid;
  75. mso-list-template-ids:-1909678538 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
  76. ol
  77. {margin-bottom:0in;}
  78. ul
  79. {margin-bottom:0in;}
  80. -->
  81. </style>
  82. </head>
  83. <body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
  84. <div class=Section1>
  85. <h2><span style='font-family:Verdana'>DiagFilt<o:p></o:p></span></h2>
  86. <p><span style='font-size:10.0pt;font-family:Arial;color:red'>[This is
  87. preliminary documentation and subject to change.]</span><span style='font-size:
  88. 10.0pt;font-family:Verdana'><o:p></o:p></span></p>
  89. <h3><span style='font-family:Verdana'>SUMMARY<o:p></o:p></span></h3>
  90. <p><span style='font-size:10.0pt;font-family:Verdana'>This is a sample Plug and
  91. Play filter driver that provides WMI data blocks and methods to the CDM
  92. provider. This allows the CDM provider to expose diagnostic tests via the Common
  93. Diagnostic Model. Typically, driver writers will copy the sample code into
  94. their own driver and make any minor modifications so that the WMI data blocks
  95. are always available when the driver is loaded. Alternatively, WmiSamp can be
  96. left as a filter driver if WMI data blocks should only be made available when
  97. the filter driver is loaded. Or it can be included in a different driver.<o:p></o:p></span></p>
  98. <h3><span style='font-family:Verdana'>BUILDING THE SAMPLE<o:p></o:p></span></h3>
  99. <p><span style='font-size:10.0pt;font-family:Verdana'>Follow these steps to
  100. WMI-enable a driver with the sample code.<o:p></o:p></span></p>
  101. <p><span style='font-size:10.0pt;font-family:Verdana'>1. Determine what
  102. diagnostics needs to be provided.<o:p></o:p></span></p>
  103. <p><span style='font-size:10.0pt;font-family:Verdana'>2. Write one or more
  104. Managed Object Format (.mof) files that describe the WDM data blocks and
  105. methods for those diagnostics. In doing this, the driver writer will need to
  106. run the GUIDgen tool to create globally unique GUIDs that are assigned to the
  107. data blocks. GUIDgen <i>must</i> be run so that no two data block formats have
  108. the same GUID. Compile the .mof files into .bmf files by using the Mofcomp
  109. tool. The resulting .bmf files are platform-independent binaries, and can be
  110. reported as resources attached to the .sys file or as one or more instances of
  111. a data block queried by WMI. Note that one of the byproducts of generating the
  112. binary .mof file is a header file that contains GUID and structure definitions
  113. for the data blocks. Use this header because it will always be up to date with
  114. the .mof. <o:p></o:p></span></p>
  115. <p><span style='font-size:10.0pt;font-family:Verdana'>3. Write the Managed
  116. Object Format (.mof) file containing the CDM classes that refererence the WDM
  117. shadow classes described by the MOF written in step 1.<o:p></o:p></span></p>
  118. <p><span style='font-size:10.0pt;font-family:Verdana'>4. Build the
  119. WMIGUIDREGINFO structure with the GUIDs for the data blocks defined in the WDM
  120. .mof file. If the device should be notified when to start and stop collection
  121. of a data block, the WMIREG_FLAG_EXPENSIVE flag should be set for the data
  122. block in the WMIGUIDREGINFO structure.<o:p></o:p></span></p>
  123. <p><span style='font-size:10.0pt;font-family:Verdana'>5. Implement the six WMI
  124. function callback routines and reference them in a WMILIB_CONTEXT structure.
  125. Note that some of them are optional.<o:p></o:p></span></p>
  126. <p><span style='font-size:10.0pt;font-family:Verdana'>6. Modify the sources and
  127. makefile.inc files so that the .mof file is compiled into the .bmf, .x, .vbs
  128. and .h file. <o:p></o:p></span></p>
  129. <h3><span style='font-family:Verdana'>RUNNING THE SAMPLE<o:p></o:p></span></h3>
  130. <p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
  131. tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
  132. font-family:Verdana'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  133. </span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>Build
  134. and install the CDMProv DDK sample on target machine<o:p></o:p></span></p>
  135. <p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
  136. tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
  137. font-family:Verdana'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  138. </span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>On
  139. target machine change the value Provider class qualifier from CdmProv to the
  140. name of your provider. Next run <b><i>mofcomp sample.mof</i></b>. This will
  141. include the CDM mof into the WMI schema.<o:p></o:p></span></p>
  142. <p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
  143. tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
  144. font-family:Verdana'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  145. </span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>Install
  146. the DiagFilt sample driver as a filter driver on your device stack<o:p></o:p></span></p>
  147. <p style='margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo2;
  148. tab-stops:list .5in'><![if !supportLists]><span style='font-size:10.0pt;
  149. font-family:Verdana'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  150. </span></span><![endif]><span style='font-size:10.0pt;font-family:Verdana'>Modify
  151. listem.vbs to contain the correct CIM RelPath that your device maps to. Run <b><i>start
  152. /wait listem.vbs</i></b> to invoke your driver<o:p></o:p></span></p>
  153. <h3><span style='font-family:Verdana'>RESOURCES<o:p></o:p></span></h3>
  154. <p><span style='font-size:10.0pt;font-family:Verdana'>Please see the DDK CDM
  155. Provider sample and the Kernel-Mode driver section of DDK documentation for
  156. more information on WMI. <o:p></o:p></span></p>
  157. <h3><span style='font-family:Verdana'>CODE TOUR<o:p></o:p></span></h3>
  158. <h4><span style='font-family:Verdana'>File Manifest<o:p></o:p></span></h4>
  159. <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
  160. style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>NULL filter driver (boilerplate code)</pre><pre>Filter.h<span
  161. style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Header file for the filter driver</pre><pre>Filter.mof <span
  162. 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
  163. style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Resource file containing version information</pre><pre>Inf.txt<span
  164. style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Sections of the .inf file to change</pre><pre>Makefile<span
  165. style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Standard Windows NT makefile</pre><pre>Pnp.c<span
  166. style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Plug and Play routines</pre><pre>Power.c<span
  167. style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Power Management routines</pre><pre>Sources<span
  168. style='mso-tab-count:2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Sources for build</pre><pre>Util.c<span
  169. 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
  170. 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
  171. style='mso-tab-count:1'> </span></pre><pre>Sample.Mof<span style='mso-tab-count:
  172. 1'>&nbsp;&nbsp;&nbsp;&nbsp; </span>MOF for CDM classes associated with this driver</pre><pre>Listem.Vbs<span
  173. style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp; </span>VBS script that is useful for testing CDM provider and driver implementation</pre>
  174. <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
  175. 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>
  176. <p align=center style='margin:0in;margin-bottom:.0001pt;text-align:center;
  177. 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
  178. style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:"Courier New"'><a
  179. href="#top"><span style='font-family:Verdana'>Top of page</span></a></span><span
  180. style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:"Courier New";
  181. mso-bidi-font-family:"Courier New"'> <o:p></o:p></span></p>
  182. <pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre>
  183. <table border=0 cellspacing=0 cellpadding=0 width=624 style='width:6.5in;
  184. mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in'>
  185. <tr style='height:1.5pt'>
  186. <td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
  187. <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
  188. </td>
  189. </tr>
  190. </table>
  191. <pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre><pre><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></pre>
  192. <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
  193. style='font-size:7.5pt;font-family:"MS Sans Serif";mso-fareast-font-family:
  194. "Courier New";mso-bidi-font-family:"Courier New"'>&copy; 2000 Microsoft Corporation</span><span
  195. style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:"Courier New";
  196. mso-bidi-font-family:"Courier New"'> <o:p></o:p></span></p>
  197. </div>
  198. </body>
  199. </html>