Results 1 to 5 of 5

Thread: search registry

  1. #1

    Thread Starter
    Hyperactive Member ravi15481's Avatar
    Join Date
    Aug 2002
    Location
    INDIA
    Posts
    421

    search registry

    hi friends,

    how to search for a key in the registry.

    thanx
    A good friend...

  2. #2
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596
    oh boy, heard of search? a few weeks ago we had a really similar thread, and if im not wrong, he was answered.... ill try looking for it... but try searching next time.... a lot of questions have allready been answered...
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

  3. #3

    Thread Starter
    Hyperactive Member ravi15481's Avatar
    Join Date
    Aug 2002
    Location
    INDIA
    Posts
    421

    Red face

    thanks seec77, i usually search for threads b4 i post a new thread. i didn't get the desired result that is reason i have posted a new thread. anyway i will search again.
    A good friend...

  4. #4
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596
    oh, well...
    ill tell you what i answered to that thread...
    okay, you need to enumerate all keys, and then for each key enumerate all values.... then do a instr for each value or key or wherever you want to search...
    here is an example of enumeration from api-guide...
    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" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    6. Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
    7. Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    8. Private Sub Form_Load()
    9.     'KPD-Team 2001
    10.     'URL: [url]http://www.allapi.net/[/url]
    11.     'E-Mail: [email][email protected][/email]
    12.     Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long
    13.     Const BUFFER_SIZE As Long = 255
    14.     'Set the forms graphics mode to persistent
    15.     Me.AutoRedraw = True
    16.     Me.Print "RegEnumKeyEx"
    17.     Ret = BUFFER_SIZE
    18.     'Open the registry key
    19.     If RegOpenKey(HKEY_LOCAL_MACHINE, "Hardware", hKey) = 0 Then
    20.         'Create a buffer
    21.         sName = Space(BUFFER_SIZE)
    22.         'Enumerate the keys
    23.         While RegEnumKeyEx(hKey, Cnt, sName, Ret, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> ERROR_NO_MORE_ITEMS
    24.             'Show the enumerated key
    25.             Me.Print "  " + Left$(sName, Ret)
    26.             'prepare for the next key
    27.             Cnt = Cnt + 1
    28.             sName = Space(BUFFER_SIZE)
    29.             Ret = BUFFER_SIZE
    30.         Wend
    31.         'close the registry key
    32.         RegCloseKey hKey
    33.     Else
    34.         Me.Print "  Error while calling RegOpenKey"
    35.     End If
    36.     Me.Print vbCrLf + "RegEnumValue"
    37.     Cnt = 0
    38.     'Open a registry key
    39.     If RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", hKey) = 0 Then
    40.         'initialize
    41.         sName = Space(BUFFER_SIZE)
    42.         sData = Space(BUFFER_SIZE)
    43.         Ret = BUFFER_SIZE
    44.         RetData = BUFFER_SIZE
    45.         'enumerate the values
    46.         While RegEnumValue(hKey, Cnt, sName, Ret, 0, ByVal 0&, ByVal sData, RetData) <> ERROR_NO_MORE_ITEMS
    47.             'show data
    48.             If RetData > 0 Then Me.Print "  " + Left$(sName, Ret) + "=" + Left$(sData, RetData - 1)
    49.             'prepare for next value
    50.             Cnt = Cnt + 1
    51.             sName = Space(BUFFER_SIZE)
    52.             sData = Space(BUFFER_SIZE)
    53.             Ret = BUFFER_SIZE
    54.             RetData = BUFFER_SIZE
    55.         Wend
    56.         'Close the registry key
    57.         RegCloseKey hKey
    58.     Else
    59.         Me.Print "  Error while calling RegOpenKey"
    60.     End If
    61. End Sub
    hope you like it...
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

  5. #5

    Thread Starter
    Hyperactive Member ravi15481's Avatar
    Join Date
    Aug 2002
    Location
    INDIA
    Posts
    421
    thanks i have used the same made it a recursive function.. it works great
    A good friend...

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