Results 1 to 3 of 3

Thread: How can you get all values from a registry folder?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2002
    Posts
    628

    How can you get all values from a registry folder?

    anyone know?

  2. #2
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    Check it out:

    VB Code:
    1. Const ERROR_NO_MORE_ITEMS = 259&
    2. Const HKEY_CURRENT_CONFIG = &H80000005
    3. Const HKEY_LOCAL_MACHINE = &H80000002
    4. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    5. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
    6. (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    7. Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" _
    8. (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, _
    9. ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
    10. Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" _
    11. (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, _
    12. lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    13. Private Sub Form_Load()
    14.     Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long
    15.     Const BUFFER_SIZE As Long = 255
    16.  
    17.    
    18.     If RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", hKey) = 0 Then
    19.        
    20.         sName = Space(BUFFER_SIZE)
    21.         sData = Space(BUFFER_SIZE)
    22.         Ret = BUFFER_SIZE
    23.         RetData = BUFFER_SIZE
    24.        
    25.         While RegEnumValue(hKey, Cnt, sName, Ret, 0, ByVal 0&, ByVal sData, RetData) <> ERROR_NO_MORE_ITEMS
    26.        
    27.             If RetData > 0 Then List1.AddItem Left$(sName, Ret) + "=" + Left$(sData, RetData - 1)
    28.             Cnt = Cnt + 1
    29.             sName = Space(BUFFER_SIZE)
    30.             sData = Space(BUFFER_SIZE)
    31.             Ret = BUFFER_SIZE
    32.             RetData = BUFFER_SIZE
    33.         Wend
    34.         RegCloseKey hKey
    35.     Else
    36.        MsgBox "Error while calling RegOpenKey"
    37.     End If
    38. End Sub

    This will enum all values in a registry folder...
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  3. #3
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    are u creating an trojan or something? Coz u also needed to know how to kill processes... Trojans sux
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width