L.3. Registry API Constant and User-Defined Type Declarations

To help you with this book, and so that you won't have to go searching for them, the following is a list of all the Constant and User-Defined Type declarations you'll need when using the Registry APIs.

'Key declarations
Const HKEY_CLASSES_ROOT As Long = &H80000000
Const HKEY_CURRENT_CONFIG As Long = &H80000005
Const HKEY_CURRENT_USER As Long = &H80000001
Const HKEY_DYN_DATA As Long = &H80000006
Const HKEY_LOCAL_MACHINE As Long = &H80000002
Const HKEY_PERF_ROOT As Long = HKEY_LOCAL_MACHINE
Const HKEY_PERFORMANCE_DATA As Long = &H80000004
Const HKEY_USERS As Long = &H80000003

'Parameter declarations
Const REG_NOTIFY_CHANGE_ATTRIBUTES As Long = &H2
Const REG_NOTIFY_CHANGE_LAST_SET As Long = &H4
Const REG_NOTIFY_CHANGE_NAME As Long = &H1
Const REG_NOTIFY_CHANGE_SECURITY As Long = &H8
Const REG_CREATED_NEW_KEY As Long = &H1
Const REG_OPENED_EXISTING_KEY As Long = &H2
Const REG_OPTION_BACKUP_RESTORE As Long = 4
Const REG_OPTION_VOLATILE As Long = 1
Const REG_OPTION_NON_VOLATILE As Long = 0
Const STANDARD_RIGHTS_ALL As Long = &H1F0000

Const SYNCHRONIZE As Long = &H100000
Const READ_CONTROL As Long = &H20000
Const STANDARD_RIGHTS_READ As Long = (READ_CONTROL)
Const STANDARD_RIGHTS_WRITE As Long = (READ_CONTROL)
Const KEY_CREATE_LINK As Long = &H20
Const KEY_CREATE_SUB_KEY As Long = &H4
Const KEY_ENUMERATE_SUB_KEYS As Long = &H8
Const KEY_NOTIFY As Long = &H10
Const KEY_QUERY_VALUE As Long = &H1
Const KEY_SET_VALUE As Long = &H2

Const KEY_READ As Long = (( _
    STANDARD_RIGHTS_READ _
    Or KEY_QUERY_VALUE _
    Or KEY_ENUMERATE_SUB_KEYS _
    Or KEY_NOTIFY) _
    And (Not SYNCHRONIZE))

Const KEY_WRITE As Long = (( _
    STANDARD_RIGHTS_WRITE _
    Or KEY_SET_VALUE _
    Or KEY_CREATE_SUB_KEY) _
    And (Not SYNCHRONIZE))

Const KEY_EXECUTE As Long = (KEY_READ)

Const KEY_ALL_ACCESS As Long = (( _
    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))

'Key value types
Const REG_BINARY As Long = 3
Const REG_DWORD As Long = 4
Const REG_DWORD_BIG_ENDIAN As Long = 5
Const REG_DWORD_LITTLE_ENDIAN As Long = 4
Const REG_EXPAND_SZ As Long = 2
Const REG_LINK As Long = 6
Const REG_MULTI_SZ As Long = 7
Const REG_NONE As Long = 0
Const REG_RESOURCE_LIST As Long = 8
Const REG_SZ As Long = 1

'API return codes
Const ERROR_ACCESS_DENIED As Long = 5&
Const ERROR_BADDB As Long = 1009&
Const ERROR_BADKEY As Long = 1010&
Const ERROR_CANTOPEN As Long = 1011&
Const ERROR_CANTREAD As Long = 1012&

Const ERROR_CANTWRITE As Long = 1013&
Const ERROR_INSUFFICIENT_BUFFER As Long = 122
Const ERROR_INVALID_HANDLE As Long = 6&
Const ERROR_INVALID_PARAMETER As Long = 87
Const ERROR_KEY_DELETED As Long = 1018&
Const ERROR_KEY_HAS_CHILDREN As Long = 1020&
Const ERROR_MORE_DATA As Long = 234
Const ERROR_NO_MORE_ITEMS As Long = 259&
Const ERROR_OUTOFMEMORY As Long = 14&
Const ERROR_REGISTRY_CORRUPT As Long = 1015&
Const ERROR_REGISTRY_IO_FAILED As Long = 1016&
Const ERROR_REGISTRY_RECOVERED As Long = 1014&
Const ERROR_SUCCESS As Long = 0&

'User-defined Types
Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type

Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
End Type

Type ACL
    AclRevision As Byte
    Sbz1 As Byte
    AclSize As Integer
    AceCount As Integer
    Sbz2 As Integer
End Type

Type SECURITY_DESCRIPTOR
    Revision As Byte
    Sbz1 As Byte
    Control As Long
    Owner As Long
    Group As Long
    Sacl As ACL
    Dacl As ACL
End Type

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.187.199