Skip to content

Instantly share code, notes, and snippets.

Created March 23, 2012 12:42
Show Gist options
  • Select an option

  • Save anonymous/2170352 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/2170352 to your computer and use it in GitHub Desktop.
private void button_go_Click(object sender, EventArgs e)
{
IntPtr PinballHandle;
IntPtr PinballScoreAddressPointer = (IntPtr)0x0162286C; //修改內存 0x0162286C ->PinballScoreAddress
uint[] PinballScoreAddress = new uint[1]; //遊戲數據地址
uint[] PinballScoreWrite = new uint[] { 0xF423F }; //將數據改為:999999
uint[] PinballScoreRead = new uint[1]; //存放當前數據
System.Diagnostics.Process[] PinballProcessID
= System.Diagnostics.Process.GetProcessesByName("Text123"); //獲取當前進程
if (PinballProcessID.Length != 0)
{
PinballHandle = ProcessMemoryWorkApi.OpenProcess(0x1F0FFF, 0, (UInt32)PinballProcessID[0].Id); //PROCESS_ALL_ACCESS=0x1F0FFF
ProcessMemoryWorkApi.ReadProcessMemory(PinballHandle, PinballScoreAddressPointer, PinballScoreAddress, 4, (IntPtr)0);//通過指針得到PinballScoreAddress
PinballScoreAddress[0] = PinballScoreAddress[0] + 0x0 ; //PinballScoreAddress 遊戲內存地址
ProcessMemoryWorkApi.ReadProcessMemory(PinballHandle, (IntPtr)PinballScoreAddress[0], PinballScoreRead, 4, (IntPtr)0); //當前遊戲數據
MessageBox.Show("當前數據為: " + PinballScoreRead[0].ToString() + "\n" + "數據修改為: 999999", "Text_edit");
ProcessMemoryWorkApi.WriteProcessMemory(PinballHandle, (IntPtr)PinballScoreAddress[0], PinballScoreWrite, 4, (IntPtr)0); //修改遊戲數據
ProcessMemoryWorkApi.CloseHandle(PinballHandle);
}
else
MessageBox.Show("\"Text123\" 沒有運行", "Text123");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment