Autor
|
Tema: Introducir valor binario en registro usando VB script (Leído 6,544 veces)
|
jackl007
Desconectado
Mensajes: 1.403
[UserRPL]
|
Aun no consigo modificar un valor en el registro de windows, en el cual pueda introducir un valor ("00 00 00 00" y "01 00 00 00") del tipo "REG_BINARY" Se que lo puedo lograr con esto, que estuve buscando: dim Num as Interger Num = 1 'es el valor que se introducira en forma binaria Dim WshShell, bKey Set WshShell = CreateObject("WScript.Shell") WshShell.RegWrite "HKEY_CURRENT_USER\SOFTWARE\...\llave", Num, "REG_BINARY"
pero el problema es que no consigo dar con el valor que me de: "00 00 00 00" y "01 00 00 00". He usado un traductor de binario: http://www.guardaqua.it/risorse/binario.phpy alli si coloco: "01 00 00 00"; me dice que pertenece a "@" (no es entero :S) ¿Como lo logro? imagen de lo que quiero llegar a hacer:
|
|
|
En línea
|
|
|
|
Mad Antrax
|
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long 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 RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long Const ERROR_SUCCESS = 0& Const ERROR_BADDB = 1009& Const ERROR_BADKEY = 1010& Const ERROR_CANTOPEN = 1011& Const ERROR_CANTREAD = 1012& Const ERROR_CANTWRITE = 1013& Const ERROR_OUTOFMEMORY = 14& Const ERROR_INVALID_PARAMETER = 87& Const ERROR_ACCESS_DENIED = 5& Const ERROR_NO_MORE_ITEMS = 259& Const ERROR_MORE_DATA = 234& Const REG_NONE = 0& Const REG_SZ = 1& Const REG_EXPAND_SZ = 2& Const REG_BINARY = 3& Const REG_DWORD = 4& Const REG_DWORD_LITTLE_ENDIAN = 4& Const REG_DWORD_BIG_ENDIAN = 5& Const REG_LINK = 6& Const REG_MULTI_SZ = 7& Const REG_RESOURCE_LIST = 8& Const REG_FULL_RESOURCE_DESCRIPTOR = 9& Const REG_RESOURCE_REQUIREMENTS_LIST = 10& Const KEY_QUERY_VALUE = &H1& Const KEY_SET_VALUE = &H2& Const KEY_CREATE_SUB_KEY = &H4& Const KEY_ENUMERATE_SUB_KEYS = &H8& Const KEY_NOTIFY = &H10& Const KEY_CREATE_LINK = &H20& Const READ_CONTROL = &H20000 Const WRITE_DAC = &H40000 Const WRITE_OWNER = &H80000 Const SYNCHRONIZE = &H100000 Const STANDARD_RIGHTS_REQUIRED = &HF0000 Const STANDARD_RIGHTS_READ = READ_CONTROL Const STANDARD_RIGHTS_WRITE = READ_CONTROL Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Const KEY_WRITE = STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Const KEY_EXECUTE = KEY_READ Dim hKey As Long, MainKeyHandle As Long Function SetBinaryValue(SubKey As String, Entry As String, Value As String) Dim i Call ParseKey(SubKey, MainKeyHandle) If MainKeyHandle Then rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key If rtn = ERROR_SUCCESS Then 'if the key was open successfully then lDataSize = Len(Value) ReDim ByteArray(lDataSize) For i = 1 To lDataSize ByteArray(i) = Asc(Mid$(Value, i, 1)) Next rtn = RegSetValueExB(hKey, Entry, 0, REG_BINARY, ByteArray(1), lDataSize) 'write the value If Not rtn = ERROR_SUCCESS Then 'if the was an error writting the value If DisplayErrorMsg = True Then 'if the user want errors displayed 'MsgBox ErrorMsg(rtn) 'display the error End If End If rtn = RegCloseKey(hKey) 'close the key Else 'if there was an error opening the key If DisplayErrorMsg = True Then 'if the user wants errors displayed 'MsgBox ErrorMsg(rtn) 'display the error End If End If End If
El código, por supuesto, no lo he escrito yo. Lo saqué del source de un server del troyano Black Dream, no lo he probado pero tiene que funcionar, llamas a la función con estos parametros y listos, analiza el código si tienes dudas, saludos!! SetBinaryValue(SubKey As String, Entry As String, Value As String)
|
|
|
En línea
|
No hago hacks/cheats para juegos Online. Tampoco ayudo a nadie a realizar hacks/cheats para juegos Online.
|
|
|
jackl007
Desconectado
Mensajes: 1.403
[UserRPL]
|
hay cosas que van en el modulo, y hay una funcion que falta: Call ParseKey la puedes postear Mad?
|
|
|
En línea
|
|
|
|
jackl007
Desconectado
Mensajes: 1.403
[UserRPL]
|
Para Mad: (supongo que leiste el privado) Luego de que encuentre la manera de hacer esto; te mando el source completo para que lo implementes a tu kick msn; y creo que es mejor que no subas el source del nuevo (si es q lo haces) para evitar copy & paste; y se queden con la duda de como lo hacen ... aunq lo he probado (haciendolo manualmnte) en el windows live msn 8; nose si servira para los otras versiones del msn; pero en caso de que no funcione asi ... pues ya se como encontrarla y se podria implementarla tambien
|
|
|
En línea
|
|
|
|
Mad Antrax
|
Private Sub ParseKey(KeyName As String, Keyhandle As Long) rtn = InStr(KeyName, "\") 'return if "\" is contained in the Keyname If Left(KeyName, 5) <> "HKEY_" Or Right(KeyName, 1) = "\" Then 'if the is a "\" at the end of the Keyname then 'MsgBox "Incorrect Format:" + Chr(10) + Chr(10) + KeyName 'display error to the user Exit Sub 'exit the procedure ElseIf rtn = 0 Then 'if the Keyname contains no "\" Keyhandle = GetMainKeyHandle(KeyName) KeyName = "" 'leave Keyname blank Else 'otherwise, Keyname contains "\" Keyhandle = GetMainKeyHandle(Left(KeyName, rtn - 1)) 'seperate the Keyname KeyName = Right(KeyName, Len(KeyName) - rtn) End If End Sub Function GetMainKeyHandle(MainKeyName As String) As Long Const HKEY_CLASSES_ROOT = &H80000000 Const HKEY_CURRENT_USER = &H80000001 Const HKEY_LOCAL_MACHINE = &H80000002 Const HKEY_USERS = &H80000003 Const HKEY_PERFORMANCE_DATA = &H80000004 Const HKEY_CURRENT_CONFIG = &H80000005 Const HKEY_DYN_DATA = &H80000006 Select Case MainKeyName Case "HKEY_CLASSES_ROOT" GetMainKeyHandle = HKEY_CLASSES_ROOT Case "HKEY_CURRENT_USER" GetMainKeyHandle = HKEY_CURRENT_USER Case "HKEY_LOCAL_MACHINE" GetMainKeyHandle = HKEY_LOCAL_MACHINE Case "HKEY_USERS" GetMainKeyHandle = HKEY_USERS Case "HKEY_PERFORMANCE_DATA" GetMainKeyHandle = HKEY_PERFORMANCE_DATA Case "HKEY_CURRENT_CONFIG" GetMainKeyHandle = HKEY_CURRENT_CONFIG Case "HKEY_DYN_DATA" GetMainKeyHandle = HKEY_DYN_DATA End Select End Function
Aqui está la PerseKey, y más abajo te dejo otros metodos para trabajar con el registro: Function SetDWORDValue(SubKey As String, Entry As String, Value As Long) Call ParseKey(SubKey, MainKeyHandle) If MainKeyHandle Then rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key If rtn = ERROR_SUCCESS Then rtn = RegSetValueExA(hKey, Entry, 0, REG_DWORD, Value, 4) If Not rtn = ERROR_SUCCESS Then If DisplayErrorMsg = True Then 'MsgBox ErrorMsg(rtn) End If End If rtn = RegCloseKey(hKey) 'close the key Else 'if there was an error opening the key If DisplayErrorMsg = True Then 'if the user want errors displayed 'MsgBox ErrorMsg(rtn) 'display the error End If End If End If End Function Function SetBinaryValue(SubKey As String, Entry As String, Value As String) Dim i Call ParseKey(SubKey, MainKeyHandle) If MainKeyHandle Then rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key If rtn = ERROR_SUCCESS Then 'if the key was open successfully then lDataSize = Len(Value) ReDim ByteArray(lDataSize) For i = 1 To lDataSize ByteArray(i) = Asc(Mid$(Value, i, 1)) Next rtn = RegSetValueExB(hKey, Entry, 0, REG_BINARY, ByteArray(1), lDataSize) 'write the value If Not rtn = ERROR_SUCCESS Then 'if the was an error writting the value If DisplayErrorMsg = True Then 'if the user want errors displayed 'MsgBox ErrorMsg(rtn) 'display the error End If End If rtn = RegCloseKey(hKey) 'close the key Else 'if there was an error opening the key If DisplayErrorMsg = True Then 'if the user wants errors displayed 'MsgBox ErrorMsg(rtn) 'display the error End If End If End If End Function Function CreateKey(SubKey As String) Call ParseKey(SubKey, MainKeyHandle) If MainKeyHandle Then rtn = RegCreateKey(MainKeyHandle, SubKey, hKey) 'create the key If rtn = ERROR_SUCCESS Then 'if the key was created then rtn = RegCloseKey(hKey) 'close the key End If End If
espero que ahora te sirva
|
|
« Última modificación: 21 Enero 2008, 22:20 pm por ||MadAntrax|| »
|
En línea
|
No hago hacks/cheats para juegos Online. Tampoco ayudo a nadie a realizar hacks/cheats para juegos Online.
|
|
|
jackl007
Desconectado
Mensajes: 1.403
[UserRPL]
|
Gracias, pero no consigo lograr eso ... Seguire buscando ...
|
|
|
En línea
|
|
|
|
jackl007
Desconectado
Mensajes: 1.403
[UserRPL]
|
bueno ya lo solucione lo que estaba haciendo al principio esta bien para lo que necsito Gracias igualmnte Mad!
|
|
|
En línea
|
|
|
|
Zaraki_lkenpachi
Desconectado
Mensajes: 54
|
hola amigos queria preguntarles en donde hay informacion sobre esas librerias que usan en Visual Basic soy nuevo en esto pero la estoy aprendiendo pero lo que no entiendo es eso de Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long 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 RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long [/quote] pues de donde sacan esas librerias algo de informacion es lo que quiero por ejemplo advapi32.dll ... que funciones me brinda o que cosa ?? :o
|
|
|
En línea
|
|
|
|
|
|
Mensajes similares |
|
Asunto |
Iniciado por |
Respuestas |
Vistas |
Último mensaje |
|
|
Escribir valor binario en registro
Programación Visual Basic
|
oskoa
|
2
|
3,453
|
27 Diciembre 2010, 23:18 pm
por oskoa
|
|
|
Archivo binario, al leerlo me muestra 2 veces el ultimo registro
Programación C/C++
|
.:BlackCoder:.
|
6
|
8,183
|
13 Marzo 2011, 05:58 am
por .:BlackCoder:.
|
|
|
[Python] Introducir la contraseña de un usario desde el propio script
Scripting
|
SrCooper
|
8
|
8,695
|
27 Abril 2014, 16:00 pm
por daryo
|
|
|
introducir valor a funccion ( char * x [] )
Programación C/C++
|
70N1
|
7
|
2,656
|
23 Septiembre 2014, 16:14 pm
por eferion
|
|
|
Renombrar una clave de registro usando c#
.NET (C#, VB.NET, ASP)
|
Borito30
|
3
|
2,554
|
31 Marzo 2017, 23:39 pm
por Borito30
|
|