Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How do I write a byte array to an address in VB.Net?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
The0neThe0nly
Expert Cheater
Reputation: 0

Joined: 08 Dec 2009
Posts: 119
Location: In a box

PostPosted: Sun Oct 07, 2012 7:03 pm    Post subject: How do I write a byte array to an address in VB.Net? Reply with quote

I'm trying to make a trainer in Visual Basic 2010 and I want to know how to write arrays of byte to addresses in different processes. I assume you use WriteProcessMemory or you can get a module from somewhere to add to my project.
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Tue Oct 09, 2012 2:50 am    Post subject: Reply with quote

API
Code:
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As Integer, ByVal buffer As Byte(), ByVal size As Integer, ByVal lpNumberOfBytesWritten As Integer) As Boolean


A very simple function, no pointers or modules.
Code:
    Function WriteBytes(ByVal ProcessName As String, ByVal Address As Integer, ByVal Bytes2Write As Byte()) As Boolean
        Dim Proc As Process() = Process.GetProcessesByName(ProcessName)
        If Proc.Length = 0 Then
            Return False
        End If
        Return WriteProcessMemory(Proc(0).Handle, Address, Bytes2Write, Bytes2Write.Length, 0)
    End Function


All you need now is the process name, address you're writing too and the array of bytes you wanna write.

example
Code:
WriteBytes("SomeGame", &H4000000, New Byte() {&H90, &H90, &H90, &H90, &H90})

Just change it to whatever you need.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites