So you want to make a tool in VB.NET to change the name or what exactly is your question?
First,thanks anyone who answered me
That address include Pointer & Offset
I will be basic Read/Write Pointer & Offset, but i don't know how to do this...(unicode string)
There are no similar examples in Google search
How to read/write unicode string in VB.NET?![]()
Last edited by donpusher; 09-10-2017 at 08:57 PM.
So you want to make a tool in VB.NET to change the name or what exactly is your question?
You can "convert" the name you want to a byte array like this:
Then write that byte array to the process using WriteProcessMemory.Code:Public Shared Function StrToByteArray(str As String) As Byte() Dim unicodeEncoding As UnicodeEncoding = New UnicodeEncoding() Return unicodeEncoding.GetBytes(str) End Function
Where's i do wrong?Code:Imports System Imports System.Text Imports System.Runtime.InteropServices Imports Microsoft.VisualBasic.Strings Public Class Form1 Function GetModuleHandle(ByVal Processx As String, ByVal modulex As String) As IntPtr Dim AAA As Process() = Process.GetProcessesByName(Processx) If AAA.Length > 0 Then On Error Resume Next Dim BBB As ProcessModuleCollection = AAA(0).Modules For Each pmod As ProcessModule In BBB If pmod.ModuleName = (modulex) Then Return pmod.BaseAddress Else End If Next End If End Function Public Function AVA(ByVal proc As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Byte(), ByVal Level As Integer) As Boolean Try Dim lvl As Integer = Address For i As Integer = 1 To Level lvl = ReadLong(proc, lvl,) + Offsets(i - 1) Next WriteStr(proc, lvl, Value(0),) Return True Catch ex As Exception Return False End Try End Function Public Shared Function StrToByteArray(str As String) As Byte() Dim st As UnicodeEncoding = New UnicodeEncoding() Return st.GetBytes(str) End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim a As Process() = Process.GetProcessesByName("ava") Dim Mem As Boolean = True Mem = AVA("ava", GetModuleHandle("ava", "ava.exe") + &H2406774, {&H90, &H0}, StrToByteArray(TextBox1.Text), 2) If Mem = True Then MsgBox("Success", 64, "Try") Else MsgBox("Failed", 64, "Try") End If Catch ex As Exception End Tryor some things i missed
This code are written on correct Address.
But,when I execute he always writes 1st string only...
ex:MPGH , only write "M" to processmemory
You are only passing the first byte of "Value" to your "WriteStr" function so why would you expect it to write anything else than just the first character?
Try this:
Code:Imports System.Text Imports System.Runtime.InteropServices Public Class Form1 Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <[In](), Out()> ByVal buffer As Byte(), ByVal size As UInt32, ByRef lpNumberOfBytesRead As IntPtr) As Int32 Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As System.UInt32, <Out()> ByRef lpNumberOfBytesWritten As IntPtr) As Boolean Private Function ReadBytes(ByVal ProcessHandle As IntPtr, ByVal memAdr As Long, ByVal bytesToRead As UInteger) As Byte() Dim BytesRead As IntPtr Dim Buffer As Byte() = New Byte(bytesToRead - 1) {} ReadProcessMemory(ProcessHandle, New IntPtr(memAdr), Buffer, bytesToRead, BytesRead) Return Buffer End Function Public Function WriteBytes(ByVal ProcessHandle As IntPtr, ByVal memAdr As Long, ByVal bytes As Byte(), ByVal length As UInteger) As Boolean Dim BytesWritten As IntPtr Dim Result As Integer = WriteProcessMemory(ProcessHandle, New IntPtr(memAdr), bytes, length, BytesWritten) Return Result <> 0 End Function Public Function ReadInt32(ByVal ProcessHandle As IntPtr, ByVal memAdr As Int32) As Integer Return BitConverter.ToInt32(ReadBytes(ProcessHandle, memAdr, 4), 0) End Function Public Function AVA(ByVal ProcessHandle As IntPtr, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Byte()) As Boolean Try Dim Current As Integer = Address For i As Integer = 1 To Offsets.Length Current = ReadInt32(ProcessHandle, Current) + Offsets(i - 1) Next WriteBytes(ProcessHandle, Current, Value, Value.Length) Return True Catch ex As Exception Return False End Try End Function Public Shared Function StrToByteArray(str As String) As Byte() Dim UE As UnicodeEncoding = New UnicodeEncoding() Return UE.GetBytes(str) End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim AVAProcesses As Process() = Process.GetProcessesByName("AVA") If AVAProcesses.Length > 0 Then Dim Mem As Boolean = AVA(AVAProcesses(0).Handle, AVAProcesses(0).MainModule.BaseAddress + &H2406774, {&H90, &H0}, StrToByteArray(TextBox1.Text + vbNullChar)) If Mem = True Then MsgBox("Success", 64, "Try") Else MsgBox("Failed", 64, "Try") End If Else MsgBox("Process not found", 64, "Try") End If Catch ex As Exception MsgBox("Error", 64, "Catch") End Try End Sub End Class
Last edited by ccman32; 09-12-2017 at 04:12 PM.
donpusher (09-12-2017)
You should have pointer him/her to your source on the simple vb trainer.
"To troll or not to troll that is the question"
nothing wrong with mine
forgot to add the first letter
but its alright too late nothing left to do