-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSetupApi.au3
6709 lines (6055 loc) · 338 KB
/
SetupApi.au3
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
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include-once
#include <LocalSecurityAuthority.au3>
; #### HEADER INFORMATION ####
; ===============================================================================
; Title : PnP Configuration Manager
; Description : Plug and Play (PnP) Configuration Manager that are used by class installers, co-installers, or device installation applications.
; Functions : 1 - Scaning device changes on a local or a remote system.
; : 2 - Disable and enable an existing hardware device, on local or remote system.
; : 3 - Install and remove device setup classes, devices and device interfaces.
; : 4 - Create or remove resource descriptor (or get / set information) for a device instance.
; : 5 - List the devices (or device interfaces) present in local or remote system.
; : 6 - Read or write device interfaces.
; : 7 - Else more ...
; Requirements : AutoIt Version : AutoIt v3 ++
; : AutoIt Libraries : Array.au3, LocalSecurityAuthority.au3
; : Modules : Advapi32.dll, Cfgmgr32.dll, Kernel32.dll, Newdev.dll, Setupapi.dll
; : Minimum client : Windows 2000 Professional
; Author : Pusofalse @ 11/20/2009, [email protected]
; ==============================================================================
; #### General size definitions ####
; ==============================================================================
Const $MAX_DEVICE_ID_LEN = 200
Const $MAX_DEVNODE_ID_LEN = $MAX_DEVICE_ID_LEN
Const $MAX_GUID_STRING_LEN = 39
Const $MAX_CLASS_NAME_LEN = 32
Const $MAX_PROFILE_LEN = 80
Const $MAX_CONFIG_VALUE = 9999
Const $MAX_INSTANCE_VALUE = 9999
Const $MAX_MEM_REGISTERS = 9 ; Win95 compatibility--not applicable to 32-bit ConfigMgr
Const $MAX_IO_PORTS = 20 ; Win95 compatibility--not applicable to 32-bit ConfigMgr
Const $MAX_IRQS = 7 ; Win95 compatibility--not applicable to 32-bit ConfigMgr
Const $MAX_DMA_CHANNELS = 7 ; Win95 compatibility--not applicable to 32-bit ConfigMgr
Const $CONFIGMG_VERSION = 0x0400
; ==============================================================================
; #### Device Node Status Constants ####
; ==============================================================================
Const $DN_ROOT_ENUMERATED = 0x00000001 ; Was enumerated by ROOT
Const $DN_DRIVER_LOADED = 0x00000002 ; Has Register_Device_Driver
Const $DN_ENUM_LOADED = 0x00000004 ; Has Register_Enumerator
Const $DN_STARTED = 0x00000008 ; Is currently configured
Const $DN_MANUAL = 0x00000010 ; Manually installed
Const $DN_NEED_TO_ENUM = 0x00000020 ; May need reenumeration
Const $DN_NOT_FIRST_TIME = 0x00000040 ; Has received a config
Const $DN_HARDWARE_ENUM = 0x00000080 ; Enum generates hardware ID
Const $DN_LIAR = 0x00000100 ; Lied about can reconfig once
Const $DN_NEED_RESTART = $DN_LIAR ; Need a system restart
Const $DN_HAS_MARK = 0x00000200 ; Not CM_Create_DevInst lately
Const $DN_HAS_PROBLEM = 0x00000400 ; Need device installer
Const $DN_FILTERED = 0x00000800 ; Is filtered
Const $DN_MOVED = 0x00001000 ; Has been moved
Const $DN_DISABLEABLE = 0x00002000 ; Can be rebalanced
Const $DN_REMOVABLE = 0x00004000 ; Can be removed
Const $DN_PRIVATE_PROBLEM = 0x00008000 ; Has a private problem
Const $DN_MF_PARENT = 0x00010000 ; Multi function parent
Const $DN_MF_CHILD = 0x00020000 ; Multi function child
Const $DN_WILL_BE_REMOVED = 0x00040000 ; DevInst is being removed
Const $DN_NOT_FIRST_TIMEE = 0x00080000 ; Has received a config enumerate
Const $DN_STOP_FREE_RES = 0x00100000 ; When child is stopped, free resources
Const $DN_REBAL_CANDIDATE = 0x00200000 ; Don't skip during rebalance
Const $DN_BAD_PARTIAL = 0x00400000 ; This devnode's log_confs do not have same resources
Const $DN_NT_ENUMERATOR = 0x00800000 ; This devnode's is an NT enumerator
Const $DN_NT_DRIVER = 0x01000000 ; This devnode's is an NT driver
Const $DN_NEEDS_LOCKING = 0x02000000 ; Devnode need lock resume processing
Const $DN_ARM_WAKEUP = 0x04000000 ; Devnode can be the wakeup device
Const $DN_APM_ENUMERATOR = 0x08000000 ; APM aware enumerator
Const $DN_APM_DRIVER = 0x10000000 ; APM aware driver
Const $DN_SILENT_INSTALL = 0x20000000 ; Silent install
Const $DN_NO_SHOW_IN_DM = 0x40000000 ; No show in device manager
Const $DN_BOOT_LOG_PROB = 0x80000000 ; Had a problem during pre
; ==============================================================================
; SP_DEVINSTALL_PARAMS.Flags Constants
; ===============================================================================
Const $DI_SHOWOEM = 0x00000001 ; support Other... button
Const $DI_SHOWCOMPAT = 0x00000002 ; show compatibility list
Const $DI_SHOWCLASS = 0x00000004 ; show class list
Const $DI_SHOWALL = 0x00000007 ; both class & compat list shown
Const $DI_NOVCP = 0x00000008 ; don't create a new copy queue--use caller-supplied FileQueue
Const $DI_DIDCOMPAT = 0x00000010 ; Searched for compatible devices
Const $DI_DIDCLASS = 0x00000020 ; Searched for class devices
Const $DI_AUTOASSIGNRES = 0x00000040 ; No UI for resources if possible
; flags returned by DiInstallDevice to indicate need to reboot/restart
Const $DI_NEEDRESTART = 0x00000080 ; Reboot required to take effect
Const $DI_NEEDREBOOT = 0x00000100 ; Same as DI_NEEDRESTART
; flags for device installation
Const $DI_NOBROWSE = 0x00000200 ; no Browse... in InsertDisk
; Flags set by DiBuildDriverInfoList
Const $DI_MULTMFGS = 0x00000400 ; Set if multiple manufacturers in class driver list. Flag indicates that device is disabled
Const $DI_DISABLED = 0x00000800 ; Set if device disabled
; Flags for Device/Class Properties
Const $DI_GENERALPAGE_ADDED = 0x00001000
Const $DI_RESOURCEPAGE_ADDED = 0x00002000
; Flag to indicate the setting properties for this Device (or class) caused a change so the Dev Mgr UI probably needs to be updatd.
Const $DI_PROPERTIES_CHANGE = 0x00004000
; Flag to indicate that the sorting from the INF file should be used.
Const $DI_INF_IS_SORTED = 0x00008000
; Flag to indicate that only the INF specified by SP_DEVINSTALL_PARAMS.DriverPath should be searched.
Const $DI_ENUMSINGLEINF = 0x00010000
; Flag that prevents ConfigMgr from removing/re-enumerating devices during device registration, installation, and deletion.
Const $DI_DONOTCALLCONFIGMG = 0x00020000
; The following flag can be used to install a device disabled
Const $DI_INSTALLDISABLED = 0x00040000
; Flag that causes SetupDiBuildDriverInfoList to build a device's compatible driver list from its existing class driver list, instead of the normal INF search.
Const $DI_COMPAT_FROM_CLASS = 0x00080000
; This flag is set if the Class Install params should be used.
Const $DI_CLASSINSTALLPARAMS = 0x00100000
; This flag is set if the caller of DiCallClassInstaller does NOT want the internal default action performed if the Class installer returns ERROR_DI_DO_DEFAULT.
Const $DI_NODI_DEFAULTACTION = 0x00200000
; The setupx flag, DI_NOSYNCPROCESSING (0x00400000) is not support in the Setup APIs. Flags for device installation.
Const $DI_QUIETINSTALL = 0x00800000 ; don't confuse the user with questions or excess info
Const $DI_NOFILECOPY = 0x01000000 ; No file Copy necessary
Const $DI_FORCECOPY = 0x02000000 ; Force files to be copied from install path
Const $DI_DRIVERPAGE_ADDED = 0x04000000 ; Prop provider added Driver page.
Const $DI_USECI_SELECTSTRINGS = 0x08000000 ; Use Class Installer Provided strings in the Select Device Dlg.
Const $DI_OVERRIDE_INFFLAGS = 0x10000000 ; Override INF flags
Const $DI_PROPS_NOCHANGEUSAGE = 0x20000000 ; No Enable/Disable in General Props
Const $DI_NOSELECTICONS = 0x40000000 ; No small icons in select device dialogs
Const $DI_NOWRITE_IDS = 0x80000000 ; Don't write HW & Compat IDs on install
; ======================================================================================
; SP_DEVINSTALL_PARAMS.FlagsEx Constants
; ======================================================================================
Const $DI_FLAGSEX_USEOLDINFSEARCH = 0x00000001 ; Inf Search functions should not use Index Search
Const $DI_FLAGSEX_AUTOSELECTRANK0 = 0x00000002 ; SetupDiSelectDevice doesn't prompt user if rank 0 match
Const $DI_FLAGSEX_CI_FAILED = 0x00000004 ; Failed to Load/Call class installer
Const $DI_FLAGSEX_DIDINFOLIST = 0x00000010 ; Did the Class Info List
Const $DI_FLAGSEX_DIDCOMPATINFO = 0x00000020 ; Did the Compat Info List
Const $DI_FLAGSEX_FILTERCLASSES = 0x00000040
Const $DI_FLAGSEX_SETFAILEDINSTALL = 0x00000080
Const $DI_FLAGSEX_DEVICECHANGE = 0x00000100
Const $DI_FLAGSEX_ALWAYSWRITEIDS = 0x00000200
Const $DI_FLAGSEX_ALLOWEXCLUDEDDRVS = 0x00000800
Const $DI_FLAGSEX_NOUIONQUERYREMOVE = 0x00001000
Const $DI_FLAGSEX_USECLASSFORCOMPAT = 0x00002000 ; Use the device's class when building compat drv list.
; (Ignored if DI_COMPAT_FROM_CLASS flag is specified.)
Const $DI_FLAGSEX_OLDINF_IN_CLASSLIST = 0x00004000 ; Search legacy INFs when building class driver list.
Const $DI_FLAGSEX_NO_DRVREG_MODIFY = 0x00008000 ; Don't run AddReg and DelReg for device's software (driver) key.
Const $DI_FLAGSEX_IN_SYSTEM_SETUP = 0x00010000 ; Installation is occurring during initial system setup.
Const $DI_FLAGSEX_INET_DRIVER = 0x00020000 ; Driver came from Windows Update
Const $DI_FLAGSEX_APPENDDRIVERLIST = 0x00040000 ; Cause SetupDiBuildDriverInfoList to append
; ===================================================================================
; Values indicating a change in a devices' state
; ====================================================================================
Const $DICS_ENABLE = 0x00000001
Const $DICS_DISABLE = 0x00000002
Const $DICS_PROPCHANGE = 0x00000003
Const $DICS_START = 0x00000004
Const $DICS_STOP = 0x00000005
; =====================================================================================
; Values specifying the scope of a device property change
; ====================================================================================
Const $DICS_FLAG_GLOBAL = 0x00000001
Const $DICS_FLAG_CONFIGSPECIFIC = 0x00000002
Const $DICS_FLAG_CONFIGGENERAL = 0x00000004
; ====================================================================================
; #### SetupDiGetClassDevs Constants ####
; ==============================================================================
Const $DIGCF_DEFAULT = 1
Const $DIGCF_PRESENT = 2
Const $DIGCF_ALLCLASSES = 4
Const $DIGCF_PROFILE = 8
Const $DIGCF_DEVICEINTERFACE = 16
; ==============================================================================
; #### SetupDiBuildDriverInfoList Constants (internal) ####
; ==============================================================================
Const $SPDIT_NODRIVER = 0x00000000
Const $SPDIT_CLASSDRIVER = 0x00000001
Const $SPDIT_COMPATDRIVER = 0x00000002
; ==============================================================================
Const $DIBCI_NOINSTALLCLASS = 1
Const $DIBCI_NODISPLAYCLASS = 2
; #### Value for SP_UNREMOVEDEVICE_PARAMS.Scope ####
; ==============================================================================
Const $DI_UNREMOVEDEVICE_CONFIGSPECIFIC = 2
; ==============================================================================
; #### Device Installation Structures ####
; ==============================================================================
Const $tagSP_DEVICEINFO_DATA = "dword Size;byte Guid[16];dword DevInst;ulong_ptr Reserved"
Const $tagSP_DEVINFO_LIST_DETAIL_DATA = "dword Size;byte ClassGUID[16];hWnd MachineHandle"
Const $tagSP_DEVINSTALL_PARAMS = "dword Size;dword Flags;dword FlagsEx;hWnd hWndParent;ptr InstallMsgHandler;ptr InstallMsgHandlerContext;ptr FileQueue;ulong_ptr ClassInstallReserved;dword Reserved;char DriverPath[260]"
Const $tagSP_DRVINFO_DATA = "dword Size;dword DriverType;ulong_ptr Reserved;char Descr[256];char MfgName[256];char ProviderName[256];dword FileTime[2];int Version"
Const $tagSP_DRVINFO_DETAIL_DATA = "dword Size;dword InfTime[2];dword CompatIDsOffset;dword CompatIDsLength;ulong_ptr Reserved;char SectionName[256];char InfFileName[260];char DrvDescr[256]"
Const $tagSP_CLASSINSTALL_HEADER = "dword Size;dword DIFCode"
Const $tagSP_DETECTDEVICE_PARAMS = $tagSP_CLASSINSTALL_HEADER & ";ptr NotifyCallback;ptr NotifyParam"
Const $tagSP_PROPCHANGE_PARAMS = $tagSP_CLASSINSTALL_HEADER & ";dword State;dword Scope;dword HwProfile"
Const $tagSP_POWERMESSAGEWAKE_PARAMS = $tagSP_CLASSINSTALL_HEADER & ";char Message[256]"
Const $tagSP_UNREMOVEDEVICE_PARAMS = $tagSP_CLASSINSTALL_HEADER & ";dword Scope;dword HWProfile"
Const $tagSP_DEV_INTERFACE_DATA = "dword Size;byte Guid[16];dword Flags;ulong_ptr Reserved"
Const $tagSP_DEV_INTERFACE_DETAIL_DATA = "dword Size;char DevicePath[512]"
Const $tagSP_CLASSIMAGE_DATA = "dword Size;hWnd ImageList;dword Reserved"
Const $tagSP_DRVINSTALL_PARAMS = "dword Size;dword Rank;dword Flags;long_ptr PrivateData;dword Reserved"
Const $tagSP_INF_SIGNER_INFO = "dword Size;wchar CatalogFile[260];wchar DigitalSigner[260];wchar DigitalSignerVersion[260]"
; ==============================================================================
; #### Device Interface Classes ####
; ==============================================================================
; #### Device Interface Classes for Modem Devices ####
; ==============================================================================
Const $GUID_DEVINTERFACE_MODEM = "{2C7089AA-2E0E-11D1-B114-00C04FC2AAE4}"
; ==============================================================================
; #### Device Interface Classes for Network Devices ####
; ==============================================================================
Const $GUID_DEVINTERFACE_NET = "{CAC88484-7515-4C03-82E6-71A87ABAC361}"
; ==============================================================================
; #### Device Interface Classes for Storage Devices ####
; ==============================================================================
Const $GUID_DEVINTERFACE_CDCHANGER = "{53F56312-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_CDROM = "{53F56308-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_DISK = "{53F56307-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_FLOPPY = "{53F56311-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_MEDIUMCHANGER = "{53F56310-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_PARTITION = "{53F5630A-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_STORAGEPORT = "{2ACCFE60-C130-11D2-B082-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_TAPE = "{53F5630B-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_VOLUME = "{53F5630D-B6BF-11D0-94F2-00A0C91EFB8B}"
Const $GUID_DEVINTERFACE_WRITEONCEDISK = "{53F5630C-B6BF-11D0-94F2-00A0C91EFB8B}"
; ==============================================================================
; #### Device Interface Classes for USB Devices ####
; ==============================================================================
Const $GUID_DEVINTERFACE_USB_HUB = "{F18A0E88-C30C-11D0-8815-00A0C906BED8}"
Const $GUID_DEVINTERFACE_USB_HOST_CONTROLLER = "{3ABF6F2D-71C4-462A-8A92-1E6861E6AF27}"
Const $GUID_DEVINTERFACE_USB_DEVICE = "{A5DCBF10-6530-11D2-901F-00C04FB951ED}"
Const $GUID_DEVINTERFACE_USBSTOR = "{A5DCBF10-6530-11D2-901F-00C04FB951ED}"
; ==============================================================================
; #### Device Interface Classes for Display and Image Devices ####
; ==============================================================================
Const $GUID_DEVINTERFACE_BRIGHTNESS = "{FDE5BBA4-B3F9-46FB-BDAA-0728CE3100B4}"
Const $GUID_DEVINTERFACE_DISPLAY_ADAPTER = "{5B45201D-F2F2-4F3B-85BB-30FF1F953599}"
Const $GUID_DEVINTERFACE_I2C = "{2564AA4F-DDDB-4495-B497-6AD4A84163D7}"
Const $GUID_DEVINTERFACE_IMAGE = "{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}"
Const $GUID_DEVINTERFACE_MONITOR = "{E6F07B5F-EE97-4a90-B076-33F57BF4EAA7}"
Const $GUID_DEVINTERFACE_OPM = "{BF4672DE-6B4E-4BE4-A325-68A91EA49C09}"
Const $GUID_DEVINTERFACE_VIDEO_OUTPUT_ARRIVAL = "{1AD9E4F0-F88D-4360-BAB9-4C2D55E564CD}"
; ==============================================================================
; #### Device Interface Classes for Interactive Input Devices ####
; ==============================================================================
Const $GUID_DEVINTERFACE_HID = "{4D1E55B2-F16F-11CF-88CB-001111000030}"
Const $GUID_DEVINTERFACE_KEYBOARD = "{884B96C3-56EF-11D1-BC8C-00A0C91405DD}"
Const $GUID_DEVINTERFACE_MOUSE = "{378DE44C-56EF-11D1-BC8C-00A0C91405DD}"
; ==============================================================================
; #### Device Interface Classes for Bluetooth Devices ####
; ==============================================================================
Const $GUID_BTHPORT_DEVICE_INTERFACE = "{0850302A-B344-4fda-9BE9-90576B8D46F0}"
; ==============================================================================
; #### Device Interface Classes for Battery, Disk Manager, 1394 Host Controller ... #### (??)
; ==============================================================================
Const $GUID_DEVINTERFACE_DVD = "{1186654d-47b8-48b9-beb9-7df113ae3c67}" ; ??
Const $GUID_DEVINTERFACE_FLASHMEDIA = "{2c9f2281-eb3c-11d6-80af-0001020c74d4}"
Const $GUID_DEVINTERFACE_SYSTEM_BUTTON = "{4afa3d53-74a7-11d0-be5e-00a0c9062857}"
Const $GUID_DEVINTERFACE_DISKDRIVE = "{53f5630e-b6bf-11d0-94f2-00a0c91efb8b}"
Const $GUID_DEVINTERFACE_HDAUDIO = "{54c9343c-2a17-42e8-b4fd-9f9da27b94d6}"
Const $GUID_DEVINTERFACE_AUDIO_ADAPTER = "{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
Const $GUID_DEVINTERFACE_IEEE_1394_HOST_CONTROLLER = "{6bdd1fc1-810f-11d0-bec7-08002be2092f}"
Const $GUID_DEVINTERFACE_BATTERY = "{72631e54-78a4-11d0-bcf7-00aa00b7b32a}"
Const $GUID_DEVINTERFACE_STD_MODEM = "{86e0d1e0-8089-11d0-9ce4-08003e301f73}"
Const $GUID_DEVINTERFACE_PROCESSOR = "{97fadb10-4e33-40ae-359c-8bef029dbdd0}"
Const $GUID_DEVINTERFACE_NDIS = "{ad498944-762f-11d0-8dcb-00c04fc3358c}"
Const $GUID_DEVINTERFACE_HDAUDIO_MODEM = "{adb44c00-1b8d-11d4-8d5e-00a0c90d1c42}"
; ==============================================================================
; #### Device Interface Classes for Battery and ACPI Devices
; ==============================================================================
Const $GUID_DEVICE_APPLICATIONLAUNCH_BUTTON = "{629758EE-986E-4D9E-8E47-DE27F8AB054D}"
Const $GUID_DEVICE_BATTERY = "{72631E54-78A4-11D0-BCF7-00AA00B7B32A}"
Const $GUID_DEVICE_LID = "{4AFA3D52-74A7-11d0-be5e-00A0C9062857}"
Const $GUID_DEVICE_MEMORY = "{3FD0F03D-92E0-45FB-B75C-5ED8FFB01021}"
Const $GUID_DEVICE_MESSAGE_INDICATOR = "{CD48A365-FA94-4CE2-A232-A1B764E5D8B4}"
Const $GUID_DEVICE_PROCESSOR = "{97FADB10-4E33-40AE-359C-8BEF029DBDD0}"
Const $GUID_DEVICE_SYS_BUTTON = "{4AFA3D53-74A7-11d0-be5e-00A0C9062857}"
Const $GUID_DEVICE_THERMAL_ZONE = "{4AFA3D51-74A7-11d0-be5e-00A0C9062857}"
; ==============================================================================
; #### Resource Descriptor Structures ####
; ==============================================================================
Const $tagDMA_DES = "dword Count;dword Type;dword Flags;ulong AllocChannel"
Const $tagIO_DES = "dword Count;dword Type;int64 AllocBase;int64 AllocEnd;dword Flags"
Const $tagMEM_DES = $tagIO_DES & ";dword Reserved"
Const $tagIRQ_DES = "dword Count;dword Type;dword Flags;ulong AllocNum;ulong Affinity"
Const $tagBUSNUMBER_DES = "dword Count;dword Type;dword Flags;ulong AllocBase;ulong AllocEnd"
Const $tagMFCARD_DES = "dword Count;dword Type;dword Flags;byte ConfigOptions;byte IoResIndex;byte Reserved[2];dword ConfigRegisterBase"
Const $tagPCCARD_DES = "dword Count;dword Type;dword Flags;byte ConfigIndex;byte Reserved[3];dword MemCardBase1;dword MemCardBase2"
Const $tagCS_DES = "dword SignatureLength;dword LegacyDataOffset;dword LegacyDataSize;dword Flags;byte Guid[16]"
Const $tagCONFLICT_DETAILS = "ulong Size;ulong Mask;dword DevInst;int ResDes;ulong Flags;char Descr[260]"
; ==============================================================================
; #### Device Power State Constants ####
; ==============================================================================
Const $PDCAP_D0_SUPPORTED = 1
Const $PDCAP_D1_SUPPORTED = 2
Const $PDCAP_D2_SUPPORTED = 4
Const $PDCAP_D3_SUPPORTED = 8
Const $PDCAP_S0_SUPPORTED = 0x10000
Const $PDCAP_S1_SUPPORTED = 0x20000
Const $PDCAP_S2_SUPPORTED = 0x40000
Const $PDCAP_S3_SUPPORTED = 0x80000
Const $PDCAP_S4_SUPPORTED = 0x1000000
Const $PDCAP_S5_SUPPORTED = 0x2000000
Const $PDCAP_WAKE_FROM_D0_SUPPORTED = 0x10
Const $PDCAP_WAKE_FROM_D1_SUPPORTED = 0x20
Const $PDCAP_WAKE_FROM_D2_SUPPORTED = 0x40
Const $PDCAP_WAKE_FROM_D3_SUPPORTED = 0x80
Const $PDCAP_WAKE_FROM_S0_SUPPORTED = 0x100000
Const $PDCAP_WAKE_FROM_S1_SUPPORTED = 0x200000
Const $PDCAP_WAKE_FROM_S2_SUPPORTED = 0x400000
Const $PDCAP_WAKE_FROM_S3_SUPPORTED = 0x800000
Const $PDCAP_WARM_EJECT_SUPPORTED = 0x100
; ==============================================================================
; #### Flags for the SPDRP_CONFIGFLAGS in SetupDiGetDeviceRegistryProperty ####
; ==============================================================================
Const $CONFIGFLAG_DISABLED = 0x00000001 ; Set if disabled
Const $CONFIGFLAG_REMOVED = 0x00000002 ; Set if a present hardware enum device deleted
Const $CONFIGFLAG_MANUAL_INSTALL = 0x00000004 ; Set if the devnode was manually installed
Const $CONFIGFLAG_IGNORE_BOOT_LC = 0x00000008 ; Set if skip the boot config
Const $CONFIGFLAG_NET_BOOT = 0x00000010 ; Load this devnode when in net boot
Const $CONFIGFLAG_REINSTALL = 0x00000020 ; Redo install
Const $CONFIGFLAG_FAILEDINSTALL = 0x00000040 ; Failed the install
Const $CONFIGFLAG_CANTSTOPACHILD = 0x00000080 ; Can't stop/remove a single child
Const $CONFIGFLAG_OKREMOVEROM = 0x00000100 ; Can remove even if rom.
Const $CONFIGFLAG_NOREMOVEEXIT = 0x00000200 ; Don't remove at exit.
Const $CONFIGFLAG_FINISH_INSTALL = 0x00000400 ; Complete install for devnode running 'raw'
Const $CONFIGFLAG_NEEDS_FORCED_CONFIG = 0x00000800 ; This devnode requires a forced config
Const $CSCONFIGFLAG_BITS = 0x00000007 ; OR of below bits
Const $CSCONFIGFLAG_NONE = 0
Const $CSCONFIGFLAG_DISABLED = 0x00000001 ; Set if
Const $CSCONFIGFLAG_DO_NOT_CREATE = 0x00000002 ; Set if
Const $CSCONFIGFLAG_DO_NOT_START = 0x00000004 ; Set if
; ==============================================================================
; #### Device Registry Key Constants ####
; ==============================================================================
Const $REGKEY_HARDWARE_CS001_001 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Hardware Profiles\0001\System\CurrentControlSet\Enum\"
Const $REGKEY_HARDWARE_CS002_001 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Hardware Profiles\0001\System\CurrentControlSet\Enum\"
Const $REGKEY_HARDWARE_CS002_CURRENT = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Hardware Profiles\Current\System\CurrentControlSet\Enum\"
Const $REGKEY_HARDWARE_CCS_001 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001\System\CurrentControlSet\Enum\"
Const $REGKEY_HARDWARE_CCS_CURRENT = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Enum\"
Const $REGKEY_HARDWARE_CS002_ENUM = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Enum\"
; ==============================================================================
; #### Device Registry Property Structure(s) ####
; ==============================================================================
Const $tagCM_POWER_DATA = "ulong Size;int MostRecentPowerState;ulong Capabilities;ulong D1Latency;ulong D2Latency;ulong D3Latency;int PowerStateMapping[7];int DeepestSystemWake"
Const $tagHWPROFILE_INFO = "ulong HWProfile;char FriendlyName[80];dword Flags"
; ==============================================================================
; #### Configuration Priority Value ####
; ==============================================================================
Const $LCPRI_FORCECONFIG = 0x00000000 ; Coming from a forced config
Const $LCPRI_BOOTCONFIG = 0x00000001 ; Coming from a boot config
Const $LCPRI_DESIRED = 0x00002000 ; Preferable (better performance)
Const $LCPRI_NORMAL = 0x00003000 ; Workable (acceptable performance)
Const $LCPRI_LASTBESTCONFIG = 0x00003FFF ; CM only--do not use
Const $LCPRI_SUBOPTIMAL = 0x00005000 ; Not desired, but will work
Const $LCPRI_LASTSOFTCONFIG = 0x00007FFF ; CM only--do not use
Const $LCPRI_RESTART = 0x00008000 ; Need to restart
Const $LCPRI_REBOOT = 0x00009000 ; Need to reboot
Const $LCPRI_POWEROFF = 0x0000A000 ; Need to shutdown/power-off
Const $LCPRI_HARDRECONFIG = 0x0000C000 ; Need to change a jumper
Const $LCPRI_HARDWIRED = 0x0000E000 ; Cannot be changed
Const $LCPRI_IMPOSSIBLE = 0x0000F000 ; Impossible configuration
Const $LCPRI_DISABLED = 0x0000FFFF ; Disabled configuration
Const $MAX_LCPRI = 0x0000FFFF ; Maximum known LC Priority
; ==============================================================================
; #### Device Manager Error Code ####
; ==============================================================================
Const $CM_PROB_NOT_CONFIGURED = 0x00000001 ; no config for device
Const $CM_PROB_DEVLOADER_FAILED = 0x00000002 ; service load failed
Const $CM_PROB_OUT_OF_MEMORY = 0x00000003 ; out of memory
Const $CM_PROB_ENTRY_IS_WRONG_TYPE = 0x00000004 ;
Const $CM_PROB_LACKED_ARBITRATOR = 0x00000005 ;
Const $CM_PROB_BOOT_CONFIG_CONFLICT = 0x00000006 ; boot config conflict
Const $CM_PROB_FAILED_FILTER = 0x00000007 ;
Const $CM_PROB_DEVLOADER_NOT_FOUND = 0x00000008 ; Devloader not found
Const $CM_PROB_INVALID_DATA = 0x00000009 ;
Const $CM_PROB_FAILED_START = 0x0000000A ;
Const $CM_PROB_LIAR = 0x0000000B ;
Const $CM_PROB_NORMAL_CONFLICT = 0x0000000C ; config conflict
Const $CM_PROB_NOT_VERIFIED = 0x0000000D ;
Const $CM_PROB_NEED_RESTART = 0x0000000E ; requires restart
Const $CM_PROB_REENUMERATION = 0x0000000F ;
Const $CM_PROB_PARTIAL_LOG_CONF = 0x00000010 ;
Const $CM_PROB_UNKNOWN_RESOURCE = 0x00000011 ; unknown res type
Const $CM_PROB_REINSTALL = 0x00000012 ;
Const $CM_PROB_REGISTRY = 0x00000013 ;
Const $CM_PROB_VXDLDR = 0x00000014 ; WINDOWS 95 ONLY
Const $CM_PROB_WILL_BE_REMOVED = 0x00000015 ; devinst will remove
Const $CM_PROB_DISABLED = 0x00000016 ; devinst is disabled
Const $CM_PROB_DEVLOADER_NOT_READY = 0x00000017 ; Devloader not ready
Const $CM_PROB_DEVICE_NOT_THERE = 0x00000018 ; device doesn't exist
Const $CM_PROB_MOVED = 0x00000019 ;
Const $CM_PROB_TOO_EARLY = 0x0000001A ;
Const $CM_PROB_NO_VALID_LOG_CONF = 0x0000001B ; no valid log config
Const $CM_PROB_FAILED_INSTALL = 0x0000001C ; install failed
Const $CM_PROB_HARDWARE_DISABLED = 0x0000001D ; device disabled
Const $CM_PROB_CANT_SHARE_IRQ = 0x0000001E ; can't share IRQ
Const $CM_PROB_FAILED_ADD = 0x0000001F ; driver failed add
Const $CM_PROB_DISABLED_SERVICE = 0x00000020 ; service's Start = 4
Const $CM_PROB_TRANSLATION_FAILED = 0x00000021 ; resource translation failed
Const $CM_PROB_NO_SOFTCONFIG = 0x00000022 ; no soft config
Const $CM_PROB_BIOS_TABLE = 0x00000023 ; device missing in BIOS table
Const $CM_PROB_IRQ_TRANSLATION_FAILED = 0x00000024 ; IRQ translator failed
Const $CM_PROB_FAILED_DRIVER_ENTRY = 0x00000025 ; DriverEntry() failed.
Const $CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD = 0x00000026 ; Driver should have unloaded.
Const $CM_PROB_DRIVER_FAILED_LOAD = 0x00000027 ; Driver load unsuccessful.
Const $CM_PROB_DRIVER_SERVICE_KEY_INVALID = 0x00000028 ; Error accessing driver's service key
Const $CM_PROB_LEGACY_SERVICE_NO_DEVICES = 0x00000029 ; Loaded legacy service created no devices
Const $CM_PROB_DUPLICATE_DEVICE = 0x0000002A ; Two devices were discovered with the same name
Const $CM_PROB_FAILED_POST_START = 0x0000002B ; The drivers set the device state to failed
Const $CM_PROB_HALTED = 0x0000002C ; This device was failed post start via usermode
Const $CM_PROB_PHANTOM = 0x0000002D ; The devinst currently exists only in the registry
Const $CM_PROB_SYSTEM_SHUTDOWN = 0x0000002E ; The system is shutting down
Const $CM_PROB_HELD_FOR_EJECT = 0x0000002F ; The device is offline awaiting removal
Const $CM_PROB_DRIVER_BLOCKED = 0x00000030 ; One or more drivers is blocked from loading
Const $CM_PROB_REGISTRY_TOO_LARGE = 0x00000031 ; System hive has grown too large
Const $NUM_CM_PROB = 0x00000032;
; ==============================================================================
; #### Flags for _CM_Locate_DevNode ####
; ====================================================================================
Const $CM_LOCATE_DEVNODE_NORMAL = 0x00000000
Const $CM_LOCATE_DEVNODE_PHANTOM = 0x00000001
Const $CM_LOCATE_DEVNODE_CANCELREMOVE = 0x00000002
Const $CM_LOCATE_DEVNODE_NOVALIDATION = 0x00000004
Const $CM_LOCATE_DEVNODE_BITS = 0x00000007
Const $CM_LOCATE_DEVINST_NORMAL = $CM_LOCATE_DEVNODE_NORMAL
Const $CM_LOCATE_DEVINST_PHANTOM = $CM_LOCATE_DEVNODE_PHANTOM
Const $CM_LOCATE_DEVINST_CANCELREMOVE = $CM_LOCATE_DEVNODE_CANCELREMOVE
Const $CM_LOCATE_DEVINST_NOVALIDATION = $CM_LOCATE_DEVNODE_NOVALIDATION
Const $CM_LOCATE_DEVINST_BITS = $CM_LOCATE_DEVNODE_BITS
; ====================================================================================
; #### Flags for _CM_Get_Device_ID_List, _CM_Get_Device_ID_List_Size ####
; ====================================================================================
Const $CM_GETIDLIST_FILTER_NONE = 0x00000000
Const $CM_GETIDLIST_FILTER_ENUMERATOR = 0x00000001
Const $CM_GETIDLIST_FILTER_SERVICE = 0x00000002
Const $CM_GETIDLIST_FILTER_EJECTRELATIONS = 0x00000004
Const $CM_GETIDLIST_FILTER_REMOVALRELATIONS = 0x00000008
Const $CM_GETIDLIST_FILTER_POWERRELATIONS = 0x00000010
Const $CM_GETIDLIST_FILTER_BUSRELATIONS = 0x00000020
Const $CM_GETIDLIST_DONOTGENERATE = 0x10000040
Const $CM_GETIDLIST_FILTER_BITS = 0x1000007F
; ====================================================================================
; #### Flags for CM_Get_Device_Interface_List, CM_Get_Device_Interface_List_Size ####
; ====================================================================================
Const $CM_GET_DEVICE_INTERFACE_LIST_PRESENT = 0x00000000 ; only currently 'live' device interfaces
Const $CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES = 0x00000001 ; all registered device interfaces
Const $CM_GET_DEVICE_INTERFACE_LIST_BITS = 0x00000001
; ====================================================================================
; #### Flags for _CM_Reenumerate_DevNode ####
; ====================================================================================
Const $CM_REENUMERATE_NORMAL = 0x00000000
Const $CM_REENUMERATE_SYNCHRONOUS = 0x00000001
Const $CM_REENUMERATE_BITS = 0x00000001
; ====================================================================================
; #### Flags for _CM_Query_And_Remove_SubTree ####
; ====================================================================================
Const $CM_REMOVE_UI_OK = 0x00000000
Const $CM_REMOVE_UI_NOT_OK = 0x00000001
Const $CM_REMOVE_NO_RESTART = 0x00000002
Const $CM_REMOVE_BITS = 0x00000003
; ====================================================================================
; #### Flags for _CM_Add_ID ####
; ====================================================================================
Const $CM_ADD_ID_HARDWARE = 0x00000000
Const $CM_ADD_ID_COMPATIBLE = 0x00000001
Const $CM_ADD_ID_BITS = 0x00000001
; ====================================================================================
; #### Flags for _CM_Get_First_Log_Conf ####
; ====================================================================================
Const $BASIC_LOG_CONF = 0x00000000 ; Specifies the req list.
Const $FILTERED_LOG_CONF = 0x00000001 ; Specifies the filtered req list.
Const $ALLOC_LOG_CONF = 0x00000002 ; Specifies the Alloc Element.
Const $BOOT_LOG_CONF = 0x00000003 ; Specifies the RM Alloc Element.
Const $FORCED_LOG_CONF = 0x00000004 ; Specifies the Forced Log Conf
Const $OVERRIDE_LOG_CONF = 0x00000005 ; Specifies the Override req list.
Const $NUM_LOG_CONF = 0x00000006 ; Number of Log Conf type
Const $LOG_CONF_BITS = 0x00000007 ; The bits of the log conf type.
; =====================================================================================
; #### Property for _SetupDiGetDeviceRegistryProperty ####
; ==============================================================================
Const $SPDRP_DEVICEDESC = 0x00000000 ; DeviceDesc (R/W)
Const $SPDRP_HARDWAREID = 0x00000001 ; HardwareID (R/W)
Const $SPDRP_COMPATIBLEIDS = 0x00000002 ; CompatibleIDs (R/W)
Const $SPDRP_NTDEVICEPATHS = 0x00000003 ; Unsupported, DO NOT USE
Const $SPDRP_SERVICE = 0x00000004 ; Service (R/W)
Const $SPDRP_CONFIGURATION = 0x00000005 ; Configuration (R)
Const $SPDRP_CONFIGURATIONVECTOR = 0x00000006 ; ConfigurationVector (R)
Const $SPDRP_CLASS = 0x00000007 ; Class (R)--tied to ClassGUID
Const $SPDRP_CLASSGUID = 0x00000008 ; ClassGUID (R/W)
Const $SPDRP_DRIVER = 0x00000009 ; Driver (R/W)
Const $SPDRP_CONFIGFLAGS = 0x0000000A ; ConfigFlags (R/W)
Const $SPDRP_MFG = 0x0000000B ; Mfg (R/W)
Const $SPDRP_FRIENDLYNAME = 0x0000000C ; FriendlyName (R/W)
Const $SPDRP_LOCATION_INFORMATION = 0x0000000D ; LocationInformation (R/W)
Const $SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000E ; PhysicalDeviceObjectName (R)
Const $SPDRP_CAPABILITIES = 0x0000000F ; Capabilities (R)
Const $SPDRP_UI_NUMBER = 0x00000010 ; UiNumber (R)
Const $SPDRP_UPPERFILTERS = 0x00000011 ; UpperFilters (R/W)
Const $SPDRP_LOWERFILTERS = 0x00000012 ; LowerFilters (R/W)
Const $SPDRP_MAXIMUM_PROPERTY = 0x00000013 ; Upper bound on ordinals
Const $SPDRP_REMOVAL_POLICY = 0x1F
Const $SPDRP_REMOVAL_POLICY_HW_DEFAULT = 0x20
; ==============================================================================
; #### Removal policies (retrievable via _SetupDiGetDeviceRegistryProperty with
; the SPDRP_REMOVAL_POLICY, or SPDRP_REMOVAL_POLICY_HW_DFAULT properties) ####
; ====================================================================================
Const $CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL = 1
Const $CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL = 2
Const $CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL = 3
; ====================================================================================
; Re-enable and configuration actions (specified in call to _CM_Setup_DevInst)
; ===================================================================================
Const $CM_SETUP_DEVNODE_READY = 0x00000000; Reenable problem devinst
Const $CM_SETUP_DEVINST_READY = $CM_SETUP_DEVNODE_READY
Const $CM_SETUP_DOWNLOAD = 0x00000001; Get info about devinst
Const $CM_SETUP_WRITE_LOG_CONFS = 0x00000002
Const $CM_SETUP_PROP_CHANGE = 0x00000003
Const $CM_SETUP_DEVNODE_RESET = 0x00000004; Reset problem devinst without starting
Const $CM_SETUP_DEVINST_RESET = $CM_SETUP_DEVNODE_RESET
Const $CM_SETUP_BITS = 0x00000007
; ===================================================================================
; #### Flags for _CM_Set_DevNode_Problem ####
; ====================================================================================
Const $CM_SET_DEVNODE_PROBLEM_NORMAL = 0x00000000 ; only set problem if currently no problem
Const $CM_SET_DEVNODE_PROBLEM_OVERRIDE = 0x00000001 ; override current problem with new.
Const $CM_SET_DEVNODE_PROBLEM_BITS = 0x00000001
Const $CM_SET_DEVINST_PROBLEM_NORMAL = $CM_SET_DEVNODE_PROBLEM_NORMAL
Const $CM_SET_DEVINST_PROBLEM_OVERRIDE = $CM_SET_DEVNODE_PROBLEM_OVERRIDE
Const $CM_SET_DEVINST_PROBLEM_BITS = $CM_SET_DEVNODE_PROBLEM_BITS
; ====================================================================================
; #### DIF (device installation function) code ####
; ====================================================================================
Const $DIF_SELECTDEVICE = 0x00000001
Const $DIF_INSTALLDEVICE = 0x00000002
Const $DIF_ASSIGNRESOURCES = 0x00000003
Const $DIF_PROPERTIES = 0x00000004
Const $DIF_REMOVE = 0x00000005
Const $DIF_FIRSTTIMESETUP = 0x00000006
Const $DIF_FOUNDDEVICE = 0x00000007
Const $DIF_SELECTCLASSDRIVERS = 0x00000008
Const $DIF_VALIDATECLASSDRIVERS = 0x00000009
Const $DIF_INSTALLCLASSDRIVERS = 0x0000000A
Const $DIF_CALCDISKSPACE = 0x0000000B
Const $DIF_DESTROYPRIVATEDATA = 0x0000000C
Const $DIF_VALIDATEDRIVER = 0x0000000D
Const $DIF_MOVEDEVICE = 0x0000000E
Const $DIF_DETECT = 0x0000000F
Const $DIF_INSTALLWIZARD = 0x00000010
Const $DIF_DESTROYWIZARDDATA = 0x00000011
Const $DIF_PROPERTYCHANGE = 0x00000012
Const $DIF_ENABLECLASS = 0x00000013
Const $DIF_DETECTVERIFY = 0x00000014
Const $DIF_INSTALLDEVICEFILES = 0x00000015
Const $DIF_UNREMOVE = 0x00000016
Const $DIF_SELECTBESTCOMPATDRV = 0x00000017
Const $DIF_ALLOW_INSTALL = 0x00000018
Const $DIF_REGISTERDEVICE = 0x00000019
Const $DIF_INSTALLINTERFACES = 0x00000020
Const $DIF_DETECTCANCEL = 0x00000021
Const $DIF_REGISTER_COINSTALLERS = 0x00000022
Const $DIF_POWERMESSAGEWAKE = 0x27
; ====================================================================================
; #### Configuration Manager return status codes ####
; ====================================================================================
Const $CR_SUCCESS = 0x00000000
Const $CR_DEFAULT = 0x00000001
Const $CR_OUT_OF_MEMORY = 0x00000002
Const $CR_INVALID_POINTER = 0x00000003
Const $CR_INVALID_FLAG = 0x00000004
Const $CR_INVALID_DEVNODE = 0x00000005
Const $CR_INVALID_DEVINST = $CR_INVALID_DEVNODE
Const $CR_INVALID_RES_DES = 0x00000006
Const $CR_INVALID_LOG_CONF = 0x00000007
Const $CR_INVALID_ARBITRATOR = 0x00000008
Const $CR_INVALID_NODELIST = 0x00000009
Const $CR_DEVNODE_HAS_REQS = 0x0000000A
Const $CR_DEVINST_HAS_REQS = $CR_DEVNODE_HAS_REQS
Const $CR_INVALID_RESOURCEID = 0x0000000B
Const $CR_DLVXD_NOT_FOUND = 0x0000000C ; WIN 95 ONLY
Const $CR_NO_SUCH_DEVNODE = 0x0000000D
Const $CR_NO_SUCH_DEVINST = $CR_NO_SUCH_DEVNODE
Const $CR_NO_MORE_LOG_CONF = 0x0000000E
Const $CR_NO_MORE_RES_DES = 0x0000000F
Const $CR_ALREADY_SUCH_DEVNODE = 0x00000010
Const $CR_ALREADY_SUCH_DEVINST = $CR_ALREADY_SUCH_DEVNODE
Const $CR_INVALID_RANGE_LIST = 0x00000011
Const $CR_INVALID_RANGE = 0x00000012
Const $CR_FAILURE = 0x00000013
Const $CR_NO_SUCH_LOGICAL_DEV = 0x00000014
Const $CR_CREATE_BLOCKED = 0x00000015
Const $CR_NOT_SYSTEM_VM = 0x00000016 ; WIN 95 ONLY
Const $CR_REMOVE_VETOED = 0x00000017
Const $CR_APM_VETOED = 0x00000018
Const $CR_INVALID_LOAD_TYPE = 0x00000019
Const $CR_BUFFER_SMALL = 0x0000001A
Const $CR_NO_ARBITRATOR = 0x0000001B
Const $CR_NO_REGISTRY_HANDLE = 0x0000001C
Const $CR_REGISTRY_ERROR = 0x0000001D
Const $CR_INVALID_DEVICE_ID = 0x0000001E
Const $CR_INVALID_DATA = 0x0000001F
Const $CR_INVALID_API = 0x00000020
Const $CR_DEVLOADER_NOT_READY = 0x00000021
Const $CR_NEED_RESTART = 0x00000022
Const $CR_NO_MORE_HW_PROFILES = 0x00000023
Const $CR_DEVICE_NOT_THERE = 0x00000024
Const $CR_NO_SUCH_VALUE = 0x00000025
Const $CR_WRONG_TYPE = 0x00000026
Const $CR_INVALID_PRIORITY = 0x00000027
Const $CR_NOT_DISABLEABLE = 0x00000028
Const $CR_FREE_RESOURCES = 0x00000029
Const $CR_QUERY_VETOED = 0x0000002A
Const $CR_CANT_SHARE_IRQ = 0x0000002B
Const $CR_NO_DEPENDENT = 0x0000002C
Const $CR_SAME_RESOURCES = 0x0000002D
Const $CR_NO_SUCH_REGISTRY_KEY = 0x0000002E
Const $CR_INVALID_MACHINENAME = 0x0000002F ; NT ONLY
Const $CR_REMOTE_COMM_FAILURE = 0x00000030 ; NT ONLY
Const $CR_MACHINE_UNAVAILABLE = 0x00000031 ; NT ONLY
Const $CR_NO_CM_SERVICES = 0x00000032 ; NT ONLY
Const $CR_ACCESS_DENIED = 0x00000033 ; NT ONLY
Const $CR_CALL_NOT_IMPLEMENTED = 0x00000034
Const $CR_INVALID_PROPERTY = 0x00000035
Const $CR_DEVICE_INTERFACE_ACTIVE = 0x00000036
Const $CR_NO_SUCH_DEVICE_INTERFACE = 0x00000037
Const $CR_INVALID_REFERENCE_STRING = 0x00000038
Const $CR_INVALID_CONFLICT_LIST = 0x00000039
Const $CR_INVALID_INDEX = 0x0000003A
Const $CR_INVALID_STRUCTURE_SIZE = 0x0000003B
Const $NUM_CR_RESULTS = 0x0000003C
; ====================================================================================
; #### Resource Type for _CM_Get_Next_Res_Des ####
; ====================================================================================
Const $RESTYPE_ALL = 0x00000000 ; Return all resource types
Const $RESTYPE_NONE = 0x00000000 ; Arbitration always succeeded
Const $RESTYPE_MEM = 0x00000001 ; Physical address resource
Const $RESTYPE_IO = 0x00000002 ; Physical I/O address resource
Const $RESTYPE_DMA = 0x00000003 ; DMA channels resource
Const $RESTYPE_IRQ = 0x00000004 ; IRQ resource
Const $RESTYPE_DONOTUSE = 0x00000005 ; Used as spacer to sync subsequent ResTypes w/NT
Const $RESTYPE_BUSNUMBER = 0x00000006 ; bus number resource
Const $RESTYPE_MAX = 0x00000006 ; Maximum known (arbitrated ResType
Const $RESTYPE_IGNORED_BIT = 0x00008000 ; Ignore this resource
Const $RESTYPE_CLASSSPECIFIC = 0x0000FFFF ; class-specific resource
Const $RESTYPE_RESERVED = 0x00008000 ; reserved for internal use
Const $RESTYPE_DEVICEPRIVAT = 0x00008001 ; device private data
Const $RESTYPE_PCCARDCONFIG = 0x00008002 ; PC Card configuration data
Const $RESTYPE_MFCARDCONFIG = 0x00008003 ; MF Card configuration data
; ====================================================================================
; #### Registry properties for device instance ####
; =====================================================================================
Const $CM_DRP_DEVICEDESC = 0x00000001 ; DeviceDesc REG_SZ property (RW)
Const $CM_DRP_HARDWAREID = 0x00000002 ; HardwareID REG_MULTI_SZ property (RW)
Const $CM_DRP_COMPATIBLEIDS = 0x00000003 ; CompatibleIDs REG_MULTI_SZ property (RW)
Const $CM_DRP_UNUSED0 = 0x00000004 ; unused
Const $CM_DRP_SERVICE = 0x00000005 ; Service REG_SZ property (RW)
Const $CM_DRP_UNUSED1 = 0x00000006 ; unused
Const $CM_DRP_UNUSED2 = 0x00000007 ; unused
Const $CM_DRP_CLASS = 0x00000008 ; Class REG_SZ property (RW)
Const $CM_DRP_CLASSGUID = 0x00000009 ; ClassGUID REG_SZ property (RW)
Const $CM_DRP_DRIVER = 0x0000000A ; Driver REG_SZ property (RW)
Const $CM_DRP_CONFIGFLAGS = 0x0000000B ; ConfigFlags REG_DWORD property (RW)
Const $CM_DRP_MFG = 0x0000000C ; Mfg REG_SZ property (RW)
Const $CM_DRP_FRIENDLYNAME = 0x0000000D ; FriendlyName REG_SZ property (RW)
Const $CM_DRP_LOCATION_INFORMATION = 0x0000000E ; LocationInformation REG_SZ property (RW)
Const $CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000F ; PhysicalDeviceObjectName REG_SZ property (R)
Const $CM_DRP_CAPABILITIES = 0x00000010 ; Capabilities REG_DWORD property (R)
Const $CM_DRP_UI_NUMBER = 0x00000011 ; UiNumber REG_DWORD property (R)
Const $CM_DRP_UPPERFILTERS = 0x00000012 ; UpperFilters REG_MULTI_SZ property (RW)
Const $CM_DRP_LOWERFILTERS = 0x00000013 ; LowerFilters REG_MULTI_SZ property (RW)
Const $CM_DRP_BUSTYPEGUID = 0x00000014 ; Bus Type Guid, GUID, (R)
Const $CM_DRP_LEGACYBUSTYPE = 0x00000015 ; Legacy bus type, INTERFACE_TYPE, (R)
Const $CM_DRP_BUSNUMBER = 0x00000016 ; Bus Number, DWORD, (R)
Const $CM_DRP_ENUMERATOR_NAME = 0x00000017 ; Enumerator Name REG_SZ property (R)
Const $CM_DRP_SECURITY = 0x00000018 ; Security - Device override (RW)
Const $CM_CRP_SECURITY = $CM_DRP_SECURITY ; Class default security (RW)
Const $CM_DRP_SECURITY_SDS = 0x00000019 ; Security - Device override (RW)
Const $CM_CRP_SECURITY_SDS = $CM_DRP_SECURITY_SDS ; Class default security (RW)
Const $CM_DRP_DEVTYPE = 0x0000001A ; Device Type - Device override (RW)
Const $CM_CRP_DEVTYPE = $CM_DRP_DEVTYPE ; Class default Device-type (RW)
Const $CM_DRP_EXCLUSIVE = 0x0000001B ; Exclusivity - Device override (RW)
Const $CM_CRP_EXCLUSIVE = $CM_DRP_EXCLUSIVE ; Class default (RW)
Const $CM_DRP_CHARACTERISTICS = 0x0000001C ; Characteristics - Device Override (RW)
Const $CM_CRP_CHARACTERISTICS = $CM_DRP_CHARACTERISTICS ; Class default (RW)
Const $CM_DRP_ADDRESS = 0x0000001D ; Device Address (R)
Const $CM_DRP_UI_NUMBER_DESC_FORMAT = 0x0000001E ; UINumberDescFormat REG_SZ property (RW)
Const $CM_DRP_DEVICE_POWER_DATA = 0x0000001F ; CM_POWER_DATA REG_BINARY property (R)
Const $CM_DRP_REMOVAL_POLICY = 0x00000020 ; CM_DEVICE_REMOVAL_POLICY REG_DWORD (R)
Const $CM_DRP_REMOVAL_POLICY_HW_DEFAULT = 0x00000021 ; CM_DRP_REMOVAL_POLICY_HW_DEFAULT REG_DWORD (R)
Const $CM_DRP_REMOVAL_POLICY_OVERRIDE = 0x00000022 ; CM_DRP_REMOVAL_POLICY_OVERRIDE REG_DWORD (RW)
Const $CM_DRP_INSTALL_STATE = 0x00000023 ; CM_DRP_INSTALL_STATE REG_DWORD (R)
Const $CM_DRP_MIN = 0x00000001 ; First device register
Const $CM_CRP_MIN = $CM_DRP_MIN ; First class register
Const $CM_DRP_MAX = 0x00000023 ; Last device register
Const $CM_CRP_MAX = $CM_DRP_MAX ; Last class register
; =====================================================================================
; #### Flags for MEM_DES.Flags ####
; =====================================================================================
Const $MMD_MemoryType = 0x1 ; Bitmask, whether memory is writable
Const $FMD_MemoryType = $MMD_MemoryType ; compatibility
Const $FMD_ROM = 0x0 ; Memory range is read-only
Const $FMD_RAM = 0x1 ; Memory range may be written to
Const $MMD_32_24 = 0x2 ; Bitmask, memory is 24 or 32-bit
Const $FMD_32_24 = $MMD_32_24 ; compatibility
Const $FMD_24 = 0x0 ; Memory range is 24-bit
Const $FMD_32 = 0x2 ; Memory range is 32-bit
Const $MMD_Prefetchable = 0x4 ; Bitmask,whether memory prefetchable
Const $FMD_Prefetchable = $MMD_Prefetchable ; compatibility
Const $FMD_Pref = $MMD_Prefetchable ; compatibility
Const $FMD_PrefetchDisallowed = 0x0 ; Memory range is not prefetchable
Const $FMD_PrefetchAllowed = 0x4 ; Memory range is prefetchable
Const $MMD_Readable = 0x8 ; Bitmask,whether memory is readable
Const $FMD_Readable = $MMD_Readable ; compatibility
Const $FMD_ReadAllowed = 0x0 ; Memory range is readable
Const $FMD_ReadDisallowed = 0x8 ; Memory range is write-only
Const $MMD_CombinedWrite = 0x10 ; Bitmask,supports write-behind
Const $FMD_CombinedWrite = $MMD_CombinedWrite ; compatibility
Const $FMD_CombinedWriteDisallowed = 0x0 ; no combined-write caching
Const $FMD_CombinedWriteAllowed = 0x10 ; supports combined-write caching
Const $MMD_Cacheable = 0x20 ; Bitmask,whether memory is cacheable
Const $FMD_NonCacheable = 0x0 ; Memory range is non-cacheable
Const $FMD_Cacheable = 0x20 ; Memory range is cacheable
; =====================================================================================
; #### Flags for CONFLICT_DETAILS.Flags ####
; ====================================================================================
Const $CM_CDFLAGS_DRIVER = 1 ; CONF_DETAILS.Descr reports back legacy driver name
Const $CM_CDFLAGS_ROOT_OWNED = 2 ; CONF_DETAILS.Flags, root owned device
Const $CM_CDFLAGS_RESERVED = 4 ; CONF_DETAILS.Flags specified range is not available for use
; ====================================================================================
; #### Flags for IO_DES.Flags (Port Type Flags) (DWORD) ####
; ====================================================================================
Const $FIOD_MEMORY = 0 ; The device is accessed in memory address space.
Const $FIOD_IO = 1 ; The device is accessed in I/O address space.
; ====================================================================================
; #### Flags for IO_DES.Flags (Decode Flags) (DWORD) ####
; ====================================================================================
Const $FIOD_10_BIT_DECODE = 0x04 ; The device decodes 10 bits of the port address.
Const $FIOD_12_BIT_DECODE = 0x08 ; The device decodes 12 bits of the port address.
Const $FIOD_16_BIT_DECODE = 0x10 ; The device decodes 16 bits of the port address.
Const $FIOD_POSITIVE_DECODE = 0x20 ; The device uses "positive decode" instead of "subtractive decode."
Const $FIOD_DECODE = 0xFC ; Bitmask for the bits within IO_DES.Flags that specify the decode value.
; ====================================================================================
; #### Flags for IRQ_DES.Flags (Sharing Flags) (DWORD) ####
; ====================================================================================
Const $FIRQD_EXCLUSIVE = 0 ; The IRQ line cannot be shared.
Const $FIRQD_SHARE = 1 ; The IRQ line can be shared.
; ====================================================================================
; #### Flags for IRQ_DES.Flags (Triggering Flags) (DWORD) ####
; ====================================================================================
Const $FIRQD_LEVEL = 0 ; The IRQ line is level-triggered.
Const $FIRQD_EDGE = 2 ; The IRQ line is edge-triggered.
; ====================================================================================
; #### Flags for DMA_DES.Flags (DMA Channel Width) ####
; ==============================================================================
Const $MDD_WIDTH = 0x3 ; Bitmask, width of the DMA channel:
Const $FDD_BYTE = 0x0 ; 8-bit DMA channel
Const $FDD_WORD = 0x1 ; 16-bit DMA channel
Const $FDD_DWORD = 0x2 ; 32-bit DMA channel
Const $FDD_BYTE_AND_WORD = 0x3 ; 8-bit and 16-bit DMA channel
; ==============================================================================
; #### Flags for DMA_DES.Flags (Bus Mastering Flags) ####
; ==============================================================================
Const $MDD_BUSMASTER = 0x4 ; Bitmask, whether bus mastering is supported
Const $FDD_NOBUSMASTER = 0x0 ; no bus mastering
Const $FDD_BUSMASTER = 0x4 ; bus mastering
; ==============================================================================
; #### Flags for DMA_DES.Flags (DMA Type Flags) ####
; ==============================================================================
Const $MDD_TYPE = 0x18 ; Bitmask, specifies type of DMA
Const $FDD_TYPESTANDARD = 0x00 ; standard DMA
Const $FDD_TYPEA = 0x08 ; Type-A DMA
Const $FDD_TYPEB = 0x10 ; Type-B DMA
Const $FDD_TYPEF = 0x18 ; Type-F DMA
; ==============================================================================
; #### Return code for _SetupDiVerifyDigitalSinger ####
; ================================================================================
; Indicates that the publisher is trusted because the publisher's certificate is installed in the Trusted Publishers certificate store.
Const $ERROR_AUTHENTICODE_TRUSTED_PUBLISHER = -536870335
; Indicates that trust cannot be automatically established because the publisher's signing certificate is not installed in the trusted publisher certificates store.
; However, this does not necessarily indicate an error. Instead it indicates that the caller must apply a caller-specific policy to establish trust in the publisher.
Const $ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED = -536870334
; ================================================================================
; #### Flags for SP_DRVINSTALL_PARAMS.Flags ####
; =================================================================================
; There are other providers supplying drivers that have the same description as this driver. This flag is READ-ONLY to installers.
Const $DNF_DUPDESC = 1
; This driver currently/previously controlled the associated device. This flag is READ-ONLY to installers.
Const $DNF_OLDDRIVER = 2
; Do not display this driver in any driver-select dialogs.
Const $DNF_EXCLUDEFROMLIST = 4
; Set if no physical driver is to be installed for this logical driver.
Const $DNF_NODRIVER = 8
; This driver comes from a legacy INF file. This flag is valid only for the NT-based operating system. This flag is READ-ONLY to installers.
Const $DNF_LEGACYINF = 0x10
; This driver is a class driver. This flag is read-only to installers.
Const $DNF_CLASS_DRIVER = 0x20
; This driver is a compatible driver. This flag is READ-ONLY to installers.
Const $DNF_COMPATIBLE_DRIVER = 0x40
; This driver came from the Internet or from Windows Update. This flag is READ-ONLY to installers.
Const $DNF_INET_DRIVER = 0x80
Const $DNF_UNUSED1 = 0x100
; This driver node is derived from an INF file that was included with this version of Windows.
Const $DNF_INDEXED_DRIVER = 0x200
; This driver came from the Internet, but Setup does not currently have access to its source files. This flag is READ-ONLY to installers.
; The system will not install a driver marked with this flag because Setup does not have the source files and would end up prompting the user with an invalid,
; path. The INF for such a driver can be used for everything except for installing devices.
Const $DNF_OLD_INET_DRIVER = 0x400
; Do not use this driver. Installers can read and write this flag.
; If this flag is set, SetupDiSelectBestCompatDrv and SetupDiSelectDevice ignore this driver.
; A class installer or co-installer can set this flag to prevent Setup from listing the driver in the Select Driver dialog box.
; An installer might set this flag when it handles a DIF_SELECTDEVICE or DIF_SELECTBESTCOMPATDRV request, for example.
Const $DNF_BAD_DRIVER = 0x800
; There are other providers supplying drivers that have the same description as this driver.
; The only difference between this driver and its match is the driver date. This flag is read-only to installers.
; If this flag is set, Setup displays the driver date and driver version next to the driver so that the user can distinguish it from its match.
Const $DNF_DUPPROVIDER = 0x1000
; (Windows XP and later versions of Windows)
Const $DNF_INF_IS_SIGNED = 0x2000
; Reserved. (Windows XP and later versions of Windows)
Const $DNF_OEM_F6_INF = 0x4000
; (Windows XP and later versions of Windows)
Const $DNF_DUPDRIVERVER = 0x8000
; (Windows XP and later versions of Windows)
Const $DNF_BASIC_DRIVER = 0x10000
; This driver¡¯s INF file is signed by an Authenticode signature. This flag is read-only to installers.
Const $DNF_AUTHENTICODE_SIGNED = 0x20000
; (Windows Vista and later versions of Windows)
; This driver node is currently installed for the device. This flag is read-only to installers.
Const $DNF_INSTALLEDDRIVER = 0x40000
; If set, this flag prevents the driver node from being enumerated, regardless of the client that is performing the enumeration.
Const $DNF_ALWAYSEXCLUEDFROMLIST = 0x80000
; =================================================================================
; #### Flags for SP_DRVINSTALL_PARAMS.Rank ####
; =================================================================================
Const $DRIVER_HARDWAREID_RANK = 0xFFF
Const $DRIVER_COMPATID_RANK = 0x3FFF
Const $DRIVER_UNTRUSTED_RANK = 0x8000
Const $DRIVER_UNTRUSTED_HARDWAREID_RANK = 0x8FFF
Const $DRIVER_UNTRUSTED_COMPATID_RANK = 0xBFFF
Const $DRIVER_W9X_SUSPECT_RANK = 0xC000
Const $DRIVER_W9X_SUSPECT_HARDWAREID_RANK = 0xCFFF
; =================================================================================
; #### Flags for HWPROFILE_INFO.Flags ####
; =================================================================================
Const $CM_HWPI_NOT_DOCKABLE = 0 ; Machine is not dockable
Const $CM_HWPI_UNDOCKED = 1 ; HW Profile for docked config
Const $CM_HWPI_DOCKED = 2 ; HW Profile for undocked config
; =================================================================================
; #### Flags for _CM_Bind_Device ####
; =================================================================================
Const $CM_BIND_UNUSED = 0
Const $CM_BIND_DEVINST_BIND_ID = 1
Const $CM_BIND_DEVINST_BIND_PHYSNAME = 2
Const $CM_BIND_PHYSNAME_BIND_DEVINST = 4
Const $CM_BIND_DEVINST_BIND_CLASS = 8
Const $CM_BIND_CLASS_BIND_DEVINST = 16
Const $CM_BIND_ENUMERATOR_BIND_DEVINST = 32
; =================================================================================
; ####### FUNCTIONS #######
; ==============================================================================
; _CM_Add_Empty_Log_Conf
; _CM_Add_Empty_Log_Conf_Ex
; _CM_Add_ID
; _CM_Add_ID_Ex
; _CM_Add_Res_Des
; _CM_Add_Res_Des_Ex
; _CM_Add_Res_Des_IO_Array_Ex
; _CM_Add_Res_Des_IRQ_Array_Ex
; _CM_Add_Res_Des_Mem_Array_Ex
; _CM_Assign_Var
; _CM_Cdrom_Known_Good_Digital_Playback
; _CM_Close_Handle
; _CM_Connect_Machine
; _CM_Create_Device_Devs
; _CM_Create_Device_Devs_Ex
; _CM_Create_File
; _CM_Device_IO_Control
; _CM_Disable_Cdrom_Digital_Playback
; _CM_Disable_DevNode
; _CM_Disable_DevNode_Ex
; _CM_Disconnect_Machine
; _CM_Duplicate_Buffer
; _CM_Enable_Cdrom_Digital_Playback
; _CM_Enable_DevNode
; _CM_Enable_DevNode_Ex
; _CM_Enable_Privileges
; _CM_Enum_Device_Info
; _CM_Enum_Device_Info_Ex
; _CM_Enum_Device_Info_Notify_Progress
; _CM_Enumerate_Children
; _CM_Enumerate_Children_Ex
; _CM_Enumerate_Classes
; _CM_Enumerate_Classes_Ex
; _CM_Enumerate_Enumerators
; _CM_Enumerate_Enumerators_Ex
; _CM_Enumerate_Physical_Disks
; _CM_Format_Error_Message
; _CM_Format_Problem_Message
; _CM_Free_Log_Conf
; _CM_Free_Log_Conf_Ex
; _CM_Free_Log_Conf_Handle
; _CM_Free_Res_Des
; _CM_Free_Res_Des_Ex
; _CM_Free_Res_Des_Handle
; _CM_Free_Resource_Conflict_Handle
; _CM_Free_Variable
; _CM_Get_Child
; _CM_Get_Child_By_Index