Inserting Pointers into Visual Basic 2010

Posts 1–7 of 7 · Page 1 of 1
Inserting Pointers into Visual Basic 2010
hi guys

I have looked around and couldn't find anything on this so i wanted to ask how would i insert the address of a pointer - "server.dll"+0072C39C offset hex 30 into visual basic oh and the address aswell. like this is what i tried to do but no luck :P

Code:
        If CheckBox1.CheckState = CheckState.Checked Then
            Call writealong("Left 4 Dead 2", "server.dll+72C410",1901c410, 1)
        End If
[highlight=vb.net]Private Function GetModuleAddress(ByVal processName As String, ByVal moduleName As String) As IntPtr
If Process.GetProcessesByName(processName).Length > 0 Then
For Each m As ProcessModule In Process.GetProcessesByName(processName)(0).Modules
If m.ModuleName = moduleName Then Return m.BaseAddress
Next
End If
Return IntPtr.Zero
End Function[/highlight]

Usage:
[highlight=vb.net]Dim processName As String = "Left 4 Dead 2"
WriteALong(processName, GetModuleAddress(processName, "server.dll").ToInt32 + &H72C410, someValue)[/highlight]
Thank you for this, I have my code like this now.

Code:
        If CheckBox1.CheckState = CheckState.Checked Then
            Call writealong(processName, GetModuleAddress(processName, "server.dll").ToInt32 + &H72C410, 30) <-- am i right that the hex offset goes here?
        End If
I am still unable to get my hack working outside CE anymore tips that could help me get it working? i only need the value of my address to go to 1 to work and 0 for off

Have tried this also and entering the address of the hack but still no luck
Code:
If CheckBox1.CheckState = CheckState.Checked Then
            Call writealong(processName, GetModuleAddress(processName, "server.dll").ToInt32 + &H72C410, 30)
            Call writealong("Left 4 Dead 2", &H72C410, 1)
        End If
        If CheckBox1.CheckState = CheckState.Unchecked Then
            Call writealong(processName, GetModuleAddress(processName, "server.dll").ToInt32 + &H72C410, 30)
            Call writealong("Left 4 Dead 2", &H72C410, 0)
        End If
What do you mean by hex offset? Where did 30 come from? And no, 30 does not go there.
I am basically trying to get the same function from CE into vb because i really don't like CE as it says all my trainers have Trojans or something else and i don't like its interface and yes i know you can change it but its just annoying as hell, btw this screenshot is where i got the hex offset from i jsut want my vb trainer to update the address each time the game starts.



Also just a quick question how can i make my label green when the left 4 dead 2 is running and red when its not this is what i tried, i would also use this on my other trainers that already work.

Code:
    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
        If "Left 4 Dead 2" Is Open Then <---- everything is ok apart from proccess open i know this is wrong but cannot figure out what goes there to make it this color when the game is running
            Label1.ForeColor = Color.Lime
        End If
        If "Left 4 Dead 2" Is notopen Then
            Label1.ForeColor = Color.Red
        End If
    End Sub
http://www.mpgh.net/forum/27-coders-...-v1-0-net.html

Download that, follow the instructions for referencing it and importing the namespaces as well as setting your project to x86, then:

[highlight=vb.net]
Private Function WriteAtOffset(Of E)(ByVal procName As String, ByVal moduleName As String, ByVal address As Integer, ByVal offset As Integer, ByVal value As E) As Boolean
Dim success As Boolean = False
Dim procList As Process() = Process.GetProcessesByName(procName.Replace(".exe" , ""))
If (procList.Length > 0) Then
Using myHack As New QuickHack(procList(0).Id)
Dim serverModule As IEnumerable(Of DllImports.PROCESS_MODULE) = myHack.getProcModules().Where(Function(m As DllImports.PROCESS_MODULE) m.Name = moduleName)
If (serverModule.Count() = 1) Then
Dim modInfo As Integer = serverModule.First().ModuleInfo.lpBaseOfDll
myHack.writeMemory(Of E)(address + offset + modInfo, value)
success = True
End If
End Using
End If
Return success
End Function
[/highlight]

Then to use it in the way you want:

[highlight=vb.net]
Dim resultOn As Boolean = WriteAtOffset(Of Long)("left4dead2", "server.dll", &H72C410, &H30, 1) 'write 1
Dim resultOff As Boolean = WriteAtOffset(Of Long)("left4dead2", "server.dll", &H72C410, &H30, 2) 'write 0
If resultOn AndAlso resultOff Then
MessageBox.Show("Successfully turned it on and off")
End If
[/highlight]


OH WAIT, didn't realize that the address is a pointer, 2 seconds

EDIT: Now the function has pointer friendly support:
[highlight=vb.net]
Private Function WriteAtOffset(Of E)(ByVal procName As String, ByVal moduleName As String, ByVal address As Integer, ByVal offset As Integer, ByVal value As E, ByVal isPointer As Integer) As Boolean
Dim success As Boolean = False
Dim procList As Process() = Process.GetProcessesByName(procName.Replace(".exe" , ""))
If (procList.Length > 0) Then
Using myHack As New QuickHack(procList(0).Id)
Dim serverModule As IEnumerable(Of DllImports.PROCESS_MODULE) = myHack.getProcModules().Where(Function(m As DllImports.PROCESS_MODULE) m.Name = moduleName)
If (serverModule.Count() = 1) Then
Dim modInfo As Integer = serverModule.First().ModuleInfo.lpBaseOfDll
Dim location As Integer = address + offset + modInfo
If isPointer Then location = myHack.readMemory(Of IntPtr)(location).ToInt32()
myHack.writeMemory(Of E)(location, value)
success = True
End If
End Using
End If
Return success
End Function
[/highlight]

And now the call will look like this:
[highlight=vb.net]
Dim resultOn As Boolean = WriteAtOffset(Of Long)("left4dead2", "server.dll", &H72C410, &H30, 1, True) 'write 1
Dim resultOff As Boolean = WriteAtOffset(Of Long)("left4dead2", "server.dll", &H72C410, &H30, 0, True) 'write 0
If resultOn AndAlso resultOff Then
MessageBox.Show("Successfully turned it on and off")
End If
[/highlight]
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?