Option Explicit
Declare PtrSafe Function RegGetValueW Lib "advapi32.dll" ( _
ByVal k As LongPtr, _
ByVal s As LongPtr, _
ByVal v As LongPtr, _
ByVal f As Long, _
ByVal t As LongPtr, _
ByVal d As LongPtr, _
ByVal n As LongPtr) _
As LongPtr
Sub DoRegTest()
Dim b(0 To 2048) As Byte
Dim n As Long
Dim r As LongPtr
Const HKEY_LOCAL_MACHINE = &H80000002
n = 2048
r = RegGetValueW( _
HKEY_LOCAL_MACHINE, _ StrPtr("SOFTWARE\Microsoft\Cryptography"), _
StrPtr("MachineGuid"), _
2, _
0, _
VarPtr(b(0)), VarPtr(n))
End Sub
↑この感じでSZ型のキーを読み取った