private static void disableGravity() { if (gravBool) { playerDMA = GetDMA(); ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int writtenBytes; byte[] gravBuffer = { 0xD9, 0x5E, 0x48, 0x83 }; // write back proper instructions byte[] jumpBuffer = { 0x0f, 0x13, 0x46, 0x48 }; // Jump power instructions pReader.WriteProcessMemory((IntPtr)((int)gravDMA), gravBuffer, out writtenBytes); pReader.WriteProcessMemory((IntPtr)((int)jumpDMA), jumpBuffer, out writtenBytes); pReader.CloseHandle(); } else { playerDMA = GetDMA(); ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int writtenBytes; byte[] gravBuffer = { 0x90, 0x90, 0x90, 0x83 }; // nop = 0x90 byte[] jumpBuffer = { 0x90, 0x90, 0x90, 0x90 }; byte[] fallBuffer = new byte[4]; fallBuffer = BitConverter.GetBytes(0); //Set to 0 for true zero grav. pReader.WriteProcessMemory((IntPtr)((int)gravDMA), gravBuffer, out writtenBytes); pReader.WriteProcessMemory((IntPtr)((int)jumpDMA), jumpBuffer, out writtenBytes); pReader.WriteProcessMemory((IntPtr)((int)playerDMA + noGravOffset), fallBuffer, out writtenBytes); pReader.CloseHandle(); } gravBool = !gravBool; }
private static void setRunSpeed(float runSpeed) { playerDMA = GetDMA(); ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int writtenBytes; byte[] buffer = BitConverter.GetBytes(runSpeed); pReader.WriteProcessMemory((IntPtr)((int)playerDMA + runspeedOffset), buffer, out writtenBytes); pReader.CloseHandle(); }
private static void setZAxis(float zAxisDiff) { ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int writtenBytes, readBytes; byte[] axisBuffer = pReader.ReadProcessMemory((IntPtr)((int)playerDMA + zAxisOffset), 4, out readBytes); float zAxis = BitConverter.ToSingle(axisBuffer, 0); byte[] buffer = BitConverter.GetBytes(zAxis + zAxisDiff); pReader.WriteProcessMemory((IntPtr)((int)playerDMA + zAxisOffset), buffer, out writtenBytes); pReader.CloseHandle(); }
private static float getRunspeed() { playerDMA = GetDMA(); ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int readBytes; byte[] buffer; buffer = pReader.ReadProcessMemory((IntPtr)((int)playerDMA + runspeedOffset), 4, out readBytes); pReader.CloseHandle(); return(BitConverter.ToSingle(buffer, 0)); }
private static ProcessMemoryReaderLib.ProcessMemoryReader GetAoCProcess() { ProcessMemoryReaderLib.ProcessMemoryReader procReader = new ProcessMemoryReaderLib.ProcessMemoryReader(); System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcessesByName("ageofconan"); // take first instance of AoC we find if (myProcesses.Length == 0) { MessageBox.Show("Age of Conan not found"); } procReader.ReadProcess = myProcesses[0]; return(procReader); }
private static void noFallToggle(bool isChecked) { ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int writtenBytes; byte[] buffer = new byte[4]; if (isChecked) { buffer = BitConverter.GetBytes(0); } else { buffer = BitConverter.GetBytes(1); } pReader.WriteProcessMemory((IntPtr)((int)playerDMA + noFallOffset), buffer, out writtenBytes); pReader.CloseHandle(); }
private static IntPtr GetDMA() { ProcessMemoryReaderLib.ProcessMemoryReader pReader = GetAoCProcess(); pReader.OpenProcess(); int readBytes; byte[] buffer; // Get the memory location pointed to by the static address buffer = pReader.ReadProcessMemory(StaticAddress, 4, out readBytes); IntPtr DMAAddress = (IntPtr)( buffer[0] + 256 * buffer[1] + 256 * 256 * buffer[2] + 256 * 256 * 256 * buffer[3]); pReader.CloseHandle(); return(DMAAddress); }
private static ProcessMemoryReaderLib.ProcessMemoryReader GetAoCProcess() { ProcessMemoryReaderLib.ProcessMemoryReader procReader = new ProcessMemoryReaderLib.ProcessMemoryReader(); System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcessesByName("ageofconan"); // take first instance of AoC we find if (myProcesses.Length == 0) { MessageBox.Show("Age of Conan not found"); } procReader.ReadProcess = myProcesses[0]; return (procReader); }
private void btnRead_Click(object sender, System.EventArgs e) { int iWidthAddress; int iHeightAddress; int iMinesAddress; int iCellBaseAddress; // check if version is win2k or winXP if (Environment.OSVersion.Version.Major == 5) { if (Environment.OSVersion.Version.Minor == 0) // win2K { // Thanks goes to Ryan Schreiber for discovering these addresses. iWidthAddress = 0x10056f8; iHeightAddress = 0x1005a68; iMinesAddress = 0x1005a6c; iCellBaseAddress = 0x1005700; } else // winXP { iWidthAddress = 0x1005334; iHeightAddress = 0x1005338; iMinesAddress = 0x1005330; iCellBaseAddress = 0x1005340; } } else { MessageBox.Show("Sorry, only winXP and win2K are supported!"); return; } System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); ProcessMemoryReaderLib.ProcessMemoryReader pReader = new ProcessMemoryReaderLib.ProcessMemoryReader(); System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcessesByName("winmine"); // take first instance of minesweeper you find if (myProcesses.Length == 0) { MessageBox.Show("No MineSweeper process found!"); return; } pReader.ReadProcess = myProcesses[0]; // open process in read memory mode pReader.OpenProcess(); int bytesReaded; int iWidth, iHeight, iMines; int iIsMine; int iCellAddress; byte[] memory; memory = pReader.ReadProcessMemory((IntPtr)iWidthAddress, 1, out bytesReaded); iWidth = memory[0]; txtWidth.Text = iWidth.ToString(); memory = pReader.ReadProcessMemory((IntPtr)iHeightAddress, 1, out bytesReaded); iHeight = memory[0]; txtHeight.Text = iHeight.ToString(); memory = pReader.ReadProcessMemory((IntPtr)iMinesAddress, 1, out bytesReaded); iMines = memory[0]; txtMines.Text = iMines.ToString(); this.Controls.Clear(); this.Controls.AddRange(MainControls); ButtonArray = new System.Windows.Forms.Button[iWidth, iHeight]; int x, y; for (y = 0; y < iHeight; y++) { for (x = 0; x < iWidth; x++) { ButtonArray[x, y] = new System.Windows.Forms.Button(); ButtonArray[x, y].Location = new System.Drawing.Point(20 + x * 16, 70 + y * 16); ButtonArray[x, y].Name = ""; ButtonArray[x, y].Size = new System.Drawing.Size(16, 16); iCellAddress = (iCellBaseAddress) + (32 * (y + 1)) + (x + 1); memory = pReader.ReadProcessMemory((IntPtr)iCellAddress, 1, out bytesReaded); iIsMine = memory[0]; if (iIsMine == 0x8f) { ButtonArray[x, y].Image = ((System.Drawing.Bitmap)(resources.GetObject("button1.Image"))); } this.Controls.Add(ButtonArray[x, y]); } } // close process handle pReader.CloseHandle(); }