Hey I am making a teleporter for Terraria and I have all what I need in Cheat Engine, but I ran into a problem when I started coding the actual program.
I copied the code I needed from an old trainer I made on Win XP.
The code works fine on XP, but not on 7, and after a lot of thinking and looking I've found out that its because ReadProcessMemory doesn't work on 7.
I know the code works, because I read an address from notepad on xp to be sure.
Does anyone know why it doesn't work on Win 7?
Code:
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Function ReadLong(ByVal Address As Integer, ByVal Bytes As Integer)
Dim BlackOpsLookUp As Process() = Process.GetProcessesByName("notepad")
If BlackOpsLookUp.Length = 0 Then
MsgBox("Terraria was not found", MsgBoxStyle.Information, "M-efti's Trainer - Error")
Return Nothing
Exit Function
End If
Dim processHandle As IntPtr = KGCDGTJAWN(&H1F0FFF, 0, BlackOpsLookUp(0).Id)
ReadProcessMemory(processHandle, Address, GWXUSXTOUE, Bytes, Nothing)
Return GWXUSXTOUE
EFJKPZAUQL(processHandle)
End Function
I initially got the function from PheNix's Undetected Module Maker, but I made some changes to it a long time ago, and thats probably why there is a problem.
I have another piece of code with the exact same problem:
Code:
Private Declare Function ReadProcessMemory Lib "KERNEL32" (ByVal Handle As Int32, ByVal address As Int32, ByRef Value As Int32, Optional ByVal Size As Int32 = 4, Optional ByVal lpNumberOfBytesWritten As Int64 = 0) As Long
Public Function ReadByte(ByVal address As Int32) As Integer
Dim value As Integer
ReadProcessMemory(pHandle, address, value, 1, 0)
Return value
End Function