So I've been over and over and over this and for some reason it completely escapes me. I cannot get this to read 64bit information properly and I could really use a hand as to what I'm missing here. I appreciate it.
Code:
Public Class Form1
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Integer, ByVal lpSubkey As String, ByVal ulOptions As Integer, ByVal samDesired As Integer, ByRef phkResult As Integer) As Integer
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Integer) As Integer
Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Integer, ByVal dwIndex As Integer, ByVal lpName As String, ByRef lpcbName As Integer, ByVal lpReserved As Integer, ByVal lpClass As String, ByRef lpcbClass As Integer, ByRef lpftLastWriteTime As FILETIME) As Integer
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_WOW64_64KEY = &H100
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_ALL_ACCESS = &H3F
Structure FILETIME
Dim lLowDateTime
Dim lHighDateTime
End Structure
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim Res As Integer
Dim hKey As Integer
Dim Key As String
Dim lngIndex As Integer
Dim lngName As Integer
Dim strName As String
Dim lngClass As Integer
Dim strClass As String
Dim LWT As FILETIME
Me.ListBox1.Items.Clear()
Key = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\"
hKey = HKEY_LOCAL_MACHINE
Res = RegOpenKeyEx(hKey, Key, 0, KEY_ENUMERATE_SUB_KEYS + KEY_WOW64_64KEY, hKey)
lngIndex = 0
If Res = 0 Then
Do
lngName = 256
lngClass = 256
strName = Space(256)
strClass = Space(256)
Res = RegEnumKeyEx(hKey, lngIndex, strName, lngName, 0, strClass, lngClass, LWT)
lngIndex = lngIndex + 1
If Res = 0 Then
Me.ListBox1.Items.Add(Microsoft.VisualBasic.Left(strName, lngName))
End If
Loop Until Res <> 0
End If
RegCloseKey(Res)
End Sub
End Class