?? devcon.htm
字號:
<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=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="devcon_files/filelist.xml">
<title>DevCon Sample</title>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</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: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";}
p.MsoListNumber, li.MsoListNumber, div.MsoListNumber
{mso-margin-top-alt:auto;
margin-right:0in;
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";}
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
{mso-margin-top-alt:auto;
margin-right:0in;
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";}
span.SpellE
{mso-style-name:"";
mso-spl-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:-120;
mso-list-type:simple;
mso-list-template-ids:-861887012;}
@list l0:level1
{mso-level-style-link:"List Number";
mso-level-tab-stop:.25in;
mso-level-number-position:left;
margin-left:.25in;
text-indent:-.25in;}
@list l1
{mso-list-id:2061856105;
mso-list-template-ids:886459906;}
@list l1:level1
{mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level2
{mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level3
{mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level4
{mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level5
{mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level6
{mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level7
{mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level8
{mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level9
{mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;}
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";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>
<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
<div class=Section1>
<h2><span class=SpellE><span style='font-family:Verdana'>DevCon</span></span><span
style='font-family:Verdana'> Sample<o:p></o:p></span></h2>
<h3><span style='font-family:Verdana'>DEVCON<o:p></o:p></span></h3>
<p><span class=SpellE><span style='font-size:10.0pt;font-family:Verdana'>DevCon</span></span><span
style='font-size:10.0pt;font-family:Verdana'> is a command-line tool that displays
detailed information about devices, and lets you search for and manipulate
devices from the command line. <span class=SpellE>DevCon</span> enables,
disables, installs, configures, and removes devices on the local computer and
displays detailed information about devices on local and remote computers. <span
class=SpellE>DevCon</span> is included in the Windows DDK.<o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>ABOUT THIS DOCUMENT<o:p></o:p></span></h3>
<p><span style='font-size:10.0pt;font-family:Verdana'>This document describes
the <span class=SpellE>DevCon</span> source code, which is included in the
Windows DDK in the /<span class=SpellE>src/setup/devcon</span> directory. It
explains the <span class=SpellE>DevCon</span> design, and describes how to use
the <span class=SpellE>SetupAPI</span> and device installation functions to
enumerate devices and perform device operations in a console application.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>For a complete
description of <span class=SpellE>DevCon</span> features and instructions for
using them, see the <span class=SpellE>DevCon</span> help file in the DDK
documentation in Driver Development Tools/Tools for Testing Drivers/<span
class=SpellE>DevCon</span>.<o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>SCOPE<o:p></o:p></span></h3>
<p><span style='font-size:10.0pt;font-family:Verdana'>These instructions
pertain to Windows XP and Windows Server 2003. <span class=SpellE>DevCon</span>
was designed for use on Windows 2000, Windows XP, and Windows Server 2003. It
will not work on Windows 95, Windows 98, or Windows ME.<o:p></o:p></span></p>
<h3><span style='font-family:Verdana'>HOW IT WORKS<o:p></o:p></span></h3>
<p><span style='font-size:10.0pt;font-family:Verdana'>Running "<span
class=SpellE>devcon</span> help" will provide a list of commands along
with short descriptions of what each command does. "<span class=SpellE>devcon</span>
help <command>" will give more detailed help on that command. The
interpretation of each command is done via a dispatch table "<span
class=SpellE>DispatchTable</span>" that is at the bottom of "<span
class=SpellE>cmds.cpp</span>". Some of the commands make use of a generic device
enumerator "<span class=SpellE>EnumerateDevices</span>". A few of
these commands will work when given a remote target computer, and will also
work if using the 32-bit <span class=SpellE>devcon</span> on Wow64. A
description of some of the more interesting functions and the APIs they use
follows:<o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdClasses</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>This command demonstrates
the use of <span class=SpellE>SetupDiBuildClassInfoListEx</span> to enumerate
all device class <span class=SpellE>GUID's</span>. The function <span
class=SpellE>SetupDiClassNameFromGuidEx</span> and <span class=SpellE>SetupDiGetClassDescriptionEx</span>
are used to obtain more information about each device class.<o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdListClass</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>This command demonstrates
the use of <span class=SpellE>SetupDiClassGuidsFromNameEx</span> to enumerate
one or more class <span class=SpellE>GUID's</span> that match the class name.
This command also demonstrates the use of <span class=SpellE>SetupDiGetClassDevsEx</span>
to list all the devices for each class GUID.<o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdFind</span></span><span
style='font-family:Verdana'> <span class=SpellE>cmdFindAll</span> <span
class=SpellE>cmdStatus</span><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>A simple use of <span
class=SpellE>EnumerateDevices</span> (explained below) to list devices and
display different levels of information about each device. Note that all but <span
class=SpellE>cmdFindAll</span> use DIGCF_PRESENT to only list information about
devices that are currently present. The main functionality for these and
related devices is done inside <span class=SpellE>FindCallback</span>.<o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdEnable</span></span><span
style='font-family:Verdana'> <span class=SpellE>cmdDisable</span> <span
class=SpellE>cmdRestart</span><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>These commands show
how to issue DIF_PROPERTYCHANGE to enable a device, disable a device, or
restart a device. The main functionality for each of these commands is done
inside <span class=SpellE>ControlCallback</span>. <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:Verdana'>These operations cannot
be done on a remote machine or in the context of Wow64. CFGMGR32 API's should
not be used as they skip class and co-installers. <o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdUpdate</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>This command shows how to
use <span class=SpellE>UpdateDriverForPlugAndPlayDevices</span> to update the
driver for all devices to a specific driver. Normally INSTALLFLAG_FORCE would
not be specified allowing <span class=SpellE>UpdateDriverForPlugAndPlayDevices</span>
to determine if there is a better match already known. It's specified in <span
class=SpellE>DevCon</span> to allow <span class=SpellE>DevCon</span> to be used
more effectively as a debugging/testing tool. This cannot be done on a remote
machine or in the context of Wow64. <o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdInstall</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>A variation of <span
class=SpellE>cmdUpdate</span> to install a driver when there is no associated hardware.
It creates a new root-enumerated device instance and associates it with a made
up hardware ID specified on the command line (which should correspond to a
hardware ID in the INF). This cannot be done on a remote machine or in the
context of Wow64.<o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdRemove</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>A command to remove
devices. Plug & Play devices that are removed will reappear in response to <span
class=SpellE>cmdRescan</span>. The main functionality of this command is in <span
class=SpellE>RemoveCallback</span> that demonstrates the use of DIF_REMOVE.
This cannot be done on a remote machine or in the context of Wow64. CFGMGR32
API's should not be used as they skip class and co-installers.<o:p></o:p></span></p>
<h4><span class=SpellE><span style='font-family:Verdana'>cmdRescan</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>
<p><span style='font-size:10.0pt;font-family:Verdana'>This command shows the
correct way to rescan for all Plug & Play devices that may have previously
been removed, or that otherwise require a rescan to detect them. <o:p></o:p></span></p>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -