elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  module interesnte para modificar el registro
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: module interesnte para modificar el registro  (Leído 1,716 veces)
rembolso

Desconectado Desconectado

Mensajes: 163



Ver Perfil
module interesnte para modificar el registro
« en: 12 Junio 2009, 06:27 am »

hola tengo un module que no me acuerdo de donde me lo descargue . pero cuando intento yamar a esta funcion   me da argumento no opcional
Citar
Public Function GetStringVal(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String, ByVal strValue As String) As String
    Dim KeyHnd As Long
    Dim datatype As Long
    Dim lResult As Long
    Dim strBuf As String
    Dim lDataBufSize As Long
    Dim lValueType As Long
    Dim intZeroPos As Integer
    r = RegOpenKey(Hkey, SubKey, KeyHnd)
    lResult = RegQueryValueEx(KeyHnd, strValue, 0&, lValueType, ByVal 0&, lDataBufSize)


    If lValueType = REG_SZ Then

        strBuf = String$(lDataBufSize, " ")
        lResult = RegQueryValueEx(KeyHnd, strValue, 0&, 0&, ByVal strBuf, lDataBufSize)

        If lResult = ERROR_SUCCESS Then
            intZeroPos = InStr(strBuf, Chr$(0))

            If intZeroPos > 0 Then
                GetStringVal = Left$(strBuf, intZeroPos - 1)
            Else
                GetStringVal = strBuf
            End If
        End If
    Else
        Err.Raise vbObjectError + 513, strValue, strValue
    End If
End Function

AK LES DEJO EL CODIGO DEL MODULO
Citar
Option Explicit
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String) As Long
Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal Hkey As Long, ByVal lpValueName As String) As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
'FIXIT: As Any is not supported in Visual Basic .NET. Use a specific type.                 FixIT90210ae-R5608-H1984
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
'FIXIT: As Any is not supported in Visual Basic .NET. Use a specific type.                 FixIT90210ae-R5608-H1984
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long

Public Enum HKEYRegConstants
    HKEY_CLASSES_ROOT = &H80000000
    HKEY_CURRENT_USER = &H80000001
    HKEY_LOCAL_MACHINE = &H80000002
    HKEY_USERS = &H80000003
    HKEY_PERFORMANCE_DATA = &H80000004
End Enum

Public Const ERROR_SUCCESS = 0&
Public Const REG_SZ = 1
Public Const REG_DWORD = 4

Public r As Long


Public Sub CreateKey(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String)
    Dim KeyHnd&
    r = RegCreateKey(Hkey, SubKey, KeyHnd&)
    r = RegCloseKey(KeyHnd&)
End Sub



Public Function GetStringVal(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String, ByVal strValue As String) As String
    Dim KeyHnd As Long
    Dim datatype As Long
    Dim lResult As Long
    Dim strBuf As String
    Dim lDataBufSize As Long
    Dim lValueType As Long
    Dim intZeroPos As Integer
    r = RegOpenKey(Hkey, SubKey, KeyHnd)
    lResult = RegQueryValueEx(KeyHnd, strValue, 0&, lValueType, ByVal 0&, lDataBufSize)


    If lValueType = REG_SZ Then

        strBuf = String$(lDataBufSize, " ")
        lResult = RegQueryValueEx(KeyHnd, strValue, 0&, 0&, ByVal strBuf, lDataBufSize)

        If lResult = ERROR_SUCCESS Then
            intZeroPos = InStr(strBuf, Chr$(0))

            If intZeroPos > 0 Then
                GetStringVal = Left$(strBuf, intZeroPos - 1)
            Else
                GetStringVal = strBuf
            End If
        End If
    Else
        Err.Raise vbObjectError + 513, strValue, strValue
    End If
End Function


Public Sub SaveStringVal(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String, ByVal SubString As String, ByVal Value As String)
   
    Dim KeyHnd As Long
    Dim r As Long
    r = RegCreateKey(Hkey, SubKey, KeyHnd)
    r = RegSetValueEx(KeyHnd, SubString, 0, REG_SZ, ByVal Value, Len(Value))
    r = RegCloseKey(KeyHnd)
End Sub


Function GetDwordVal(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String, ByVal strValueName As String) As Long
   
    Dim lResult As Long
    Dim lValueType As Long
    Dim lBuf As Long
    Dim lDataBufSize As Long
    Dim r As Long
    Dim KeyHnd As Long
    r = RegOpenKey(Hkey, SubKey, KeyHnd)
    lDataBufSize = 4
    lResult = RegQueryValueEx(KeyHnd, strValueName, 0&, lValueType, lBuf, lDataBufSize)


    If lResult = ERROR_SUCCESS Then
        If lValueType = REG_DWORD Then
            GetDwordVal = lBuf
        End If
       
    End If
    r = RegCloseKey(KeyHnd)
End Function



Function SaveDwordVal(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String, ByVal strValueName As String, ByVal lData As Long) As Long
   
    Dim lResult As Long
    Dim KeyHnd As Long
    Dim r As Long
    r = RegCreateKey(Hkey, SubKey, KeyHnd)
    lResult = RegSetValueEx(KeyHnd, strValueName, 0&, REG_DWORD, lData, 4)
   
    r = RegCloseKey(KeyHnd)
End Function


Public Function DeleteKey(ByVal Hkey As HKEYRegConstants, ByVal strKey As String) As Long
   
        r = RegDeleteKey(Hkey, strKey)
End Function


Public Function DeleteValue(ByVal Hkey As HKEYRegConstants, ByVal SubKey As String, ByVal strValue As String) As Long
   
    Dim KeyHnd As Long
    r = RegOpenKey(Hkey, SubKey, KeyHnd)
    r = RegDeleteValue(KeyHnd, strValue)
    r = RegCloseKey(KeyHnd)
End Function
COMO HAGO PARA Q TODO ESO SE CARGUE EN UN TXTBOX  PARA DESPUES PASARLO A UNA LISTA O A OTRA COSA


En línea

ssccaann43 ©


Desconectado Desconectado

Mensajes: 792


¬¬


Ver Perfil
Re: module interesnte para modificar el registro
« Respuesta #1 en: 12 Junio 2009, 16:58 pm »

No entiendo bien que quieres hacer. Qué deseas cargar en un textbox? especifica por favor para poder ayudarte!


En línea

- Miguel Núñez
Todos tenemos derechos a ser estupidos, pero algunos abusan de ese privilegio...
"I like ^TiFa^"
BlackZeroX
Wiki

Desconectado Desconectado

Mensajes: 3.158


I'Love...!¡.


Ver Perfil WWW
Re: module interesnte para modificar el registro
« Respuesta #2 en: 12 Junio 2009, 20:46 pm »

hola tengo un module que no me acuerdo de donde me lo descargue . pero cuando intento yamar a esta funcion   me da argumento no opcional

Ese error aparece cuando FALTAN ARGUMENTOS EN UNA FUNCION (Estos argumentos deben ser del mismo tipo del argumento de la funcion/proceso/etc.) para que esta Trabaje adecuadamente por ejemplo:

Código
  1. public function sumar(byval num1 as integer,byval num2 as integer,optional byval num3 as integer) as integer
  2.     'Se requiere que metas el valor de la variable Num1 y de Num2 sIEMPRE NUMERICOS DE TIPO ENTERO 'Integer'
  3.     'NUM3 es opcionla y puede o no ser asignado un 'X' Numero
  4.     suma=num1+num2+num3
  5. end function
  6.  

En algún proceso 'X'
Por ende esta se puede llamar de DOS formas
Código
  1.     dim res as integer
  2.     res= sumar(10,10)
  3.     msgbox res
  4.  
o de igual forma
Código
  1.     dim res as integer
  2.     res=sumar(10+10+12)
  3.     msgbox res
  4.  

Cabe destacar que cuando se asigna opcional un parametro de una funcion este si no le es asignado un valor al momento de llamalo obtiene el valor POR DEFAULT esn este caso será cero por ser tipo numerico y si es textual seria nada de texto, igual podria ser el valor que se le implanta a la Funcion/Proseso/X en cuention

Código
  1. public function sumar(byval num1 as integer,byval num2 as integer,optional byval num3 as integer=999) as integer
  2.     'Se requiere que metas el valor de la variable Num1 y de Num2 sIEMPRE NUMERICOS DE TIPO ENTERO 'Integer'
  3.     'NUM3 es opcionla y puede o no ser asignado un 'X' Numero
  4.     suma=num1+num2+num3
  5. end function
  6.  

en la funcion anterior si no se asigna un valor a num3 este por default obtendra el valor 999 si es que se llegase a llamar de la siguiente manera

Código
  1. dim res=sumar(10,10)
  2. msgbox res 'Da como resultado 1019 por el valor de Num3 q se tomo el valor por default
  3.  
« Última modificación: 12 Junio 2009, 20:48 pm por ░▒▓BlackZeroҖ▓▒░ » En línea

The Dark Shadow is my passion.
rembolso

Desconectado Desconectado

Mensajes: 163



Ver Perfil
Re: module interesnte para modificar el registro
« Respuesta #3 en: 13 Junio 2009, 00:45 am »

ok gracias ya lo entendi . haora ya consegui un modulo mejor donde ise un  proyecto igual q el editor de registro . saludos
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Para que sirve el componente de Intel Common User Interface Module
Software
Mister12 1 3,595 Último mensaje 29 Agosto 2013, 20:57 pm
por McKinnon
ModuleNotFoundError: No module named 'cryptography
Scripting
ElMag0 0 2,754 Último mensaje 1 Agosto 2022, 13:34 pm
por ElMag0
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines