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

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  ->Duda Con Array Of Byte
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ->Duda Con Array Of Byte  (Leído 2,346 veces)
NsTeam

Desconectado Desconectado

Mensajes: 127


Ver Perfil
->Duda Con Array Of Byte
« en: 8 Julio 2009, 03:31 am »

Hola A todos

Bueno tengo Una Duda Con Un Programa Que QUiero Hacer

Lo Cual Necesito Un Poko de Su Ayuda

Bueno Tengo Un Proyecto en Visual Basic

Lo Cual Solo Puede editar  Valores De HAsta 4 Bytes

Y lo que Yo en Si quiero Es Que Tambien Se Puedan Editar

En mas Byter E Incluso en Array Of Byte

EL Code Que Tengo En UN Module es Este






Public Const PROCESS_ALL_ACCESS = &H1F0FFF

Dim f1holder As Integer

Dim timer_pos As Long

'API Declaration

Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long

Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long

Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer

Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Public Function WriteAByte(gamewindowtext As String, address As Long, value As Byte)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

WriteProcessMemory phandle, address, value, 1, 0&

CloseHandle hProcess

End Function

Public Function WriteAnInt(gamewindowtext As String, address As Long, value As Integer)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

WriteProcessMemory phandle, address, value, 2, 0&

CloseHandle hProcess

End Function

Public Function WriteALong(gamewindowtext As String, address As Long, value As Long)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

WriteProcessMemory phandle, address, value, 4, 0&

CloseHandle hProcess

End Function

Public Function ReadAByte(gamewindowtext As String, address As Long, valbuffer As Byte)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

ReadProcessMem phandle, address, valbuffer, 1, 0&

CloseHandle hProcess

End Function

Public Function ReadAnInt(gamewindowtext As String, address As Long, valbuffer As Integer)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

ReadProcessMem phandle, address, valbuffer, 2, 0&

CloseHandle hProcess

End Function

Public Function ReadALong(gamewindowtext As String, address As Long, valbuffer As Long)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

ReadProcessMem phandle, address, valbuffer, 4, 0&

CloseHandle hProcess

End Function

Public Function ReadAFloat(gamewindowtext As String, address As Long, valbuffer As Single)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

ReadProcessMem phandle, address, valbuffer, 4, 0&

CloseHandle hProcess

End Function

 

Public Function WriteAFloat(gamewindowtext As String, address As Long, value As Single)

Dim hWnd As Long

Dim pid As Long

Dim phandle As Long

hWnd = FindWindow(vbNullString, gamewindowtext)

If (hWnd = 0) Then

MsgBox "The Game Is Not Working", vbCritical, "Error"

End

Exit Function

End If

GetWindowThreadProcessId hWnd, pid

phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)

If (phandle = 0) Then

MsgBox "Can't get ProcessId", vbCritical, "Error"

Exit Function

End If

WriteProcessMemory phandle, address, value, 4, 0&

CloseHandle hProcess

End Function







Bueno Como VIeron Solo Tengo Hasta  4bytes

Pero Lo QUe En Si quiero ES Que TAmbien Se PUeda editar

valores de entre 4 bytes a Mas

Nose Si Me Explico Bien

Pero Espero De Sus Respuestas =)


En línea

LeandroA
Moderador
***
Desconectado Desconectado

Mensajes: 760


www.leandroascierto.com


Ver Perfil WWW
Re: ->Duda Con Array Of Byte
« Respuesta #1 en: 8 Julio 2009, 04:34 am »

Hola provaste enviar Array() de bits?

Tambien podes enviar estructuras y podes utilizar VarPtr()

por ejemplo algo asi


Private Type MyType
      lA As Long
      lB As Long
      bC As Byte
End Type

Dim MT As MyType


WriteProcessMemory ProcessHandle, MemoryAddress, VarPtr(MT), Len(MT), 0

yo no lo mastico bien esto, pero bueno es algo asi, tambien mira como tenes declaradas los paramentros de las apis, yo aconsejo que si no entendes este modulo vayas estudiando cada una de sus api para no hacerte un lio.

Saludos



En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
ayuda con code de visual basic array byte a hexa « 1 2 »
Programación Visual Basic
Fucko 10 6,494 Último mensaje 15 Junio 2011, 06:09 am
por Fucko
[Sources Code] RotBits [Byte TO Byte ]
Programación Visual Basic
x64core 8 5,644 Último mensaje 22 Octubre 2011, 00:46 am
por BlackZeroX
Ejecución desde un byte array
Análisis y Diseño de Malware
xoftfox 3 3,226 Último mensaje 9 Febrero 2014, 21:40 pm
por Yoel Alejandro
es posible concatenar un array byte? « 1 2 »
Programación C/C++
Belial & Grimoire 14 10,178 Último mensaje 15 Febrero 2014, 18:58 pm
por x64core
Filestream . Byte a Byte
.NET (C#, VB.NET, ASP)
blaron 3 3,227 Último mensaje 5 Abril 2014, 02:01 am
por Eleкtro
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines