-
Notifications
You must be signed in to change notification settings - Fork 44
/
SetupAPI.pas
8624 lines (7938 loc) · 429 KB
/
SetupAPI.pas
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
{******************************************************************}
{ }
{ Borland Delphi Runtime Library }
{ Setup and Device Installer API interface unit }
{ }
{ Portions created by Microsoft are }
{ Copyright (C) 1995-1999 Microsoft Corporation. }
{ All Rights Reserved. }
{ }
{ The original file is: setupapi.h, released March 1999. }
{ The original Pascal code is: SetupApi.pas, released 29 Jan 2000. }
{ The initial developer of the Pascal code is Robert Marquardt }
{ (robert_marquardt att gmx dott de) }
{ }
{ Portions created by Robert Marquardt are }
{ Copyright (C) 1999 Robert Marquardt. }
{ }
{ Contributor(s): Marcel van Brakel (brakelm att bart dott nl) }
{ }
{ Obtained through: }
{ Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project }
{ JEDI home page, located at http://delphi-jedi.org }
{ }
{ The contents of this file are used with permission, subject to }
{ the Mozilla Public License Version 1.1 (the "License"); you may }
{ not use this file except in compliance with the License. You may }
{ obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }
{ implied. See the License for the specific language governing }
{ rights and limitations under the License. }
{ }
{******************************************************************}
unit SetupApi;
{$I windowsversion.inc}
interface
{$WEAKPACKAGEUNIT ON}
// (rom) this is the switch to change between static and dynamic linking.
// (rom) it is enabled by default here.
// (rom) To disable simply change the '$' to a '.'.
{$DEFINE SETUPAPI_LINKONREQUEST}
(*$HPPEMIT '#include "setupapi.h"'*)
uses
Windows, CommCtrl,
{$IFDEF SETUPAPI_LINKONREQUEST}
ModuleLoader,
{$ENDIF SETUPAPI_LINKONREQUEST}
WinConvTypes;
const
ANYSIZE_ARRAY = 1;
{$EXTERNALSYM ANYSIZE_ARRAY}
//
// Define maximum string length constants as specified by
// Windows 95.
//
const
LINE_LEN = 256; // Win95-compatible maximum for displayable
{$EXTERNALSYM LINE_LEN}
// strings coming from a device INF.
MAX_INF_STRING_LENGTH = 4096; // Actual maximum size of an INF string
{$EXTERNALSYM MAX_INF_STRING_LENGTH}
// (including string substitutions).
MAX_TITLE_LEN = 60;
{$EXTERNALSYM MAX_TITLE_LEN}
MAX_INSTRUCTION_LEN = 256;
{$EXTERNALSYM MAX_INSTRUCTION_LEN}
MAX_LABEL_LEN = 30;
{$EXTERNALSYM MAX_LABEL_LEN}
MAX_SERVICE_NAME_LEN = 256;
{$EXTERNALSYM MAX_SERVICE_NAME_LEN}
MAX_SUBTITLE_LEN = 256;
{$EXTERNALSYM MAX_SUBTITLE_LEN}
//
// Define maximum length of a machine name in the format expected by ConfigMgr32
// CM_Connect_Machine (i.e., "\\\\MachineName\0").
//
SP_MAX_MACHINENAME_LENGTH = MAX_PATH + 3;
{$EXTERNALSYM SP_MAX_MACHINENAME_LENGTH}
//
// Define type for reference to loaded inf file
//
type
HINF = Pointer;
{$EXTERNALSYM HINF}
//
// Inf context structure. Applications must not interpret or
// overwrite values in these structures.
//
PInfContext = ^TInfContext;
INFCONTEXT = packed record
Inf: Pointer;
CurrentInf: Pointer;
Section: UINT;
Line: UINT;
end;
{$EXTERNALSYM INFCONTEXT}
TInfContext = INFCONTEXT;
//
// Inf file information structure.
//
PSPInfInformation = ^TSPInfInformation;
SP_INF_INFORMATION = packed record
InfStyle: DWORD;
InfCount: DWORD;
VersionData: array [0..ANYSIZE_ARRAY - 1] of Byte;
end;
{$EXTERNALSYM SP_INF_INFORMATION}
TSPInfInformation = SP_INF_INFORMATION;
//
// Define structure for passing alternate platform info into
// SetupSetFileQueueAlternatePlatform and SetupQueryInfOriginalFileInformation.
//
PSPAltPlatformInfoV2 = ^SP_ALTPLATFORM_INFO_V2;
SP_ALTPLATFORM_INFO_V2 = packed record
cbSize: DWORD;
//
// platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT)
//
Platform: DWORD;
//
// major and minor version numbers to use
//
MajorVersion: DWORD;
MinorVersion: DWORD;
//
// processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
// PROCESSOR_ARCHITECTURE_ALPHA, PROCESSOR_ARCHITECTURE_IA64, or
// PROCESSOR_ARCHITECTURE_ALPHA64)
//
ProcessorArchitecture: WORD;
Flags: WORD;
(*
union {
WORD Reserved; // for compatibility with V1 structure
WORD Flags; // indicates validity of non V1 fields
};
*)
//
// specify SP_ALTPLATFORM_FLAGS_VERSION_RANGE in Flags
// to use FirstValidatedMajorVersion and FirstValidatedMinorVersion
//
// Major and minor versions of the oldest previous OS for which this
// package's digital signature may be considered valid. For example, say
// the alternate platform is VER_PLATFORM_WIN32_NT, version 5.1. However,
// it is wished that driver packages signed with a 5.0 osattr also be
// considered valid. In this case, you'd have a MajorVersion/MinorVersion
// of 5.1, and a FirstValidatedMajorVersion/FirstValidatedMinorVersion of
// 5.0. To validate packages signed for any previous OS release, specify
// 0 for these fields. To only validate against the target alternate
// platform, specify the same values as those in the MajorVersion and
// MinorVersion fields.
//
FirstValidatedMajorVersion: DWORD;
FirstValidatedMinorVersion: DWORD;
end;
{$EXTERNALSYM SP_ALTPLATFORM_INFO_V2}
TSPAltPlatformInfoV2 = SP_ALTPLATFORM_INFO_V2;
PSPAltPlatformInfoV1 = ^TSPAltPlatformInfoV1;
SP_ALTPLATFORM_INFO_V1 = packed record
cbSize: DWORD;
//
// platform to use (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT)
//
Platform: DWORD;
//
// major and minor version numbers to use
//
MajorVersion: DWORD;
MinorVersion: DWORD;
//
// processor architecture to use (PROCESSOR_ARCHITECTURE_INTEL,
// PROCESSOR_ARCHITECTURE_ALPHA, PROCESSOR_ARCHITECTURE_IA64, or
// PROCESSOR_ARCHITECTURE_ALPHA64)
//
ProcessorArchitecture: Word;
Reserved: Word; // must be zero.
end;
{$EXTERNALSYM SP_ALTPLATFORM_INFO_V1}
TSPAltPlatformInfoV1 = SP_ALTPLATFORM_INFO_V1;
{$IFDEF WINXP_UP}
PSPAltPlatformInfo = PSPAltPlatformInfoV2;
TSPAltPlatformInfo = TSPAltPlatformInfoV2;
{$ELSE}
PSPAltPlatformInfo = PSPAltPlatformInfoV1;
TSPAltPlatformInfo = TSPAltPlatformInfoV1;
{$ENDIF WINXP_UP}
//
// the following flags are available to SP_ALTPLATFORM_INFO_V2
//
const
SP_ALTPLATFORM_FLAGS_VERSION_RANGE = $0001; // FirstValidatedMajor/MinorVersion
{$EXTERNALSYM SP_ALTPLATFORM_FLAGS_VERSION_RANGE}
//
// Define structure that is filled in by SetupQueryInfOriginalFileInformation
// to indicate the INF's original name and the original name of the (potentially
// platform-specific) catalog file specified by that INF.
//
type
PSPOriginalFileInfoA = ^TSPOriginalFileInfoA;
PSPOriginalFileInfoW = ^TSPOriginalFileInfoW;
SP_ORIGINAL_FILE_INFO_A = packed record
cbSize: DWORD;
OriginalInfName: array [0..MAX_PATH - 1] of AnsiChar;
OriginalCatalogName: array [0..MAX_PATH - 1] of AnsiChar;
end;
{$EXTERNALSYM SP_ORIGINAL_FILE_INFO_A}
SP_ORIGINAL_FILE_INFO_W = packed record
cbSize: DWORD;
OriginalInfName: array [0..MAX_PATH - 1] of WideChar;
OriginalCatalogName: array [0..MAX_PATH - 1] of WideChar;
end;
{$EXTERNALSYM SP_ORIGINAL_FILE_INFO_W}
TSPOriginalFileInfoA = SP_ORIGINAL_FILE_INFO_A;
TSPOriginalFileInfoW = SP_ORIGINAL_FILE_INFO_W;
{$IFDEF UNICODE}
PSPOriginalFileInfo = PSPOriginalFileInfoW;
TSPOriginalFileInfo = TSPOriginalFileInfoW;
{$ELSE}
TSPOriginalFileInfo = TSPOriginalFileInfoA;
PSPOriginalFileInfo = PSPOriginalFileInfoA;
{$ENDIF UNICODE}
//
// SP_INF_INFORMATION.InfStyle values
//
const
INF_STYLE_NONE = $00000000; // unrecognized or non-existent
{$EXTERNALSYM INF_STYLE_NONE}
INF_STYLE_OLDNT = $00000001; // winnt 3.x
{$EXTERNALSYM INF_STYLE_OLDNT}
INF_STYLE_WIN4 = $00000002; // Win95
{$EXTERNALSYM INF_STYLE_WIN4}
//
// Additional InfStyle flags that may be specified when calling SetupOpenInfFile.
//
//
INF_STYLE_CACHE_ENABLE = $00000010; // always cache INF, even outside of %windir%\Inf
{$EXTERNALSYM INF_STYLE_CACHE_ENABLE}
INF_STYLE_CACHE_DISABLE = $00000020; // delete cached INF information
{$EXTERNALSYM INF_STYLE_CACHE_DISABLE}
//
// Target directory specs.
//
DIRID_ABSOLUTE = DWORD(-1); // real 32-bit -1
{$EXTERNALSYM DIRID_ABSOLUTE}
DIRID_ABSOLUTE_16BIT = $FFFF; // 16-bit -1 for compat w/setupx
{$EXTERNALSYM DIRID_ABSOLUTE_16BIT}
DIRID_NULL = 0;
{$EXTERNALSYM DIRID_NULL}
DIRID_SRCPATH = 1;
{$EXTERNALSYM DIRID_SRCPATH}
DIRID_WINDOWS = 10;
{$EXTERNALSYM DIRID_WINDOWS}
DIRID_SYSTEM = 11; // system32
{$EXTERNALSYM DIRID_SYSTEM}
DIRID_DRIVERS = 12;
{$EXTERNALSYM DIRID_DRIVERS}
DIRID_IOSUBSYS = DIRID_DRIVERS;
{$EXTERNALSYM DIRID_IOSUBSYS}
DIRID_INF = 17;
{$EXTERNALSYM DIRID_INF}
DIRID_HELP = 18;
{$EXTERNALSYM DIRID_HELP}
DIRID_FONTS = 20;
{$EXTERNALSYM DIRID_FONTS}
DIRID_VIEWERS = 21;
{$EXTERNALSYM DIRID_VIEWERS}
DIRID_COLOR = 23;
{$EXTERNALSYM DIRID_COLOR}
DIRID_APPS = 24;
{$EXTERNALSYM DIRID_APPS}
DIRID_SHARED = 25;
{$EXTERNALSYM DIRID_SHARED}
DIRID_BOOT = 30;
{$EXTERNALSYM DIRID_BOOT}
DIRID_SYSTEM16 = 50;
{$EXTERNALSYM DIRID_SYSTEM16}
DIRID_SPOOL = 51;
{$EXTERNALSYM DIRID_SPOOL}
DIRID_SPOOLDRIVERS = 52;
{$EXTERNALSYM DIRID_SPOOLDRIVERS}
DIRID_USERPROFILE = 53;
{$EXTERNALSYM DIRID_USERPROFILE}
DIRID_LOADER = 54;
{$EXTERNALSYM DIRID_LOADER}
DIRID_PRINTPROCESSOR = 55;
{$EXTERNALSYM DIRID_PRINTPROCESSOR}
DIRID_DEFAULT = DIRID_SYSTEM;
{$EXTERNALSYM DIRID_DEFAULT}
//
// The following DIRIDs are for commonly-used shell "special folders". The
// complete list of such folders is contained in shlobj.h. In that headerfile,
// each folder is assigned a CSIDL_* value. The DIRID values below are created
// by taking the CSIDL value in shlobj.h and OR'ing it with 0x4000. Thus, if
// an INF needs to reference other special folders not defined below, it may
// generate one using the above mechanism, and setupapi will automatically deal
// with it and use the corresponding shell's path where appropriate. (Remember
// that DIRIDs must be specified in decimal, not hex, in an INF when used for
// string substitution.)
//
DIRID_COMMON_STARTMENU = 16406; // All Users\Start Menu
{$EXTERNALSYM DIRID_COMMON_STARTMENU}
DIRID_COMMON_PROGRAMS = 16407; // All Users\Start Menu\Programs
{$EXTERNALSYM DIRID_COMMON_PROGRAMS}
DIRID_COMMON_STARTUP = 16408; // All Users\Start Menu\Programs\Startup
{$EXTERNALSYM DIRID_COMMON_STARTUP}
DIRID_COMMON_DESKTOPDIRECTORY = 16409; // All Users\Desktop
{$EXTERNALSYM DIRID_COMMON_DESKTOPDIRECTORY}
DIRID_COMMON_FAVORITES = 16415; // All Users\Favorites
{$EXTERNALSYM DIRID_COMMON_FAVORITES}
DIRID_COMMON_APPDATA = 16419; // All Users\Application Data
{$EXTERNALSYM DIRID_COMMON_APPDATA}
DIRID_PROGRAM_FILES = 16422; // Program Files
{$EXTERNALSYM DIRID_PROGRAM_FILES}
DIRID_SYSTEM_X86 = 16425; // system32 on RISC
{$EXTERNALSYM DIRID_SYSTEM_X86}
DIRID_PROGRAM_FILES_X86 = 16426; // Program Files on RISC
{$EXTERNALSYM DIRID_PROGRAM_FILES_X86}
DIRID_PROGRAM_FILES_COMMON = 16427; // Program Files\Common
{$EXTERNALSYM DIRID_PROGRAM_FILES_COMMON}
DIRID_PROGRAM_FILES_COMMONX86 = 16428; // x86 Program Files\Common on RISC
{$EXTERNALSYM DIRID_PROGRAM_FILES_COMMONX86}
DIRID_COMMON_TEMPLATES = 16429; // All Users\Templates
{$EXTERNALSYM DIRID_COMMON_TEMPLATES}
DIRID_COMMON_DOCUMENTS = 16430; // All Users\Documents
{$EXTERNALSYM DIRID_COMMON_DOCUMENTS}
//
// First user-definable dirid. See SetupSetDirectoryId().
//
DIRID_USER = $8000;
{$EXTERNALSYM DIRID_USER}
//
// Setup callback notification routine type
//
type
TSPFileCallbackA = function(Context: Pointer; Notification: UINT;
Param1, Param2: UINT_PTR): UINT; stdcall;
TSPFileCallbackW = function(Context: Pointer; Notification: UINT;
Param1, Param2: UINT_PTR): UINT; stdcall;
{$IFDEF UNICODE}
TSPFileCallback = TSPFileCallbackW;
{$ELSE}
TSPFileCallback = TSPFileCallbackA;
{$ENDIF UNICODE}
//
// Operation/queue start/end notification. These are ordinal values.
//
const
SPFILENOTIFY_STARTQUEUE = $00000001;
{$EXTERNALSYM SPFILENOTIFY_STARTQUEUE}
SPFILENOTIFY_ENDQUEUE = $00000002;
{$EXTERNALSYM SPFILENOTIFY_ENDQUEUE}
SPFILENOTIFY_STARTSUBQUEUE = $00000003;
{$EXTERNALSYM SPFILENOTIFY_STARTSUBQUEUE}
SPFILENOTIFY_ENDSUBQUEUE = $00000004;
{$EXTERNALSYM SPFILENOTIFY_ENDSUBQUEUE}
SPFILENOTIFY_STARTDELETE = $00000005;
{$EXTERNALSYM SPFILENOTIFY_STARTDELETE}
SPFILENOTIFY_ENDDELETE = $00000006;
{$EXTERNALSYM SPFILENOTIFY_ENDDELETE}
SPFILENOTIFY_DELETEERROR = $00000007;
{$EXTERNALSYM SPFILENOTIFY_DELETEERROR}
SPFILENOTIFY_STARTRENAME = $00000008;
{$EXTERNALSYM SPFILENOTIFY_STARTRENAME}
SPFILENOTIFY_ENDRENAME = $00000009;
{$EXTERNALSYM SPFILENOTIFY_ENDRENAME}
SPFILENOTIFY_RENAMEERROR = $0000000a;
{$EXTERNALSYM SPFILENOTIFY_RENAMEERROR}
SPFILENOTIFY_STARTCOPY = $0000000b;
{$EXTERNALSYM SPFILENOTIFY_STARTCOPY}
SPFILENOTIFY_ENDCOPY = $0000000c;
{$EXTERNALSYM SPFILENOTIFY_ENDCOPY}
SPFILENOTIFY_COPYERROR = $0000000d;
{$EXTERNALSYM SPFILENOTIFY_COPYERROR}
SPFILENOTIFY_NEEDMEDIA = $0000000e;
{$EXTERNALSYM SPFILENOTIFY_NEEDMEDIA}
SPFILENOTIFY_QUEUESCAN = $0000000f;
{$EXTERNALSYM SPFILENOTIFY_QUEUESCAN}
//
// These are used with SetupIterateCabinet().
//
SPFILENOTIFY_CABINETINFO = $00000010;
{$EXTERNALSYM SPFILENOTIFY_CABINETINFO}
SPFILENOTIFY_FILEINCABINET = $00000011;
{$EXTERNALSYM SPFILENOTIFY_FILEINCABINET}
SPFILENOTIFY_NEEDNEWCABINET = $00000012;
{$EXTERNALSYM SPFILENOTIFY_NEEDNEWCABINET}
SPFILENOTIFY_FILEEXTRACTED = $00000013;
{$EXTERNALSYM SPFILENOTIFY_FILEEXTRACTED}
SPFILENOTIFY_FILEOPDELAYED = $00000014;
{$EXTERNALSYM SPFILENOTIFY_FILEOPDELAYED}
//
// These are used for backup operations
//
SPFILENOTIFY_STARTBACKUP = $00000015;
{$EXTERNALSYM SPFILENOTIFY_STARTBACKUP}
SPFILENOTIFY_BACKUPERROR = $00000016;
{$EXTERNALSYM SPFILENOTIFY_BACKUPERROR}
SPFILENOTIFY_ENDBACKUP = $00000017;
{$EXTERNALSYM SPFILENOTIFY_ENDBACKUP}
//
// Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACKEX)
//
SPFILENOTIFY_QUEUESCAN_EX = $00000018;
{$EXTERNALSYM SPFILENOTIFY_QUEUESCAN_EX}
SPFILENOTIFY_STARTREGISTRATION = $00000019;
SPFILENOTIFY_ENDREGISTRATION = $00000020;
//
// Extended notification for SetupScanFileQueue(Flags=SPQ_SCAN_USE_CALLBACK_SIGNERINFO)
//
SPFILENOTIFY_QUEUESCAN_SIGNERINFO = $00000040;
//
// Copy notification. These are bit flags that may be combined.
//
SPFILENOTIFY_LANGMISMATCH = $00010000;
{$EXTERNALSYM SPFILENOTIFY_LANGMISMATCH}
SPFILENOTIFY_TARGETEXISTS = $00020000;
{$EXTERNALSYM SPFILENOTIFY_TARGETEXISTS}
SPFILENOTIFY_TARGETNEWER = $00040000;
{$EXTERNALSYM SPFILENOTIFY_TARGETNEWER}
//
// File operation codes and callback outcomes.
//
FILEOP_COPY = 0;
{$EXTERNALSYM FILEOP_COPY}
FILEOP_RENAME = 1;
{$EXTERNALSYM FILEOP_RENAME}
FILEOP_DELETE = 2;
{$EXTERNALSYM FILEOP_DELETE}
FILEOP_BACKUP = 3;
{$EXTERNALSYM FILEOP_BACKUP}
FILEOP_ABORT = 0;
{$EXTERNALSYM FILEOP_ABORT}
FILEOP_DOIT = 1;
{$EXTERNALSYM FILEOP_DOIT}
FILEOP_SKIP = 2;
{$EXTERNALSYM FILEOP_SKIP}
FILEOP_RETRY = FILEOP_DOIT;
{$EXTERNALSYM FILEOP_RETRY}
FILEOP_NEWPATH = 4;
{$EXTERNALSYM FILEOP_NEWPATH}
//
// Flags in inf copy sections
//
COPYFLG_WARN_IF_SKIP = $00000001; // warn if user tries to skip file
{$EXTERNALSYM COPYFLG_WARN_IF_SKIP}
COPYFLG_NOSKIP = $00000002; // disallow skipping this file
{$EXTERNALSYM COPYFLG_NOSKIP}
COPYFLG_NOVERSIONCHECK = $00000004; // ignore versions and overwrite target
{$EXTERNALSYM COPYFLG_NOVERSIONCHECK}
COPYFLG_FORCE_FILE_IN_USE = $00000008; // force file-in-use behavior
{$EXTERNALSYM COPYFLG_FORCE_FILE_IN_USE}
COPYFLG_NO_OVERWRITE = $00000010; // do not copy if file exists on target
{$EXTERNALSYM COPYFLG_NO_OVERWRITE}
COPYFLG_NO_VERSION_DIALOG = $00000020; // do not copy if target is newer
{$EXTERNALSYM COPYFLG_NO_VERSION_DIALOG}
COPYFLG_OVERWRITE_OLDER_ONLY = $00000040; // leave target alone if version same as source
{$EXTERNALSYM COPYFLG_OVERWRITE_OLDER_ONLY}
COPYFLG_REPLACEONLY = $00000400; // copy only if file exists on target
{$EXTERNALSYM COPYFLG_REPLACEONLY}
COPYFLG_NODECOMP = $00000800; // don't attempt to decompress file; copy as-is
{$EXTERNALSYM COPYFLG_NODECOMP}
COPYFLG_REPLACE_BOOT_FILE = $00001000; // file must be present upon reboot (i.e., it's
{$EXTERNALSYM COPYFLG_REPLACE_BOOT_FILE} // needed by the loader); this flag implies a reboot
COPYFLG_NOPRUNE = $00002000; // never prune this file
{$EXTERNALSYM COPYFLG_NOPRUNE}
//
// Flags in inf delete sections
// New flags go in high word
//
DELFLG_IN_USE = $00000001; // queue in-use file for delete
{$EXTERNALSYM DELFLG_IN_USE}
DELFLG_IN_USE1 = $00010000; // high-word version of DELFLG_IN_USE
{$EXTERNALSYM DELFLG_IN_USE1}
//
// Source and file paths. Used when notifying queue callback
// of SPFILENOTIFY_STARTxxx, SPFILENOTIFY_ENDxxx, and SPFILENOTIFY_xxxERROR.
//
type
PFilePathsA = ^TFilePathsA;
PFilePathsW = ^TFilePathsW;
FILEPATHS_A = packed record
Target: PAnsiChar;
Source: PAnsiChar; // not used for delete operations
Win32Error: UINT;
Flags: DWORD; // such as SP_COPY_NOSKIP for copy errors
end;
{$EXTERNALSYM FILEPATHS_A}
FILEPATHS_W = packed record
Target: PWideChar;
Source: PWideChar; // not used for delete operations
Win32Error: UINT;
Flags: DWORD; // such as SP_COPY_NOSKIP for copy errors
end;
{$EXTERNALSYM FILEPATHS_W}
TFilePathsA = FILEPATHS_A;
TFilePathsW = FILEPATHS_W;
{$IFDEF UNICODE}
TFilePaths = TFilePathsW;
PFilePaths = PFilePathsW;
{$ELSE}
TFilePaths = TFilePathsA;
PFilePaths = PFilePathsA;
{$ENDIF UNICODE}
{$IFDEF WINXP_UP}
PFilePathsSignerInfoA = ^TFilePathsSignerInfoA;
PFilePathsSignerInfoW = ^TFilePathsSignerInfoW;
FILEPATHS_SIGNERINFO_A = packed record
Target: PAnsiChar;
Source: PAnsiChar; // not used for delete operations
Win32Error: UINT;
Flags: DWORD; // such as SP_COPY_NOSKIP for copy errors
DigitalSigner: PAnsiChar;
Version: PAnsiChar;
CatalogFile: PAnsiChar;
end;
{$EXTERNALSYM FILEPATHS_SIGNERINFO_A}
FILEPATHS_SIGNERINFO_W = packed record
Target: PWideChar;
Source: PWideChar; // not used for delete operations
Win32Error: UINT;
Flags: DWORD; // such as SP_COPY_NOSKIP for copy errors
DigitalSigner: PWideChar;
Version: PWideChar;
CatalogFile: PWideChar;
end;
{$EXTERNALSYM FILEPATHS_SIGNERINFO_W}
TFilePathsSignerInfoA = FILEPATHS_SIGNERINFO_A;
TFilePathsSignerInfoW = FILEPATHS_SIGNERINFO_W;
{$IFDEF UNICODE}
TFilePathsSignerInfo = TFilePathsSignerInfoA;
PFilePathsSignerInfo = PFilePathsSignerInfoW;
{$ELSE}
TFilePathsSignerInfo = TFilePathsSignerInfoA;
PFilePathsSignerInfo = PFilePathsSignerInfoA;
{$ENDIF UNICODE}
{$ENDIF WINXP_UP}
//
// Structure used with SPFILENOTIFY_NEEDMEDIA
//
PSourceMediaA = ^TSourceMediaA;
PSourceMediaW = ^TSourceMediaW;
SOURCE_MEDIA_A = packed record
Reserved: PAnsiChar;
Tagfile: PAnsiChar; // may be NULL
Description: PAnsiChar;
//
// Pathname part and filename part of source file
// that caused us to need the media.
//
SourcePath: PAnsiChar;
SourceFile: PAnsiChar;
Flags: DWORD; // subset of SP_COPY_xxx
end;
{$EXTERNALSYM SOURCE_MEDIA_A}
SOURCE_MEDIA_W = packed record
Reserved: PWideChar;
Tagfile: PWideChar; // may be NULL
Description: PWideChar;
//
// Pathname part and filename part of source file
// that caused us to need the media.
//
SourcePath: PWideChar;
SourceFile: PWideChar;
Flags: DWORD; // subset of SP_COPY_xxx
end;
{$EXTERNALSYM SOURCE_MEDIA_W}
TSourceMediaA = SOURCE_MEDIA_A;
TSourceMediaW = SOURCE_MEDIA_W;
{$IFDEF UNICODE}
TSourceMedia = TSourceMediaW;
PSourceMedia = PSourceMediaW;
{$ELSE}
TSourceMedia = TSourceMediaA;
PSourceMedia = PSourceMediaA;
{$ENDIF UNICODE}
//
// Structure used with SPFILENOTIFY_CABINETINFO and
// SPFILENOTIFY_NEEDNEWCABINET
//
PCabinetInfoA = ^TCabinetInfoA;
PCabinetInfoW = ^TCabinetInfoW;
CABINET_INFO_A = packed record
CabinetPath: PAnsiChar;
CabinetFile: PAnsiChar;
DiskName: PAnsiChar;
SetId: Word;
CabinetNumber: Word;
end;
{$EXTERNALSYM CABINET_INFO_A}
CABINET_INFO_W = packed record
CabinetPath: PWideChar;
CabinetFile: PWideChar;
DiskName: PWideChar;
SetId: Word;
CabinetNumber: Word;
end;
{$EXTERNALSYM CABINET_INFO_W}
TCabinetInfoA = CABINET_INFO_A;
TCabinetInfoW = CABINET_INFO_W;
{$IFDEF UNICODE}
TCabinetInfo = TCabinetInfoW;
PCabinetInfo = PCabinetInfoW;
{$ELSE}
TCabinetInfo = TCabinetInfoA;
PCabinetInfo = PCabinetInfoA;
{$ENDIF UNICODE}
//
// Structure used with SPFILENOTIFY_FILEINCABINET
//
PFileInCabinetInfoA = ^TFileInCabinetInfoA;
PFileInCabinetInfoW = ^TFileInCabinetInfoW;
FILE_IN_CABINET_INFO_A = packed record
NameInCabinet: PAnsiChar;
FileSize: DWORD;
Win32Error: DWORD;
DosDate: Word;
DosTime: Word;
DosAttribs: Word;
FullTargetName: array [0..MAX_PATH - 1] of AnsiChar;
end;
{$EXTERNALSYM FILE_IN_CABINET_INFO_A}
FILE_IN_CABINET_INFO_W = packed record
NameInCabinet: PWideChar;
FileSize: DWORD;
Win32Error: DWORD;
DosDate: Word;
DosTime: Word;
DosAttribs: Word;
FullTargetName: array [0..MAX_PATH - 1] of WideChar;
end;
{$EXTERNALSYM FILE_IN_CABINET_INFO_W}
TFileInCabinetInfoA = FILE_IN_CABINET_INFO_A;
TFileInCabinetInfoW = FILE_IN_CABINET_INFO_W;
{$IFDEF UNICODE}
TFileInCabinetInfo = TFileInCabinetInfoW;
PFileInCabinetInfo = PFileInCabinetInfoW;
{$ELSE}
TFileInCabinetInfo = TFileInCabinetInfoA;
PFileInCabinetInfo = PFileInCabinetInfoA;
{$ENDIF UNICODE}
//
// Structure used for SPFILENOTIFY_***REGISTRATION
// callback
//
{$IFDEF WINXP_UP}
PSPRegisterControlStatusA = ^TSPRegisterControlStatusA;
PSPRegisterControlStatusW = ^TSPRegisterControlStatusW;
SP_REGISTER_CONTROL_STATUSA = packed record
cbSize: DWORD;
FileName: PAnsiChar;
Win32Error: DWORD;
FailureCode: DWORD;
end;
{$EXTERNALSYM SP_REGISTER_CONTROL_STATUSA}
SP_REGISTER_CONTROL_STATUSW = packed record
cbSize: DWORD;
FileName: PWideChar;
Win32Error: DWORD;
FailureCode: DWORD;
end;
{$EXTERNALSYM SP_REGISTER_CONTROL_STATUSW}
TSPRegisterControlStatusA = SP_REGISTER_CONTROL_STATUSA;
TSPRegisterControlStatusW = SP_REGISTER_CONTROL_STATUSW;
{$IFDEF UNICODE}
TSPRegisterControlStatus = TSPRegisterControlStatusW;
PSPRegisterControlStatus = PSPRegisterControlStatusW;
{$ELSE}
TSPRegisterControlStatus = TSPRegisterControlStatusA;
PSPRegisterControlStatus = PSPRegisterControlStatusA;
{$ENDIF UNICODE}
{$ENDIF WINXP_UP}
//
// valid values for SP_REGISTER_CONTROL_STATUS.FailureCode field
//
const
SPREG_SUCCESS = $00000000;
{$EXTERNALSYM SPREG_SUCCESS}
SPREG_LOADLIBRARY = $00000001;
{$EXTERNALSYM SPREG_LOADLIBRARY}
SPREG_GETPROCADDR = $00000002;
{$EXTERNALSYM SPREG_GETPROCADDR}
SPREG_REGSVR = $00000003;
{$EXTERNALSYM SPREG_REGSVR}
SPREG_DLLINSTALL = $00000004;
{$EXTERNALSYM SPREG_DLLINSTALL}
SPREG_TIMEOUT = $00000005;
{$EXTERNALSYM SPREG_TIMEOUT}
SPREG_UNKNOWN = $FFFFFFFF;
{$EXTERNALSYM SPREG_UNKNOWN}
//
// Define type for setup file queue
//
type
HSPFILEQ = Pointer;
{$EXTERNALSYM HSPFILEQ}
//
// Structure used with SetupQueueCopyIndirect
//
PSPFileCopyParamsA = ^TSPFileCopyParamsA;
PSPFileCopyParamsW = ^TSPFileCopyParamsW;
SP_FILE_COPY_PARAMS_A = packed record
cbSize: DWORD;
QueueHandle: HSPFILEQ;
SourceRootPath: PAnsiChar;
SourcePath: PAnsiChar;
SourceFilename: PAnsiChar;
SourceDescription: PAnsiChar;
SourceTagfile: PAnsiChar;
TargetDirectory: PAnsiChar;
TargetFilename: PAnsiChar;
CopyStyle: DWORD;
LayoutInf: HINF;
SecurityDescriptor: PAnsiChar;
end;
{$EXTERNALSYM SP_FILE_COPY_PARAMS_A}
SP_FILE_COPY_PARAMS_W = packed record
cbSize: DWORD;
QueueHandle: HSPFILEQ;
SourceRootPath: PWideChar;
SourcePath: PWideChar;
SourceFilename: PWideChar;
SourceDescription: PWideChar;
SourceTagfile: PWideChar;
TargetDirectory: PWideChar;
TargetFilename: PWideChar;
CopyStyle: DWORD;
LayoutInf: HINF;
SecurityDescriptor: PWideChar;
end;
{$EXTERNALSYM SP_FILE_COPY_PARAMS_W}
TSPFileCopyParamsA = SP_FILE_COPY_PARAMS_A;
TSPFileCopyParamsW = SP_FILE_COPY_PARAMS_W;
{$IFDEF UNICODE}
TSPFileCopyParams = TSPFileCopyParamsW;
PSPFileCopyParams = PSPFileCopyParamsW;
{$ELSE}
TSPFileCopyParams = TSPFileCopyParamsA;
PSPFileCopyParams = PSPFileCopyParamsA;
{$ENDIF UNICODE}
//
// Define type for setup disk space list
//
HDSKSPC = Pointer;
{$EXTERNALSYM HDSKSPC}
//
// Define type for reference to device information set
//
HDEVINFO = Pointer;
{$EXTERNALSYM HDEVINFO}
//
// Device information structure (references a device instance
// that is a member of a device information set)
//
PSPDevInfoData = ^TSPDevInfoData;
SP_DEVINFO_DATA = packed record
cbSize: DWORD;
ClassGuid: TGUID;
DevInst: DWORD; // DEVINST handle
Reserved: ULONG_PTR;
end;
{$EXTERNALSYM SP_DEVINFO_DATA}
TSPDevInfoData = SP_DEVINFO_DATA;
//
// Device interface information structure (references a device
// interface that is associated with the device information
// element that owns it).
//
PSPDeviceInterfaceData = ^TSPDeviceInterfaceData;
SP_DEVICE_INTERFACE_DATA = packed record
cbSize: DWORD;
InterfaceClassGuid: TGUID;
Flags: DWORD;
Reserved: ULONG_PTR;
end;
{$EXTERNALSYM SP_DEVICE_INTERFACE_DATA}
TSPDeviceInterfaceData = SP_DEVICE_INTERFACE_DATA;
//
// Flags for SP_DEVICE_INTERFACE_DATA.Flags field.
//
const
SPINT_ACTIVE = $00000001;
{$EXTERNALSYM SPINT_ACTIVE}
SPINT_DEFAULT = $00000002;
{$EXTERNALSYM SPINT_DEFAULT}
SPINT_REMOVED = $00000004;
{$EXTERNALSYM SPINT_REMOVED}
//
// Backward compatibility--do not use.
//
type
TSPInterfaceDeviceData = TSPDeviceInterfaceData;
PSPInterfaceDeviceData = PSPDeviceInterfaceData;
const
SPID_ACTIVE = SPINT_ACTIVE;
{$EXTERNALSYM SPID_ACTIVE}
SPID_DEFAULT = SPINT_DEFAULT;
{$EXTERNALSYM SPID_DEFAULT}
SPID_REMOVED = SPINT_REMOVED;
{$EXTERNALSYM SPID_REMOVED}
type
PSPDeviceInterfaceDetailDataA = ^TSPDeviceInterfaceDetailDataA;
PSPDeviceInterfaceDetailDataW = ^TSPDeviceInterfaceDetailDataW;
SP_DEVICE_INTERFACE_DETAIL_DATA_A = packed record
cbSize: DWORD;
DevicePath: array [0..ANYSIZE_ARRAY - 1] of AnsiChar;
end;
{$EXTERNALSYM SP_DEVICE_INTERFACE_DETAIL_DATA_A}
SP_DEVICE_INTERFACE_DETAIL_DATA_W = packed record
cbSize: DWORD;
DevicePath: array [0..ANYSIZE_ARRAY - 1] of WideChar;
end;
{$EXTERNALSYM SP_DEVICE_INTERFACE_DETAIL_DATA_W}
TSPDeviceInterfaceDetailDataA = SP_DEVICE_INTERFACE_DETAIL_DATA_A;
TSPDeviceInterfaceDetailDataW = SP_DEVICE_INTERFACE_DETAIL_DATA_W;
{$IFDEF UNICODE}
TSPDeviceInterfaceDetailData = TSPDeviceInterfaceDetailDataW;
PSPDeviceInterfaceDetailData = PSPDeviceInterfaceDetailDataW;
{$ELSE}
TSPDeviceInterfaceDetailData = TSPDeviceInterfaceDetailDataA;
PSPDeviceInterfaceDetailData = PSPDeviceInterfaceDetailDataA;
{$ENDIF UNICODE}
//
// Backward compatibility--do not use.
//
TSPInterfaceDeviceDetailDataA = TSPDeviceInterfaceDetailDataA;
TSPInterfaceDeviceDetailDataW = TSPDeviceInterfaceDetailDataW;
PSPInterfaceDeviceDetailDataA = PSPDeviceInterfaceDetailDataA;
PSPInterfaceDeviceDetailDataW = PSPDeviceInterfaceDetailDataW;
{$IFDEF UNICODE}
TSPInterfaceDeviceDetailData = TSPInterfaceDeviceDetailDataW;
PSPInterfaceDeviceDetailData = PSPInterfaceDeviceDetailDataW;
{$ELSE}
TSPInterfaceDeviceDetailData = TSPInterfaceDeviceDetailDataA;
PSPInterfaceDeviceDetailData = PSPInterfaceDeviceDetailDataA;
{$ENDIF UNICODE}
//
// Structure for detailed information on a device information set (used for
// SetupDiGetDeviceInfoListDetail which supercedes the functionality of
// SetupDiGetDeviceInfoListClass).
//
PSPDevInfoListDetailDataA = ^TSPDevInfoListDetailDataA;
PSPDevInfoListDetailDataW = ^TSPDevInfoListDetailDataW;
SP_DEVINFO_LIST_DETAIL_DATA_A = packed record
cbSize: DWORD;
ClassGuid: TGUID;
RemoteMachineHandle: THandle;
RemoteMachineName: array [0..SP_MAX_MACHINENAME_LENGTH - 1] of AnsiChar;
end;
{$EXTERNALSYM SP_DEVINFO_LIST_DETAIL_DATA_A}
SP_DEVINFO_LIST_DETAIL_DATA_W = packed record
cbSize: DWORD;
ClassGuid: TGUID;
RemoteMachineHandle: THandle;
RemoteMachineName: array [0..SP_MAX_MACHINENAME_LENGTH - 1] of WideChar;
end;
{$EXTERNALSYM SP_DEVINFO_LIST_DETAIL_DATA_W}
TSPDevInfoListDetailDataA = SP_DEVINFO_LIST_DETAIL_DATA_A;
TSPDevInfoListDetailDataW = SP_DEVINFO_LIST_DETAIL_DATA_W;
{$IFDEF UNICODE}
TSPDevInfoListDetailData = TSPDevInfoListDetailDataW;
PSPDevInfoListDetailData = PSPDevInfoListDetailDataW;
{$ELSE}
TSPDevInfoListDetailData = TSPDevInfoListDetailDataA;
PSPDevInfoListDetailData = PSPDevInfoListDetailDataA;
{$ENDIF UNICODE}
//
// Class installer function codes
//
const
DIF_SELECTDEVICE = $00000001;
{$EXTERNALSYM DIF_SELECTDEVICE}
DIF_INSTALLDEVICE = $00000002;
{$EXTERNALSYM DIF_INSTALLDEVICE}
DIF_ASSIGNRESOURCES = $00000003;
{$EXTERNALSYM DIF_ASSIGNRESOURCES}
DIF_PROPERTIES = $00000004;
{$EXTERNALSYM DIF_PROPERTIES}
DIF_REMOVE = $00000005;
{$EXTERNALSYM DIF_REMOVE}
DIF_FIRSTTIMESETUP = $00000006;
{$EXTERNALSYM DIF_FIRSTTIMESETUP}
DIF_FOUNDDEVICE = $00000007;
{$EXTERNALSYM DIF_FOUNDDEVICE}
DIF_SELECTCLASSDRIVERS = $00000008;
{$EXTERNALSYM DIF_SELECTCLASSDRIVERS}
DIF_VALIDATECLASSDRIVERS = $00000009;
{$EXTERNALSYM DIF_VALIDATECLASSDRIVERS}
DIF_INSTALLCLASSDRIVERS = $0000000A;
{$EXTERNALSYM DIF_INSTALLCLASSDRIVERS}
DIF_CALCDISKSPACE = $0000000B;
{$EXTERNALSYM DIF_CALCDISKSPACE}
DIF_DESTROYPRIVATEDATA = $0000000C;
{$EXTERNALSYM DIF_DESTROYPRIVATEDATA}
DIF_VALIDATEDRIVER = $0000000D;
{$EXTERNALSYM DIF_VALIDATEDRIVER}
DIF_MOVEDEVICE = $0000000E;
{$EXTERNALSYM DIF_MOVEDEVICE}
DIF_DETECT = $0000000F;
{$EXTERNALSYM DIF_DETECT}
DIF_INSTALLWIZARD = $00000010;
{$EXTERNALSYM DIF_INSTALLWIZARD}
DIF_DESTROYWIZARDDATA = $00000011;
{$EXTERNALSYM DIF_DESTROYWIZARDDATA}
DIF_PROPERTYCHANGE = $00000012;
{$EXTERNALSYM DIF_PROPERTYCHANGE}
DIF_ENABLECLASS = $00000013;
{$EXTERNALSYM DIF_ENABLECLASS}
DIF_DETECTVERIFY = $00000014;
{$EXTERNALSYM DIF_DETECTVERIFY}
DIF_INSTALLDEVICEFILES = $00000015;
{$EXTERNALSYM DIF_INSTALLDEVICEFILES}
DIF_UNREMOVE = $00000016;
{$EXTERNALSYM DIF_UNREMOVE}
DIF_SELECTBESTCOMPATDRV = $00000017;
{$EXTERNALSYM DIF_SELECTBESTCOMPATDRV}
DIF_ALLOW_INSTALL = $00000018;
{$EXTERNALSYM DIF_ALLOW_INSTALL}
DIF_REGISTERDEVICE = $00000019;
{$EXTERNALSYM DIF_REGISTERDEVICE}
DIF_NEWDEVICEWIZARD_PRESELECT = $0000001A;
{$EXTERNALSYM DIF_NEWDEVICEWIZARD_PRESELECT}
DIF_NEWDEVICEWIZARD_SELECT = $0000001B;
{$EXTERNALSYM DIF_NEWDEVICEWIZARD_SELECT}
DIF_NEWDEVICEWIZARD_PREANALYZE = $0000001C;
{$EXTERNALSYM DIF_NEWDEVICEWIZARD_PREANALYZE}
DIF_NEWDEVICEWIZARD_POSTANALYZE = $0000001D;
{$EXTERNALSYM DIF_NEWDEVICEWIZARD_POSTANALYZE}
DIF_NEWDEVICEWIZARD_FINISHINSTALL = $0000001E;
{$EXTERNALSYM DIF_NEWDEVICEWIZARD_FINISHINSTALL}
DIF_UNUSED1 = $0000001F;