devxlogo

find and replace values loaded in memory

find and replace values loaded in memory

Question:
I am trying to write a program that will search memory for a hexadecimal string and replace it with the values hardcoded in my program. It’s a game cheat program that is executed after the game is started. I assume this will work similarly to a virus scanning program that scans memory for a character string. I’m somewhat new to C++, but have programmed in Assembly and Pascal. Your help would be greatly appreciated.Thanks,Phillip D. Howardps.I have searched your Q&A files and found nothing related.

Answer:
You didn’t indicate which platform you are working on. In 32-bit Windows, other programs are protected from such behavior, and you generally cannot directly access memory owned by another process.

While this might be possible in DOS, it is generally considered bad form to read and write memory that your program does not own. If you want to go ahead with this technique, you will need to find some unique sequence of bytes specific to the program you want to modify and then search for that sequence in memory. There is no reliable method I can give you without studying the program myself. But, in general, it is very difficult to perform such tasks in a reliable manner.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist