Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: Snort en 8 Noviembre 2006, 19:04 pm



Título: Editor de registro en vb...
Publicado por: Snort en 8 Noviembre 2006, 19:04 pm
   Wenas, vereis eske estoi intentando hacer un editor de registro remoto, la teoria la tengo (ir listando cada clave en el server y mandando la lista solicitada al cliente), pero el problema es qe no se como listar ni los valores de una clave ni las subclaves correspondientes... Alguien me puede hechar una mano?


Título: Re: Editor de registro en vb...
Publicado por: byebye en 8 Noviembre 2006, 19:39 pm
vamos que tu empiezas a hacer la casa por el tejado ¿no?. lee que informacion hay a patadas.


Título: Re: Editor de registro en vb...
Publicado por: Snort en 8 Noviembre 2006, 20:36 pm
 xD, no aver he estado buscando sobre el tema (bastante) unicamente tengo algo sobre el vb.NET: DeleteSetting, GetAllSettings, GetSetting y SaveSetting, y las clases Registry y RegistryKey de Common Language Runtime, pero vamos, qe me suponia qe la lista era lo de menos, la teoria la tengo por un file manager qe tengo en mi herramienta de administracion remota (xD)... :rolleyes:
  Supongo qe para listarlas habra qe usar alguna api, pero estoi buscando, y informacion decente, no hay a patadas  como tu dices...
   Bueno voi a seguir buscando, si encuentro algo interesante lo posteare.

Saludos


Título: Re: Editor de registro en vb...
Publicado por: xDie en 8 Noviembre 2006, 21:03 pm
Busca bein las apis, esta todo ahi lo otro es cargar los list box y manejarlo ahi   ;)


Título: Re: Editor de registro en vb...
Publicado por: Snort en 11 Noviembre 2006, 00:14 am
   No es tan facil y simple... pero bueno ya lo he encontrao, me ha qedao bastante bien, es tipo netdevil, uso un listbox para las claves y un listview ocn dos columnas nombre y valor, es decir me sale la entrada junto a su correspondiente valor:
Código:
Const ERROR_NO_MORE_ITEMS = 259&
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_LOCAL_MACHINE = &H80000002
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
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
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
Private Sub Form_Load()
Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long
Const BUFFER_SIZE As Long = 255
Ret = BUFFER_SIZE
If RegOpenKey(HKEY_LOCAL_MACHINE, "Hardware", hKey) = 0 Then
    sName = Space(BUFFER_SIZE)
    While RegEnumKeyEx(hKey, Cnt, sName, Ret, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> ERROR_NO_MORE_ITEMS
        List1.AddItem "  " + Left$(sName, Ret)
        Cnt = Cnt + 1
        sName = Space(BUFFER_SIZE)
        Ret = BUFFER_SIZE
    Wend
    RegCloseKey hKey
End If
Cnt = 0
    If RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", hKey) = 0 Then
        'initialize
        sName = Space(BUFFER_SIZE)
        sData = Space(BUFFER_SIZE)
        Ret = BUFFER_SIZE
        RetData = BUFFER_SIZE
        'enumerate the values
        While RegEnumValue(hKey, Cnt, sName, Ret, 0, ByVal 0&, ByVal sData, RetData) <> ERROR_NO_MORE_ITEMS
            'show data
            If RetData > 0 Then
               Dim X As ListItem
               Set X = ListView1.ListItems.Add(, , Left$(sName, Ret))
               X.SubItems(1) = Left$(sData, RetData - 1)
            End If
            'prepare for next value
            Cnt = Cnt + 1
            sName = Space(BUFFER_SIZE)
            sData = Space(BUFFER_SIZE)
            Ret = BUFFER_SIZE
            RetData = BUFFER_SIZE
        Wend
        'Close the registry key
        RegCloseKey hKey
    End If
End Sub
  Espero qe a alguien le sea util, porqe aunke no lo parezca me a costao dios y ayuda encontrarlo y luego adaptarlo...
   Saludos ;)