This problem comes from the water "Huaquan robot", for the purpose of this article interested friends please roughly read the thread, in the post I used this method to write scissors fifth, the record is good, of course, the method of cheating.
Scissors fifth train of thought is every time out fist, try to let the other party to win, and then according to an address section to scan the memory of each other won the number of the save address, find the game results when the memory data to get rid of. This is similar to the previous use of a stand-alone game fpe, such as the modification tool. Of course, if the other party deliberately fouls, not a game to win, you can not find his address, so that the normal way to obtain victory.
After simplifying the scissors fifth core code, the main three API functions
Openprocess,readprocessmemory,writeprocessmemory
The code is roughly as follows:
Using System;
Using System.Collections.Generic;
Using System.Text;
Using System.Runtime.InteropServices;
Namespace ConsoleApplication4
... {
Open unsafe code switch: item-Right-properties-build-Allow unsafe code
Class Program
... {
[DllImport ("kernel32.dll")]
public static extern
IntPtr openprocess (UInt32 dwdesiredaccess, Int32 binherithandle, UInt32 dwprocessid);
[DllImport ("kernel32.dll")]
public static extern
Int32 writeprocessmemory (IntPtr hprocess, IntPtr lpbaseaddress, uint[] lpbuffer, UInt32 nsize, INTPTR Lpnumberofbyteswritten);
[DllImport ("kernel32.dll")]
public static extern
Int32 readprocessmemory (IntPtr hprocess, IntPtr lpbaseaddress, uint[] lpbuffer, UInt32 nsize, IntPtr-Lpnumberofbytesread );
static IntPtr paddress = (IntPtr) 0x12bdad8;
Static uint[] Read = new Uint[1];
Static uint[] Write = new uint[] ... {0x64};
static private int mm = 999;
static void Main (string[] args)
... {
Unsafe ... {fixed (int* i = &mm) ... {paddress = (IntPtr) i;} }
IntPtr h = openprocess (0x1f0fff, 0, (UInt32) System.Diagnostics.Process.GetCurrentProcess (). ID);
ReadProcessMemory (H, Paddress, Read, 4, (INTPTR) 0);//Get Memory data
Console.WriteLine (read[0]);//Output 999
WriteProcessMemory (H, Paddress, Write, 4, (INTPTR) 0);//Modify memory data
Console.WriteLine (mm);//Output 100
Console.read ();
}
}
}