summaryrefslogtreecommitdiff
path: root/setup/devcon/devcon.htm
blob: 200ecf21cf0b29e8252af892c3b0dfec518e3053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
<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:GrammarState>Clean</w:GrammarState>
  <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-alt:"Courier New";
	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;}
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:-120;
	mso-list-type:simple;
	mso-list-template-ids:-155046518;}
@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 &quot;<span
class=SpellE>devcon</span> help&quot; will provide a list of commands along
with short descriptions of what each command does. &quot;<span class=SpellE><span
class=GramE>devcon</span></span> help &lt;command&gt;&quot; will give more
detailed help on that command. The interpretation of each command is done via a
dispatch table &quot;<span class=SpellE>DispatchTable</span>&quot; that is at
the bottom of &quot;<span class=SpellE>cmds.cpp</span>&quot;. Some of the
commands make use of a generic device enumerator &quot;<span class=SpellE>EnumerateDevices</span>&quot;.
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.&nbsp;
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 class=GramE><span style='font-family:Verdana'>cmdClasses</span></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 class=GramE><span style='font-family:Verdana'>cmdListClass</span></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 class=GramE><span style='font-family:Verdana'>cmdFind</span></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 class=GramE><span style='font-family:Verdana'>cmdEnable</span></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&nbsp;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 class=GramE><span style='font-family:Verdana'>cmdUpdate</span></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 class=GramE><span style='font-family:Verdana'>cmdInstall</span></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 class=GramE><span style='font-family:Verdana'>cmdRemove</span></span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>A
command to remove devices.</span></span><span style='font-size:10.0pt;
font-family:Verdana'> Plug &amp; 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 class=GramE><span style='font-family:Verdana'>cmdRescan</span></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 &amp; Play devices that may have previously
been removed, or that otherwise require a rescan to detect them. <o:p></o:p></span></p>

<h4><span class=SpellE><span class=GramE><span style='font-family:Verdana'>cmdDPAdd</span></span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Verdana'>This
command allows you to add a Driver Package to the machine.<span
style='mso-spacerun:yes'>� </span>The main functionality of this command
demonstrates the use of <span class=SpellE>SetupCopyOEMInf</span>. Adding a Driver
Package to the machine doesn�t mean the drivers are installed on devices, it
simply means the drivers are available automatically when a new device is
plugged in or <span class=GramE>a</span> existing device is updated.<o:p></o:p></span></p>

<h4><span class=SpellE><span class=GramE><span style='font-family:Verdana'>cmdDPDelete</span></span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Verdana'>This
command allows you to uninstall a Driver Package from the machine.<span
style='mso-spacerun:yes'>� </span>The main functionality of this command
demonstrates the use of <span class=SpellE>SetupUninstallOEMInf</span>.
Removing a Driver Package from the machine does not uninstall the drivers
associated with a device. If you want to accomplish both then use <span
class=SpellE>cmdRemove</span> on all the devices using a given Driver Package
and then <span class=SpellE>cmdDPDelete</span> to remove the Driver Package
itself from the machine. This functionality is not available in Windows 2000 or
earlier.<o:p></o:p></span></p>

<h4><span class=SpellE><span class=GramE><span style='font-family:Verdana'>cmdDPEnum</span></span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Verdana'>This
command allows you to enumerate all of the 3<sup>rd</sup> party Driver Packages
currently installed on the machine and also shows you how to get some common
properties from a Driver Package (Provider, Class description, <span
class=SpellE>DriverVer</span> date and version).<o:p></o:p></span></p>

<h4><span class=SpellE><span class=GramE><span style='font-family:Verdana'>cmdDPEnumLegacy</span></span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Verdana'>This
command shows you how to enumerate 3<sup>rd</sup> party Driver Packages on
Windows Server 2003 and earlier operating systems.<o:p></o:p></span></p>

