1 | ' api_reg.sbp
|
---|
2 | ' Registry Operation
|
---|
3 |
|
---|
4 |
|
---|
5 | #ifndef _INC_REG
|
---|
6 | #define _INC_REG
|
---|
7 |
|
---|
8 | #ifdef UNICODE
|
---|
9 | Const _FuncName_RegConnectRegistry = "RegConnectRegistryW"
|
---|
10 | Const _FuncName_RegCreateKeyEx = "RegCreateKeyExW"
|
---|
11 | Const _FuncName_RegDeleteKey = "RegDeleteKeyW"
|
---|
12 | Const _FuncName_RegDeleteValue = "RegDeleteValueW"
|
---|
13 | Const _FuncName_RegEnumKeyEx = "RegEnumKeyExW"
|
---|
14 | Const _FuncName_RegEnumValue = "RegEnumValueW"
|
---|
15 | Const _FuncName_RegLoadKey = "RegLoadKeyW"
|
---|
16 | Const _FuncName_RegOpenKeyEx = "RegOpenKeyExW"
|
---|
17 | Const _FuncName_RegQueryInfoKey = "RegQueryInfoKeyW"
|
---|
18 | Const _FuncName_RegQueryMultipleValues = "RegQueryMultipleValuesW"
|
---|
19 | Const _FuncName_RegQueryValueEx = "RegQueryValueExW"
|
---|
20 | Const _FuncName_RegSaveKey = "RegSaveKeyW"
|
---|
21 | Const _FuncName_RegSetValueEx = "RegSetValueExW"
|
---|
22 | Const _FuncName_RegUnLoadKey = "RegUnLoadKeyW"
|
---|
23 | #else
|
---|
24 | Const _FuncName_RegConnectRegistry = "RegConnectRegistryA"
|
---|
25 | Const _FuncName_RegCreateKeyEx = "RegCreateKeyExA"
|
---|
26 | Const _FuncName_RegDeleteKey = "RegDeleteKeyA"
|
---|
27 | Const _FuncName_RegDeleteValue = "RegDeleteValueA"
|
---|
28 | Const _FuncName_RegEnumKeyEx = "RegEnumKeyExA"
|
---|
29 | Const _FuncName_RegEnumValue = "RegEnumValueA"
|
---|
30 | Const _FuncName_RegLoadKey = "RegLoadKeyA"
|
---|
31 | Const _FuncName_RegOpenKeyEx = "RegOpenKeyExA"
|
---|
32 | Const _FuncName_RegQueryInfoKey = "RegQueryInfoKeyA"
|
---|
33 | Const _FuncName_RegQueryMultipleValues = "RegQueryMultipleValuesA"
|
---|
34 | Const _FuncName_RegQueryValueEx = "RegQueryValueExA"
|
---|
35 | Const _FuncName_RegSaveKey = "RegSaveKeyA"
|
---|
36 | Const _FuncName_RegSetValueEx = "RegSetValueExA"
|
---|
37 | Const _FuncName_RegUnLoadKey = "RegUnLoadKeyA"
|
---|
38 | #endif
|
---|
39 |
|
---|
40 |
|
---|
41 | Const READ_CONTROL = &H00020000
|
---|
42 | Const STANDARD_RIGHTS_ALL = &H001F0000
|
---|
43 |
|
---|
44 |
|
---|
45 | ' Security Mask
|
---|
46 | Const KEY_QUERY_VALUE = &H0001
|
---|
47 | Const KEY_SET_VALUE = &H0002
|
---|
48 | Const KEY_CREATE_SUB_KEY = &H0004
|
---|
49 | Const KEY_ENUMERATE_SUB_KEYS = &H0008
|
---|
50 | Const KEY_NOTIFY = &H0010
|
---|
51 | Const KEY_CREATE_LINK = &H0020
|
---|
52 | Const KEY_READ = (READ_CONTROL Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE)
|
---|
53 | Const KEY_WRITE = (READ_CONTROL Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE)
|
---|
54 | Const KEY_EXECUTE = KEY_READ
|
---|
55 | Const KEY_ALL_ACCESS = (STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE)
|
---|
56 |
|
---|
57 |
|
---|
58 | ' Options
|
---|
59 | Const REG_OPTION_NON_VOLATILE = &H00000000
|
---|
60 | Const REG_OPTION_VOLATILE = &H00000001
|
---|
61 | Const REG_OPTION_BACKUP_RESTORE = &H00000004
|
---|
62 |
|
---|
63 |
|
---|
64 | ' Reserved Key Handles
|
---|
65 | Const HKEY_CLASSES_ROOT = &H80000000
|
---|
66 | Const HKEY_CURRENT_USER = &H80000001
|
---|
67 | Const HKEY_LOCAL_MACHINE = &H80000002
|
---|
68 | Const HKEY_USERS = &H80000003
|
---|
69 | Const HKEY_PERFORMANCE_DATA = &H80000004
|
---|
70 | Const HKEY_CURRENT_CONFIG = &H80000005
|
---|
71 | Const HKEY_DYN_DATA = &H80000006
|
---|
72 |
|
---|
73 |
|
---|
74 | ' Key Create/Open Disposition
|
---|
75 | Const REG_CREATED_NEW_KEY = &H00000001
|
---|
76 | Const REG_OPENED_EXISTING_KEY = &H00000002
|
---|
77 |
|
---|
78 |
|
---|
79 | ' Data Type
|
---|
80 | Const REG_NONE = 0
|
---|
81 | Const REG_SZ = 1
|
---|
82 | Const REG_EXPAND_SZ = 2
|
---|
83 | Const REG_BINARY = 3
|
---|
84 | Const REG_DWORD = 4
|
---|
85 | Const REG_DWORD_LITTLE_ENDIAN = 4
|
---|
86 | Const REG_DWORD_BIG_ENDIAN = 5
|
---|
87 | Const REG_LINK = 6
|
---|
88 | Const REG_MULTI_SZ = 7
|
---|
89 | Const REG_RESOURCE_LIST = 8
|
---|
90 |
|
---|
91 | Type VALENTW
|
---|
92 | ve_valuename As PWSTR
|
---|
93 | ve_valuelen As DWord
|
---|
94 | ve_valueptr As ULONG_PTR
|
---|
95 | ve_type As DWord
|
---|
96 | End Type
|
---|
97 | Type VALENTA
|
---|
98 | ve_valuename As PSTR
|
---|
99 | ve_valuelen As DWord
|
---|
100 | ve_valueptr As ULONG_PTR
|
---|
101 | ve_type As DWord
|
---|
102 | End Type
|
---|
103 |
|
---|
104 | #ifdef UNICODE
|
---|
105 | TypeDef VALENT = VALENTW
|
---|
106 | #else
|
---|
107 | TypeDef VALENT = VALENTA
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | '------------------------
|
---|
111 | ' Registry API Functions
|
---|
112 |
|
---|
113 | Declare Function RegCloseKey Lib "advapi32" (hKey As HKEY) As Long
|
---|
114 | Declare Function RegConnectRegistry Lib "advapi32" Alias _FuncName_RegConnectRegistry (pMachineName As PCTSTR, hKey As HKEY, ByRef hkResult As HKEY) As Long
|
---|
115 | Declare Function RegCreateKeyEx Lib "advapi32" Alias _FuncName_RegCreateKeyEx (hKey As HKEY, lpSubKey As PCTSTR, Reserved As DWord, lpClass As PTSTR, dwOptions As DWord, samDesired As Long, ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, ByRef phkResult As HKEY, lpdwDisposition As *DWord) As Long
|
---|
116 | Declare Function RegDeleteKey Lib "advapi32" Alias _FuncName_RegDeleteKey (hKey As HKEY, lpSubKey As PCTSTR) As Long
|
---|
117 | Declare Function RegDeleteValue Lib "advapi32" Alias _FuncName_RegDeleteValue (hKey As HKEY, lpValueName As PCTSTR) As Long
|
---|
118 | Declare Function RegEnumKeyEx Lib "advapi32" Alias _FuncName_RegEnumKeyEx (hKey As HKEY, dwIndex As DWord, pName As PTSTR, ByRef cName As DWord, pReserved As *DWord, pClass As PTSTR, ByRef cClass As DWord, pftLastWriteTime As *FILETIME) As Long
|
---|
119 | Declare Function RegEnumValue Lib "advapi32" Alias _FuncName_RegEnumValue (hKey As HKEY, dwIndex As DWord, pValueName As PTSTR, ByRef cValueName As DWord, pReserved As *DWord, pType As *DWord, pData As *Byte, pcbData As *DWord) As Long
|
---|
120 | Declare Function RegFlushKey Lib "advapi32"(hKey As HKEY) As Long
|
---|
121 | /*
|
---|
122 | Declare Function RegLoadKey Lib "advapi32" Alias _FuncName_RegLoadKey (hKey As HKEY, pSubKey As PCTSTR, pFile As PCTSTR) As Long
|
---|
123 | Declare Function RegOpenKeyEx Lib "advapi32" Alias _FuncName_RegOpenKeyEx (hKey As HKEY, lpSubKey As PCTSTR, ulOptions As DWord, samDesired As Long, ByRef phkResult As HKEY) As Long
|
---|
124 | Declare Function RegQueryInfoKey Lib "advapi32" Alias _FuncName_RegQueryInfoKey (hKey As HKEY, pClass As PTSTR, pcClass As *DWord, pReserved As *DWord, pcSubKeys As *DWord, pcMaxSubKeyLen As *DWord, pcMaxClassLen As *DWord, pcValues As *DWord, pcMaxValueNameLen As *DWord, pcMaxValueLen As *DWord, pcbSecurityDescriptor As *DWord, pftLastWriteTime As *FILETIME) As Long
|
---|
125 | Declare Function RegQueryMultipleValues Lib "advapi32" Alias _FuncName_RegQueryMultipleValues (hKey As HKEY, val_list As *VALENT, num_vals As DWord, pValueBuf As PTSTR, ByRef dwTotsize As DWord) As Long
|
---|
126 | Declare Function RegQueryValueEx Lib "advapi32" Alias _FuncName_RegQueryValueEx (hKey As HKEY, lpValueName As PCTSTR, lpReserved As DWord, lpType As *DWord, lpData As VoidPtr, lpcbData As *DWord) As Long
|
---|
127 | Declare Function RegSaveKey Lib "advapi32" Alias _FuncName_RegSaveKey (hKey As HKEY, pFile As PCTSTR, pSecurityAttributes As *SECURITY_ATTRIBUTES) As Long
|
---|
128 | Declare Function RegSetValueEx Lib "advapi32" Alias _FuncName_RegSetValueEx (hKey As HKEY, lpValueName As PCTSTR, Reserved As DWord, dwType As DWord, lpData As VoidPtr, cbData As DWord) As Long
|
---|
129 | Declare Function RegUnLoadKey Lib "advapi32" Alias _FuncName_RegUnLoadKey (hKey As HKEY, pSubKey As PCTSTR) As Long
|
---|
130 | */
|
---|
131 | '_INC_REG
|
---|