public void OpenProcess() { ProcessMemoryReaderApi.ProcessAccessType access; access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ; // | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE // | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION; m_hProcess = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)m_ReadProcess.Id); }
/// <summary> /// Open process for memory write/read operation. /// </summary> public void OpenProcess() { ProcessMemoryReaderApi.ProcessAccessType access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_QUERY_INFORMATION | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION; handle = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)ReadProcess.Id); }
public void OpenProcess() { // m_hProcess = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 1, (uint)m_ReadProcess.Id); ProcessMemoryReaderApi.ProcessAccessType access; access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_QUERY_INFORMATION; m_hProcess = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)m_ReadProcess); //bool retVal; //IntPtr htok = IntPtr.Zero; //CharacterBuilderLoader.ProcessMemoryReader.ProcessMemoryReaderApi.TOKEN_PRIVILEGES tp; //retVal = ProcessMemoryReaderApi.OpenProcessToken(m_hProcess, // ProcessMemoryReaderApi.TOKEN_ADJUST_PRIVILEGES | ProcessMemoryReaderApi.TOKEN_QUERY, ref htok); //tp.PrivilegeCount = 1; //tp.Luid = 0; //tp.Attributes = ProcessMemoryReaderApi.SE_PRIVILEGE_ENABLED; //retVal = ProcessMemoryReaderApi.LookupPrivilegeValue(null, "SeDebugPrivilege", ref tp.Luid); //retVal = ProcessMemoryReaderApi.AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero); }
public void OpenProcess() { handle = ProcessMemoryReaderApi.OpenProcess((uint)ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ, 0, (uint)ReadProcess.Id); }
public void OpenProcess() { m_hProcess = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 1, (uint)m_ReadProcess.Id); }
private void timer1_Tick(object sender, EventArgs e) { //All of this code is what shows the player's position in the app window. IntPtr processHandle = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 0, (uint)process.Id); IntPtr bytesRead = (IntPtr)0; byte[] buffer = new byte[8]; uint size = (uint)buffer.Length; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, xPosAddr, buffer, (uint)buffer.Length, out bytesRead); xPosLabel.Text = BitConverter.ToSingle(buffer, 0).ToString(); ProcessMemoryReaderApi.ReadProcessMemory(processHandle, yPosAddr, buffer, (uint)buffer.Length, out bytesRead); yPosLabel.Text = BitConverter.ToSingle(buffer, 0).ToString(); ProcessMemoryReaderApi.ReadProcessMemory(processHandle, zPosAddr, buffer, (uint)buffer.Length, out bytesRead); zPosLabel.Text = BitConverter.ToSingle(buffer, 0).ToString(); ProcessMemoryReaderApi.ReadProcessMemory(processHandle, healthAddr, buffer, (uint)buffer.Length, out bytesRead); healthLabel.Text = "2147483647 / 100"; //starting here is aimbot math ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, xPosAddr, buffer, (uint)buffer.Length, out bytesRead); float x1 = BitConverter.ToSingle(buffer, 0); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, enemyXPosAddr, buffer, (uint)buffer.Length, out bytesRead); float x2 = BitConverter.ToSingle(buffer, 0); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, zPosAddr, buffer, (uint)buffer.Length, out bytesRead); float z1 = BitConverter.ToSingle(buffer, 0); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, enemyZPosAddr, buffer, (uint)buffer.Length, out bytesRead); float z2 = BitConverter.ToSingle(buffer, 0); slope = ((z2 - z1) / (x2 - x1)); yawAngle = (float)(Math.Atan2((z2 - z1), (x2 - x1)) * (180 / Math.PI)); slopeLabel.Text = slope.ToString(); angleLabel.Text = yawAngle.ToString(); distance = (float)(Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((z2 - z1), 2))); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, yPosAddr, buffer, (uint)buffer.Length, out bytesRead); playerHeight = BitConverter.ToSingle(buffer, 0); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, enemyYPosAddr, buffer, (uint)buffer.Length, out bytesRead); enemyHeight = BitConverter.ToSingle(buffer, 0); heightDifference = playerHeight - enemyHeight; pitchAngle = (float)((Math.Atan2(heightDifference, distance)) * (180 / Math.PI)); //This code gives the player infinite health byte[] healthValue = BitConverter.GetBytes(2147483647); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, healthAddr, healthValue, 4, out bytesRead); //This code gives the player infinite primary ammo byte[] fourByteBuffer = new byte[4]; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, primaryAmmoAddrPointer, fourByteBuffer, (uint)fourByteBuffer.Length, out bytesRead); primaryAmmoAddr = (IntPtr)(BitConverter.ToInt32(fourByteBuffer, 0) + 0x44C); byte[] ammoValue = BitConverter.GetBytes(2147483647); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, primaryAmmoAddr, ammoValue, 4, out bytesRead); }
protected override void WndProc(ref Message m) { const int WM_HOTKEY = 0x0312; if (m.Msg == WM_HOTKEY) { if (m.WParam == (IntPtr)1) { IntPtr bytesRead; byte[] bufferX = new byte[8]; byte[] bufferY = new byte[8]; byte[] bufferZ = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, xPosAddr, bufferX, (uint)bufferX.Length, out bytesRead); savedXPos1 = bufferX; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, yPosAddr, bufferY, (uint)bufferY.Length, out bytesRead); savedYPos1 = bufferY; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, zPosAddr, bufferZ, (uint)bufferZ.Length, out bytesRead); savedZPos1 = bufferZ; } else if (m.WParam == (IntPtr)2) { IntPtr store; ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, xPosAddr, savedXPos1, 8, out store); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, yPosAddr, savedYPos1, 8, out store); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, zPosAddr, savedZPos1, 8, out store); } else if (m.WParam == (IntPtr)3) { IntPtr bytesRead; IntPtr store; byte[] buffer = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, yPosAddr, buffer, (uint)buffer.Length, out bytesRead); byte[] currentY = buffer; float floatY = BitConverter.ToSingle(currentY, 0); float addedY = floatY + 300; byte[] newY = BitConverter.GetBytes(addedY); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, yPosAddr, newY, 8, out store); byte[] accelerationY = { 0x00000000 }; ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, yVelocityAddr, accelerationY, 4, out store); } else if (m.WParam == (IntPtr)4) { IntPtr store; byte[] accelerationY = { 0x00 }; ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, yVelocityAddr, accelerationY, 4, out store); } else if (m.WParam == (IntPtr)5) { IntPtr processHandle = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 0, (uint)process.Id); IntPtr bytesRead = (IntPtr)0; byte[] bufferX = new byte[8]; byte[] bufferY = new byte[8]; byte[] bufferZ = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, xPosAddr, bufferX, (uint)bufferX.Length, out bytesRead); savedXPos2 = bufferX; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, yPosAddr, bufferY, (uint)bufferY.Length, out bytesRead); savedYPos2 = bufferY; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, zPosAddr, bufferZ, (uint)bufferZ.Length, out bytesRead); savedZPos2 = bufferZ; } else if (m.WParam == (IntPtr)6) { IntPtr store = (IntPtr)0; ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, xPosAddr, savedXPos2, 8, out store); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, yPosAddr, savedYPos2, 8, out store); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, zPosAddr, savedZPos2, 8, out store); } else if (m.WParam == (IntPtr)7) { byte[] buffer = new byte[8]; IntPtr store; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, xMouseAddr, buffer, 8, out store); float direction = BitConverter.ToSingle(buffer, 0); if (direction > -45 && direction < 45) { //xPos will increase IntPtr processHandle = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 0, (uint)process.Id); IntPtr bytesRead = (IntPtr)0; buffer = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, xPosAddr, buffer, (uint)buffer.Length, out bytesRead); float movement = BitConverter.ToSingle(buffer, 0) + 200; byte[] finalMovement = BitConverter.GetBytes(movement); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, xPosAddr, finalMovement, (uint)finalMovement.Length, out bytesRead); } else if (direction < -45 && direction > -135) { //zPos will decrease IntPtr processHandle = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 0, (uint)process.Id); IntPtr bytesRead = (IntPtr)0; buffer = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, zPosAddr, buffer, (uint)buffer.Length, out bytesRead); float movement = BitConverter.ToSingle(buffer, 0) - 200; byte[] finalMovement = BitConverter.GetBytes(movement); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, zPosAddr, finalMovement, (uint)finalMovement.Length, out bytesRead); } else if ((direction < -135 && direction > -179.99999999) || (direction > 135 && direction < 179.99999999)) { //xPos will decrease IntPtr processHandle = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 0, (uint)process.Id); IntPtr bytesRead = (IntPtr)0; buffer = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, xPosAddr, buffer, (uint)buffer.Length, out bytesRead); float movement = BitConverter.ToSingle(buffer, 0) - 200; byte[] finalMovement = BitConverter.GetBytes(movement); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, xPosAddr, finalMovement, (uint)finalMovement.Length, out bytesRead); } else if (direction > 45 && direction < 135) { //zPos will increase IntPtr processHandle = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 0, (uint)process.Id); IntPtr bytesRead = (IntPtr)0; buffer = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(processHandle, zPosAddr, buffer, (uint)buffer.Length, out bytesRead); float movement = BitConverter.ToSingle(buffer, 0) + 200; byte[] finalMovement = BitConverter.GetBytes(movement); ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, zPosAddr, finalMovement, (uint)finalMovement.Length, out bytesRead); } } else if (m.WParam == (IntPtr)8) { if (aimbotIsOn == true) { timer3.Enabled = false; aimbotIsOn = false; } else { timer3.Enabled = true; aimbotIsOn = true; //defining the difference between the readable and writable X address values. IntPtr bytesRead; byte[] buffer = new byte[8]; ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, xMouseAddr, buffer, (uint)buffer.Length, out bytesRead); float readXMouseValue = BitConverter.ToSingle(buffer, 0); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, writableXMouseAddr, buffer, (uint)buffer.Length, out bytesRead); float writeXMouseValue = BitConverter.ToSingle(buffer, 0); readWriteXMouseDiff = readXMouseValue - writeXMouseValue; //defining the difference between the readable and writable Y address value ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, yMouseAddr, buffer, (uint)buffer.Length, out bytesRead); float readYMouseValue = BitConverter.ToSingle(buffer, 0); ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, writableYMouseAddr, buffer, (uint)buffer.Length, out bytesRead); float writeYMouseValue = BitConverter.ToSingle(buffer, 0); readWriteYMouseDiff = readYMouseValue - writeYMouseValue; } } else if (m.WParam == (IntPtr)9) { } } base.WndProc(ref m); }