471 lines
24 KiB
HTML
471 lines
24 KiB
HTML
<!- Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved ->
|
||
<!doctype html public "-//W3C//DTD HTML 4.0 Draft//EN">
|
||
<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-1251">
|
||
<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="./EventConsumer_files/filelist.xml">
|
||
<title>WMI SDK Sample - EventConsumer</title>
|
||
<!--[if gte mso 9]><xml>
|
||
<o:DocumentProperties>
|
||
<o:Author>Michael Maston</o:Author>
|
||
<o:Template>Normal</o:Template>
|
||
<o:LastAuthor>Michael Maston</o:LastAuthor>
|
||
<o:Revision>20</o:Revision>
|
||
<o:TotalTime>258</o:TotalTime>
|
||
<o:Created>1999-01-25T18:42:00Z</o:Created>
|
||
<o:LastSaved>2001-01-20T21:31:00Z</o:LastSaved>
|
||
<o:Pages>2</o:Pages>
|
||
<o:Words>600</o:Words>
|
||
<o:Characters>3424</o:Characters>
|
||
<o:Company>Microsoft</o:Company>
|
||
<o:Lines>28</o:Lines>
|
||
<o:Paragraphs>6</o:Paragraphs>
|
||
<o:CharactersWithSpaces>4204</o:CharactersWithSpaces>
|
||
<o:Version>9.2720</o:Version>
|
||
</o:DocumentProperties>
|
||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||
<w:WordDocument>
|
||
<w:Zoom>103</w:Zoom>
|
||
</w:WordDocument>
|
||
</xml><![endif]-->
|
||
<style>
|
||
<!--
|
||
/* Font Definitions */
|
||
@font-face
|
||
{font-family:"MS Mincho";
|
||
panose-1:2 2 6 9 4 2 5 8 3 4;
|
||
mso-font-alt:"MS Mincho";
|
||
mso-font-charset:128;
|
||
mso-generic-font-family:modern;
|
||
mso-font-pitch:fixed;
|
||
mso-font-signature:-1610612033 1757936891 16 0 131231 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 Mincho";
|
||
panose-1:2 2 6 9 4 2 5 8 3 4;
|
||
mso-font-charset:128;
|
||
mso-generic-font-family:modern;
|
||
mso-font-pitch:fixed;
|
||
mso-font-signature:-1610612033 1757936891 16 0 131231 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;}
|
||
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.MsoPlainText, li.MsoPlainText, div.MsoPlainText
|
||
{margin:0in;
|
||
margin-bottom:.0001pt;
|
||
mso-pagination:widow-orphan;
|
||
font-size:10.0pt;
|
||
font-family:"Courier New";
|
||
mso-fareast-font-family:"Times New Roman";}
|
||
@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:994183607;
|
||
mso-list-type:hybrid;
|
||
mso-list-template-ids:-208100182 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
|
||
@list l0:level1
|
||
{mso-level-tab-stop:.5in;
|
||
mso-level-number-position:left;
|
||
text-indent:-.25in;
|
||
font-family:"Times New Roman";}
|
||
ol
|
||
{margin-bottom:0in;}
|
||
ul
|
||
{margin-bottom:0in;}
|
||
-->
|
||
</style>
|
||
<!--[if gte mso 9]><xml>
|
||
<o:shapedefaults v:ext="edit" spidmax="1027"/>
|
||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||
<o:shapelayout v:ext="edit">
|
||
<o:idmap v:ext="edit" data="1"/>
|
||
</o:shapelayout></xml><![endif]-->
|
||
<meta name=MS-HAID content=VJsamples>
|
||
</head>
|
||
|
||
<body bgcolor=white lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
|
||
|
||
<div class=Section1>
|
||
|
||
<table border=0 cellpadding=0 width="100%" style='width:100.0%;mso-cellspacing:
|
||
1.5pt;mso-padding-alt:0in 0in 0in 0in'>
|
||
<tr>
|
||
<td width=160 style='width:120.0pt;background:#330099;padding:.75pt .75pt .75pt .75pt'>
|
||
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Verdana;
|
||
color:white'> <nobr><b>Windows<EFBFBD> Management Instrumentation SDK Sample</b></span>
|
||
<o:p></o:p></p>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
<p class=MsoPlainText><br>
|
||
<strong><span style='font-size:13.5pt;font-family:Verdana'>EventConsumer</span></strong><br
|
||
style='mso-special-character:line-break'>
|
||
<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
|
||
<![endif]></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>This sample demonstrates a permanent event consumer. Events are
|
||
generated from the Advanced Client sample application by adding equipment. This
|
||
application shows how to implement a simple IWBEMUnboundObjectSink and its
|
||
class factory. You should generate your own CLSID when building your permanent
|
||
consumer.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
|
||
font-family:Verdana'>Building the EventConsumer Sample<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText> </p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'>The application can be
|
||
built from the command line using NMAKE, or it can be built using Microsoft
|
||
Visual C++.<span yes> </span><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'> <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'>From the command line
|
||
in the sample installation directory: <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'> <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in'><b><span style='font-family:
|
||
Verdana'>NMAKE /f "Makefile"<o:p></o:p></span></b></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'> <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'>From Microsoft Visual
|
||
C++: <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'> <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText .5in list lfo2 level1 l0><span style='font-family:Verdana'>1.<span
|
||
Roman New Times></span></span><span style='font-size:7.0pt;font-family:Verdana'>
|
||
</span><span style='font-family:Verdana'>Select File + Open Workspace<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText .5in list lfo2 level1 l0><span style='font-family:Verdana'>2.<span
|
||
Roman New Times></span></span><span style='font-size:7.0pt;font-family:Verdana'>
|
||
</span><span style='font-family:Verdana'>Select the PermEvents.dsp file<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
|
||
font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>Registering the
|
||
Consumer<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
|
||
font-family:Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>The SampleViewer.mof uses a special namespace and you must
|
||
therefore compile the SampleViewer.mof to create the namespace and register
|
||
this consumer before running the Client sample application.<o:p></o:p></span></p>
|
||
|
||
<span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:
|
||
"MS Mincho";mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
|
||
HE'><br clear=all style='page-break-before:always'>
|
||
</span>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana'>From the command line in
|
||
the sample installation directory type the following:<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='text-indent:.5in'><b><span style='font-family:
|
||
Verdana'>MOFCOMP SampleViewer.mof</span></b><span style='font-family:Verdana;
|
||
mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>In order to <i>explicitly</i>
|
||
register the consumer with COM, you may specify the /RegServer command line
|
||
switch when running the executable.<span style="mso-spacerun: yes"><EFBFBD> </span></span><span
|
||
style='font-family:Verdana'>From the command line in the sample installation
|
||
directory type the following:</span><span style='font-family:Verdana;
|
||
mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><span style='mso-tab-count:
|
||
1'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><span style='mso-tab-count:
|
||
1'><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> </span><b>PermEvents.exe /RegServer<o:p></o:p></b></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'> <o:p></o:p></span></b></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>It should be noted,
|
||
however, that the executable would register itself automatically without
|
||
specifying this switch.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'> </span><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
|
||
font-family:Verdana'>Common Event Consumer Tasks Demonstrated by the Sample
|
||
Functions<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Task:</span></b><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:
|
||
"Times New Roman"'><span style="mso-spacerun: yes"><EFBFBD> </span></span><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>Handle an event</span><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:
|
||
"Times New Roman"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Implementation:<span
|
||
style="mso-spacerun: yes"><EFBFBD> </span></span></b><span style='font-family:Verdana;
|
||
mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>Consumer.cpp is the actual handler. The IndicateToConsumer()
|
||
method will be called with the event instance embedded. <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Task:</span></b><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:
|
||
"Times New Roman"'><span style="mso-spacerun: yes"><EFBFBD> </span></span><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>Creating the
|
||
handler object<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Implementation:<span
|
||
style="mso-spacerun: yes"><EFBFBD> </span></span></b><span style='font-family:Verdana;
|
||
mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>factory.cpp creates the sink object. It is a simple class factory.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Task:</span></b><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:
|
||
"Times New Roman"'><span style="mso-spacerun: yes"><EFBFBD> </span></span><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>Registering the
|
||
object and factory<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Implementation:<span
|
||
style="mso-spacerun: yes"><EFBFBD> </span></span></b><span style='font-family:Verdana;
|
||
mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>PermEvents.cpp registers the sink object with its class factory in
|
||
the InitInstance() routine. The registration is revoked in the ExitInstance().<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Task:</span></b><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:
|
||
"Times New Roman"'><span style="mso-spacerun: yes"><EFBFBD> </span></span><span
|
||
style='font-family:Verdana;mso-fareast-font-family:"MS Mincho"'>Self-registering
|
||
an EXE<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><b><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Implementation:<span
|
||
style="mso-spacerun: yes"><EFBFBD> </span></span></b><span style='font-family:Verdana;
|
||
mso-fareast-font-family:"MS Mincho"'><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>PermEvents.cpp has the RegisterServer() and UnregisterServer()
|
||
routines to show self-registration of an EXE. It is not the same as a DLL. The
|
||
'AppID' and 'RunAs' values allow the spawned EXE to run on the user's desktop
|
||
instead of the service's hidden desktop. Otherwise the Event Consumer would
|
||
never appear.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText><strong><span style='font-size:12.0pt;mso-bidi-font-size:
|
||
10.0pt;font-family:Verdana;font-weight:normal'>Build Notes<o:p></o:p></span></strong></p>
|
||
|
||
<p class=MsoPlainText><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
|
||
font-family:Verdana;mso-fareast-font-family:"MS Mincho"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'>Things
|
||
to remember when you're building your own WMI client application:<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>1.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>If you want your client to
|
||
run on NT and non-DCOM versions of Windows 95, manually load the ole32.dll and
|
||
see if CoInitializeSecurity() exists. This routine won<6F>t exist on Windows 95
|
||
installations that don<6F>t have DCOM installed separately. If this routine
|
||
doesn't exist, the asynchronous routines in this sample won<6F>t work because of
|
||
mismatched security level problems. The synchronous techniques will still work.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>2.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>If you don<6F>t care about
|
||
non-DCOM versions of Windows 95, you can define<span style="mso-spacerun:
|
||
yes"><EFBFBD> </span>_WIN32_DCOM so that CoInitializeSecurity() is available for
|
||
implicit linking. Don't use _WIN32_WINNT to get this prototype since it won't
|
||
compile under the Windows 95/98 operating systems.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>3.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>In any case, the
|
||
CoInitializeSecurity() call (in InitInstance()) is required to work around a
|
||
security problem when WMI trying to call a Sink object but won't identify
|
||
itself. The CoInitializeSecurity() call turns off the authentication
|
||
requirement. <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>4.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>WMI interfaces are defined
|
||
in wbemcli.h and wbemprov.h found in the wmi\include directory.<span
|
||
style="mso-spacerun: yes"><EFBFBD> </span>You may #include both these files by
|
||
including just wbemidl.h located in the same directory.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>5.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>WMI interface CLSIDs are
|
||
defined in wbemuuid.lib. If you get unresolved externals in interfaces and
|
||
CLSIDs, this is what is missing. <o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>6.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>You'll need to link with
|
||
oleaut32.lib and ole32.lib to get the needed COM support.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>7.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho";mso-bidi-font-family:"Times New Roman"'>In the Link|Output
|
||
settings, specify 'wWinMainCRTStartup' as the entry point. This is per the
|
||
Unicode programming instructions.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='tab-stops:list .5in'><span style='font-family:
|
||
Verdana;mso-fareast-font-family:"MS Mincho";mso-bidi-font-family:"Times New Roman"'><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
|
||
|
||
<p class=MsoPlainText style='margin-left:.25in;text-indent:-.25in;mso-list:
|
||
l0 level1 lfo2;tab-stops:list .25in .5in'><![if !supportLists]><span
|
||
style='font-family:"Times New Roman";mso-fareast-font-family:"MS Mincho"'>8.<span
|
||
style='font:7.0pt "Times New Roman"'>
|
||
</span></span><![endif]><span style='font-family:Verdana;mso-fareast-font-family:
|
||
"MS Mincho"'>If you're using the makefiles, don't forget to set the VC vars. In
|
||
VC++ 5.0, it is VCVARS32.BAT.<o:p></o:p></span></p>
|
||
|
||
<p class=MsoNormal style='tab-stops:list .5in'><br>
|
||
<span style='font-family:Arial'><a
|
||
href="http://www.microsoft.com/misc/CPYRIGHT.HTM"><span style='mso-field-code:
|
||
"HYPERLINK \0022http\:\/\/www\.microsoft\.com\/misc\/CPYRIGHT\.HTM\0022"'><b><EFBFBD>
|
||
1998-2001 Microsoft Corporation. All rights reserved.</b></span></a></span></p>
|
||
|
||
</div>
|
||
|
||
</body>
|
||
|
||
</html>
|