<h4><span style='font-family:Verdana'>Reboot<o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;font-family:Verdana'>This function shows how
to correctly reboot the machine from a hardware install program. In particular
it passes flags to <span class=SpellE>ExitWindowsEx</span> that cause the
reboot to be associated with hardware installation. You should never reboot <span
class=GramE>the</span> machine unnecessarily.<o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>EnumerateDevices</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Demonstrates
the use of <span class=SpellE>SetupDiGetClassDevsEx</span> to enumerate all
devices or all present devices, either globally or limited to a specific setup
class.</span></span><span style='font-size:10.0pt;font-family:Verdana'>
Demonstrates the use of <span class=SpellE>SetupDiCreateDeviceInfoListEx</span>
to create a blank list associated with a class or not (for most cases, a blank
list need not be associated with a class). <span class=GramE>Demonstrates the
use of <span class=SpellE>SetupDiOpenDeviceInfo</span> to add a device instance
into a device info list.</span> These last two API's are ideal to obtain a <span
class=SpellE>DeviceInfoData</span> structure from a device instance and machine
name when mixing CFGMGR32 API's with SETUPAPI API's. <span class=SpellE>SetupDiGetDeviceInfoListDetail</span>
is called to obtain a remote machine handle that may be passed into CFGMGR32
API's. <span class=SpellE>SetupDiEnumDeviceInfo</span> is called to enumerate
each and every device that is in the device info list (either explicitly added,
or determined by the call to <span class=SpellE>SetupDiGetClassDevsEx</span>).
The instance ID is obtained by calling <span class=SpellE>CM_Get_Device_ID_Ex</span>,
using information in <span class=SpellE>devInfo</span> (obtained from <span
class=SpellE>SetupDiEnumerateDeviceInfo</span>) and <span class=SpellE>devInfoListDetail</span>
(obtained from <span class=SpellE>SetupDiGetDeviceInfoListDetail</span>). <span
class=SpellE>GetHwIds</span> is called to obtain a list of hardware and
compatible ID's (explained below). Once an interesting device has been
determined (typically by checking hardware ID's) then the callback is called to
operate on that individual device.<o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>GetHwIds</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;font-family:Verdana'>Shows how to get the
complete list of hardware ID's or compatible ID's for a device using <span
class=SpellE>SetupDiGetDeviceRegistryProperty</span>.<o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>GetDeviceDescription</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Shows
how to obtain descriptive information about a device.</span></span><span
style='font-size:10.0pt;font-family:Verdana'> The friendly name is used if it <span
class=GramE>exists,</span> otherwise the device description is used.<o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>DumpDeviceWithInfo</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Shows
how to obtain an instance ID (or use any CFGMGR32 API) given HDEVINFO (device
info list) and PSP_DEVINFO_DATA (device info data).</span></span><span
style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>DumpDeviceStatus</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Shows
how to interpret the information returned by <span class=SpellE>CM_Get_DevNode_Status_Ex</span>.
Refer to <span class=SpellE>cfg.h</span> for information returned by this API.</span></span><span
style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>DumpDeviceResources</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Shows
how to obtain information about resources used by a device.</span></span><span
style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>DumpDeviceDriverFiles</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;font-family:Verdana'>Provided as a debugging
aid, obtains information about the files apparently being used for a device. It
uses <span class=SpellE>SetupDiBuildDriverInfoList</span> to obtain information
about the driver being used for the specified device. The driver list
associated with a device may be enumerated by calling <span class=SpellE>SetupDiEnumDriverInfo</span>.
In this case, there will be no more than one driver listed. This function
proceeds to obtain a list of files that would normally be copied for this
driver using DIF_INSTALLDEVICEFILES. <span class=SpellE>SetupScanFileQueue</span>
is used to enumerate the file queue to display the list of files that are associated
with the driver.<o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>DumpDeviceDriverNodes</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;font-family:Verdana'>Provided as a debugging
aid, this function determines the list of compatible drivers for a device. It
uses <span class=SpellE>SetupDiBuildDriverInfoList</span> to obtain the list of
compatible drivers. In this case, all drivers are enumerated, however typically
DIF_SELECTBESTCOMPATDRV and <span class=SpellE>SetupDiGetSelectedDriver</span>
would be used together to find which driver the OS would consider to be the
best. <o:p></o:p></span></p>

<h4><span class=SpellE><span style='font-family:Verdana'>DumpDeviceStack</span></span><span
style='font-family:Verdana'><o:p></o:p></span></h4>

<p><span style='font-size:10.0pt;font-family:Verdana'>This function determines
class and device upper and lower filters. <o:p></o:p></span></p>

<h3><span style='font-family:Verdana'>BUILDING THE DEVCON SAMPLE<o:p></o:p></span></h3>

<h5><span style='font-family:Verdana'>To build the <span class=SpellE>devcon</span>
sample:<o:p></o:p></span></h5>

<p class=MsoListNumber style='margin-left:.5in;text-indent:-.25in;mso-list:
l1 level1 lfo3;tab-stops:list .5in'><![if !supportLists]><span
style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:Verdana;
mso-bidi-font-family:Verdana'><span style='mso-list:Ignore'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Verdana'>Click the Build Environment icon
of choice in the Development Kits Build Environments sub-menu. This will set up
the correct build environment to build this sample. Note that this sample will
build in the 64-bit environments as well as the 32-bit environments. <o:p></o:p></span></p>

<p class=MsoListNumber style='margin-left:.5in;text-indent:-.25in;mso-list:
l1 level1 lfo3;tab-stops:list .5in'><![if !supportLists]><span
style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:Verdana;
mso-bidi-font-family:Verdana'><span style='mso-list:Ignore'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Verdana'>In a command window, change to the
directory containing the <span class=SpellE>DevCon</span> source code. For
example:<o:p></o:p></span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<p style='margin-left:.5in'><span class=SpellE><span class=GramE><b><span
style='font-size:10.0pt;font-family:Verdana'>cd</span></b></span></span><b><span
style='font-size:10.0pt;font-family:Verdana'> <span class=SpellE>src\setup\devcon</span></span></b><span
style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>

</blockquote>

<p class=MsoListNumber style='margin-left:.5in;text-indent:-.25in;mso-list:
l1 level1 lfo3;tab-stops:list .5in'><![if !supportLists]><span
style='font-size:10.0pt;font-family:Verdana;mso-fareast-font-family:Verdana;
mso-bidi-font-family:Verdana'><span style='mso-list:Ignore'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Verdana'>Use the macro BLD or run the
following from the command prompt: <o:p></o:p></span></p>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<p><span class=GramE><b><span style='font-size:10.0pt;font-family:Verdana'>build</span></b></span><b><span
style='font-size:10.0pt;font-family:Verdana'> �c</span></b><span
style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>This invokes the
Microsoft make routines that produce the <span class=SpellE>Build.log</span>, <span
class=SpellE>Build.wrn</span>, and <span class=SpellE>Build.err</span> log
files. <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>When the build completes,
the executable will be placed in the ObjXXX\I386 subdirectory of the
&lt;TARGETPATH&gt; directory specified in the Sources file (depending on build
environment chosen). <o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:Verdana'>If the build does not
succeed, check for these errors: 1) the build environment is not set up
properly, or 2) modifications made to the sample source code introduced errors.
<o:p></o:p></span></p>

