-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetupApiLite.pas
108 lines (92 loc) · 3.42 KB
/
SetupApiLite.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
unit setupapilite;
interface
uses
windows;
{ Setup APIs }
type
{ HDEVINFO }
HDEVINFO = THandle;
{$EXTERNALSYM HDEVINFO}
{ SP_DEVINFO_DATA }
SP_DEVINFO_DATA = packed record
cbSize: DWORD;
ClassGuid: TGUID;
DevInst: DWORD;
Reserved: ULONG_PTR;
end;
{$EXTERNALSYM SP_DEVINFO_DATA}
const
{ Flags for SetupDiGetClassDevs }
DIGCF_PRESENT = $00000002;
{$EXTERNALSYM DIGCF_PRESENT}
{ Property for SetupDiGetDeviceRegistryProperty }
SPDRP_DEVICEDESC = $00000000;
{$EXTERNALSYM SPDRP_DEVICEDESC}
SPDRP_FRIENDLYNAME = $0000000C;
{$EXTERNALSYM SPDRP_FRIENDLYNAME}
{ Scope for SetupDiOpenDevRegKey }
DICS_FLAG_GLOBAL = $00000001;
{$EXTERNALSYM DICS_FLAG_GLOBAL}
{ KeyType for SetupDiOpenDevRegKey }
DIREG_DEV = $00000001;
{$EXTERNALSYM DIREG_DEV}
{ SetupDiClassGuidsFromName }
function SetupDiClassGuidsFromName(const ClassName: PChar;
ClassGuidList: PGUID;
ClassGuidListSize: DWORD;
var RequiredSize: DWORD): BOOL; stdcall;
external 'SetupApi.dll' name
{$IFDEF UNICODE}
'SetupDiClassGuidsFromNameW';
{$ELSE}
'SetupDiClassGuidsFromNameA';
{$ENDIF}
{$EXTERNALSYM SetupDiClassGuidsFromName}
{ SetupDiGetClassDevs }
function SetupDiGetClassDevs(ClassGuid: PGUID;
const Enumerator: PChar;
hwndParent: HWND;
Flags: DWORD): HDEVINFO; stdcall;
external 'SetupApi.dll' name
{$IFDEF UNICODE}
'SetupDiGetClassDevsW';
{$ELSE}
'SetupDiGetClassDevsA';
{$ENDIF}
{$EXTERNALSYM SetupDiGetClassDevs}
{ SetupDiDestroyDeviceInfoList }
function SetupDiDestroyDeviceInfoList(DeviceInfoSet: HDEVINFO): BOOL; stdcall;
external 'SetupApi.dll' name 'SetupDiDestroyDeviceInfoList';
{$EXTERNALSYM SetupDiDestroyDeviceInfoList}
{ SetupDiEnumDeviceInfo }
function SetupDiEnumDeviceInfo(DeviceInfoSet: HDEVINFO;
MemberIndex: DWORD;
var DeviceInfoData: SP_DEVINFO_DATA): BOOL; stdcall;
external 'SetupApi.dll' name 'SetupDiEnumDeviceInfo';
{$EXTERNALSYM SetupDiEnumDeviceInfo}
{ SetupDiGetDeviceRegistryProperty }
function SetupDiGetDeviceRegistryProperty(DeviceInfoSet: HDEVINFO;
const DeviceInfoData: SP_DEVINFO_DATA;
Prop: DWORD;
PropertyRegDataType: PDWORD;
PropertyBuffer: Pointer;
PropertyBufferSize: DWORD;
var RequiredSize: DWORD): BOOL; stdcall;
external 'SetupApi.dll' name
{$IFDEF UNICODE}
'SetupDiGetDeviceRegistryPropertyW';
{$ELSE}
'SetupDiGetDeviceRegistryPropertyA';
{$ENDIF}
{$EXTERNALSYM SetupDiGetDeviceRegistryProperty}
{ SetupDiOpenDevRegKey }
function SetupDiOpenDevRegKey(DeviceInfoSet: HDEVINFO;
var DeviceInfoData: SP_DEVINFO_DATA;
Scope: DWORD;
HwProfile: DWORD;
KeyType: DWORD;
samDesired: REGSAM): HKEY; stdcall;
external 'SetupApi.dll' name 'SetupDiOpenDevRegKey';
{$EXTERNALSYM SetupDiOpenDevRegKey}
implementation
end.