Results 1 to 5 of 5
  1. #1
    pyton789's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    793
    Reputation
    38
    Thanks
    2,610
    My Mood
    Sneaky

    ReadProcessMemory Win 7

    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

  2. #2
    Cryptonic's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    United Provinces of Canada
    Posts
    1,313
    Reputation
    44
    Thanks
    190
    My Mood
    Bored
    Well.. I don't know much in this category, but all I can say is, this code here - 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 - probably doesn't work with win7. Just like how the SendKeys don't work properly unless you have the right declaring code for win7.

  3. #3
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Make sure you're compiling as x86, not AnyCPU, otherwise the debugging functions may run into issues. Also, try to avoid using PROCESS_ALL_ACCESS (&H1F0FFF) when calling OpenProcess. &H43A should work for most read/write/query/execute operations.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  4. The Following User Says Thank You to Jason For This Useful Post:

    Hassan (06-26-2012)

  5. #4
    Pingo's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    687
    Reputation
    24
    Thanks
    865
    My Mood
    Blah
    Not sure if you noticed this in your code but
    Dim BlackOpsLookUp As Process() = Process.GetProcessesByName("notepad")
    You did change this right?

  6. #5
    pyton789's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    793
    Reputation
    38
    Thanks
    2,610
    My Mood
    Sneaky
    Quote Originally Posted by Jason View Post
    Make sure you're compiling as x86, not AnyCPU, otherwise the debugging functions may run into issues. Also, try to avoid using PROCESS_ALL_ACCESS (&H1F0FFF) when calling OpenProcess. &H43A should work for most read/write/query/execute operations.
    Changing the target platform to x86 made it work
    Solved

    M-efti's Unlocker for alterIWnet . . . . . . . . . . . . . . . . . . . . . . . . . . . .M-efti's MW2 SP Trainer 1.2
    M-efti's Superior alterIWnet Hack . . . . . . . . . . .. . . . . . . . . . . . . . . ..M-efti's MW2 SP Trainer 1.7
    M-efti's BO SP Trainer 4.12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..M-efti's Dead Pixels Trainer

Similar Threads

  1. Why the PS3 will win?
    By arunforce in forum Debate Fort
    Replies: 32
    Last Post: 09-23-2007, 05:39 PM
  2. I Win
    By SATANICAT in forum Spammers Corner
    Replies: 2
    Last Post: 12-13-2006, 06:41 PM
  3. Mark Bunker wins an EMMY!
    By Dave84311 in forum General
    Replies: 0
    Last Post: 07-15-2006, 10:43 PM
  4. Who Will Win today?
    By gunot in forum General
    Replies: 13
    Last Post: 02-21-2006, 01:17 PM