</blockquote>

<h3><span style='font-family:Verdana'>USING 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 provided in ready-to-run form
in tools\<span class=SpellE>devcon</span>. For usage, refer to the document
provided with devcon.exe. <span class=SpellE>DevCon</span> is a command line
utility with built-in documentation available by typing &quot;<span
class=SpellE>devcon</span> help&quot;. <o:p></o:p></span></p>

<h3><span style='font-family:Verdana'>TESTING<o:p></o:p></span></h3>

<p><span style='font-size:10.0pt;font-family:Verdana'>Type &quot;<span
class=SpellE>devcon</span> find *&quot; to list device instances of all present
devices on the local machine.<o:p></o:p></span></p>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Type
&quot;<span class=SpellE>devcon</span> status @root\rdp_mou\0000&quot; to list
status of the terminal server mouse driver.</span></span><span
style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>

<p><span class=GramE><span style='font-size:10.0pt;font-family:Verdana'>Type
&quot;<span class=SpellE>devcon</span> status *PNP05*&quot; to list status of
all COM ports.</span></span><span style='font-size:10.0pt;font-family:Verdana'><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>

<table class=MsoNormalTable border=0 cellspacing=1 cellpadding=0 width=916
 style='width:687.0pt;mso-cellspacing:.7pt;mso-padding-alt:0in 0in 0in 0in'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><u>File</u></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><u>Description</u></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:1'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><i>DevCon.htm</i></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>Sample tour documentation for this binary (this file).</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:2'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>DevCon.cpp</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>Source file for <span class=SpellE>tmain</span> entry
  point and utility functions.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:3'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>Cmds.cpp</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>Source file for supported commands.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:4'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>Dump.cpp</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>Source file for functions that output information about
  devices.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:5'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>DevCon.h</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=GramE>Header file</span> for sample.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:6'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>DevCon.rc</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=GramE>Resource file</span> containing some
  strings and version information.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:7'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>rc_ids.h</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=GramE>Header file</span> for resources.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:8'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>Msg.mc</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>Message file that is used to build <span class=SpellE>msg.rc</span>
  and <span class=SpellE>msg.h</span> used for help texts and other messages.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:9'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><i>Sources</i></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>Generic file that lists source files and all the build
  options.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:10;mso-yfti-lastrow:yes'>
  <td width=151 valign=top style='width:113.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal><span class=SpellE><i>Makefile</i></span></p>
  </td>
  <td width=755 style='width:566.25pt;padding:0in 0in 0in 0in'>
  <p class=MsoNormal>File that redirects to the real make file that is shared
  by all the driver components of the Windows DDK.</p>
  </td>
 </tr>
</table>

<h3><span style='font-family:Courier'>FEEDBACK<o:p></o:p></span></h3>

<p><span style='font-family:Courier'>We welcome your comments, problem reports
and wish-list requests. Please submit them by pointing your Internet browser to
<a href="http://www.microsoft.com/ddk">http://www.microsoft.com/ddk</a>. </span></p>

<p align=center style='text-align:center'><span style='font-size:10.0pt;
font-family:Verdana'><a href="#top">Top of page</a><o:p></o:p></span></p>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=624
 style='width:6.5in;mso-cellspacing:0in;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes;
  height:1.5pt'>
  <td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
  <p class=MsoNormal><span style='font-size:2.0pt;mso-bidi-font-size:12.0pt'><o:p>&nbsp;</o:p></span></p>
  </td>
 </tr>
</table>

<p><span style='font-size:7.5pt;font-family:"MS Sans Serif"'>� 2004</span><span
style='font-size:10.0pt;font-family:Verdana'> </span><span style='font-size:
7.5pt;font-family:"MS Sans Serif"'>Microsoft Corporation </span><span
style='font-size:10.0pt;font-family:Verdana'><o:p></o:p></span></p>

</div>

</body>

</html>