2010/12/24

office2010 Win32API レジストリ

Option Compare Database
Option Explicit

Private Type SECURITY_ATTRIBUTES
        nLength As Long
        lpSecurityDescriptor As LongPtr
        bInheritHandle As Long
End Type

Private Type FILETIME
        dwLowDateTime As Long
        dwHighDateTime As Long
End Type

Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002

Private Const ERROR_SUCCESS = 0

Private Const REG_SZ = 1 ' Unicode nul terminated string
Private Const REG_DWORD = 4 '32-bit number

Private Const REG_OPTION_NON_VOLATILE = 0

Private Const KEY_ALL_ACCESS = &HF003F
Private Const KEY_SET_VALUE = &H2
Private Const KEY_QUERY_VALUE = &H1

Private Declare PtrSafe Function RegCreateKeyEx Lib "advapi32.dll" _
                                Alias "RegCreateKeyExA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpSubKey As String, _
                                ByVal Reserved As Long, _
                                ByVal lpClass As String, _
                                ByVal dwOptions As Long, _
                                ByVal samDesired As Long, _
                                lpSecurityAttributes As SECURITY_ATTRIBUTES, _
                                phkResult As LongPtr, _
                                lpdwDisposition As Long _
                                ) As Long

Private Declare PtrSafe Function RegOpenKeyEx Lib "advapi32.dll" _
                                Alias "RegOpenKeyExA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpSubKey As String, _
                                ByVal ulOptions As Long, _
                                ByVal samDesired As Long, _
                                phkResult As LongPtr _
                                ) As Long

' Note that if you declare the lpData parameter as String, you must pass it By Value.
' RegQueryValueEx kHnd, strName, 0, 0, ByVal strBuffer, Len(strBuffer)
Private Declare PtrSafe Function RegQueryValueEx Lib "advapi32.dll" _
                                Alias "RegQueryValueExA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpValueName As String, _
                                ByVal lpReserved As LongPtr, _
                                lpType As Long, _
                                lpData As Any, _
                                lpcbData As Long _
                                ) As Long

' Note that if you declare the lpData parameter as String, you must pass it By Value.
' RegSetValueEx kHnd, strName, 0, REG_SZ, ByVal strValue, Len(strValue)
Private Declare PtrSafe Function RegSetValueEx Lib "advapi32.dll" _
                                Alias "RegSetValueExA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpValueName As String, _
                                ByVal Reserved As Long, _
                                ByVal dwType As Long, _
                                lpData As Any, _
                                ByVal cbData As Long _
                                ) As Long

Private Declare PtrSafe Function RegDeleteKey Lib "advapi32.dll" _
                                Alias "RegDeleteKeyA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpSubKey As String _
                                ) As Long

Private Declare PtrSafe Function RegDeleteValue Lib "advapi32.dll" _
                                Alias "RegDeleteValueA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpValueName As String _
                                ) As Long

Private Declare PtrSafe Function RegCloseKey Lib "advapi32.dll" ( _
                                ByVal hKey As LongPtr _
                                ) As Long

Private Declare PtrSafe Function RegQueryInfoKey Lib "advapi32.dll" _
                                Alias "RegQueryInfoKeyA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal lpClass As String, _
                                lpcbClass As Long, _
                                ByVal lpReserved As LongPtr, _
                                lpcSubKeys As Long, _
                                lpcbMaxSubKeyLen As Long, _
                                lpcbMaxClassLen As Long, _
                                lpcValues As Long, _
                                lpcbMaxValueNameLen As Long, _
                                lpcbMaxValueLen As Long, _
                                lpcbSecurityDescriptor As Long, _
                                lpftLastWriteTime As FILETIME _
                                ) As Long

Private Declare PtrSafe Function RegEnumKeyEx Lib "advapi32.dll" _
                                Alias "RegEnumKeyExA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal dwIndex As Long, _
                                ByVal lpName As String, _
                                lpcbName As Long, _
                                ByVal lpReserved As LongPtr, _
                                ByVal lpClass As String, _
                                lpcbClass As Long, _
                                lpftLastWriteTime As FILETIME _
                                ) As Long

Private Declare PtrSafe Function RegEnumValue Lib "advapi32.dll" _
                                Alias "RegEnumValueA" ( _
                                ByVal hKey As LongPtr, _
                                ByVal dwIndex As Long, _
                                ByVal lpValueName As String, _
                                lpcbValueName As Long, _
                                ByVal lpReserved As LongPtr, _
                                lpType As Long, lpData As Byte, _
                                lpcbData As Long _
                                ) As Long

0 件のコメント: