C # simple game Modifier

Source: Internet
Author: User

Even if you are not playing games at ordinary times, it is also a good thing to adjust the game when you are busy at work. Like RPG games, it is usually used to play the plot. However, many times when a BOSS cannot be played, the game is stuck there, affecting the mood of the story. At this time, everyone will think of a modifier to maintain their blood volume, and it will be invincible. I searched the internet and found a Quick Memory Editor, shared software, with a limit on the number of times of use. I tried it and figured out the principle. Then I implemented a simple version and shared it with me. There is no input validation in the program, and it has not been specially designed. It is just written as needed. As to why C # is used for implementation, the main function is to conveniently call APIs and BitConverter classes, which can easily convert specific values into byte representations in the memory, there is also a lack of familiarity with the C/C ++ writing interface. With the BitConverter class, you don't have to consider the representation of the specific type in the memory. Everything has been encapsulated for you, which is very convenient. Click here to download

The modifier principle is very simple: Write the expected value into a certain segment of memory of the game process (use the WriteProcessMemory function of kernel32.dll, see the code in the package ). What should I do to find the memory address of the value to be modified? Here is a tip.

1. Find the expected address in the memory, and a group of addresses will be obtained. The required addresses will be hidden ..

Here, I found that the role's blood volume is 522. I searched for a 522 value in the memory of the game process and found a large part.

2. After some fight, the blood volume is reduced to 501. Search for the result,

Haha, I only looked for it once, and there was only one left. Good luck.

Generally, the attributes of some characters are basically some global variables, and the address will not change after the process starts. Some games or even the address is determined during compilation, as long as you remember the address, it can be modified without searching. After the first search, the target address will be included in this list. The second time, because the volume of blood changes during the search, the value of the target address is expected, but the value of the non-target address may be equal to the volume of blood, or may be changed to another value, or will not change, in the second query, a large number of results are filtered out. If the target address is not found, kill it for a while, and then find the target address from the result. When the number in the list does not change at the end of the search, the target address is found. Some games have more than one target address. In this case, you can modify these addresses together. Based on this premise, this method is not suitable for every game, especially for online games. It basically does not work. If it is applicable, you still need to try it.

3. Make a scheduled task and change the target address to the desired value (that is, modify the target address once every certain time, and set the interval to MS in my program)

The LockedValue of is the value to be modified.
 

The following describes how the specific code is implemented.

First, you need to use the api function ReadProcessMemory (in kernel32.dll) to find the data in the memory of the game process)

1 [DllImport( "kernel32.dll" , SetLastError = true )] 2 public static extern bool ReadProcessMemory( 3    IntPtr hProcess, 4    IntPtr lpBaseAddress, 5    [Out] byte [] lpBuffer, 6    int size, 7    out int lpNumberOfBytesRead 8   );

Each time you read 4 kb of memory from the game process (4 kb on one page), search for the value from the 4 kb, and write down the matched memory address. The following is the Click Event of the Search button to process the entire game Process Memory search process.

01 /// <summary> 02 /// Find the button-clicking event 03 /// </summary> 04 private void btnSearch_Click( object sender, EventArgs e) 05 { 06      List<Result> resultList = new List<Result>(); 07<

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.