示例#1
0
        //Write to Address
        public bool Write(UInt64 iMemoryAddress, byte bByteToWrite)
        {
            byte[] bBuffer = { bByteToWrite }; IntPtr ptrBytesWritten;
            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 1, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == 1);
        }
示例#2
0
        public bool Write(UInt64 iMemoryAddress, double iDoubleToWrite)
        {
            byte[] bBuffer = BitConverter.GetBytes(iDoubleToWrite); IntPtr ptrBytesWritten;
            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 8, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == 8);
        }
示例#3
0
        /// <summary>
        /// Write memory at address location.
        /// </summary>
        /// <param name="memoryAddress">Address location</param>
        /// <param name="buffer">Result in a byte buffer</param>
        /// <param name="bytesWritten">Bytes written</param>
        public void WriteMemory(IntPtr memoryAddress, byte[] buffer, out int bytesWritten)
        {
            IntPtr pBytesWritten = IntPtr.Zero;

            ProcessMemoryReaderApi.WriteProcessMemory(handle, memoryAddress, buffer, (uint)buffer.Length, out pBytesWritten);
            bytesWritten = pBytesWritten.ToInt32();
        }
示例#4
0
        public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
        {
            IntPtr ptrBytesWritten;

            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten);

            bytesWritten = ptrBytesWritten.ToInt32();
        }
示例#5
0
        public bool Write(UInt64 iMemoryAddress, byte[] bBytesToWrite)
        {
            IntPtr ptrBytesWritten;

            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBytesToWrite, (uint)bBytesToWrite.Length, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == bBytesToWrite.Length);
        }
示例#6
0
        public bool NOP(UInt64 iMemoryAddress, int iLength)
        {
            byte[] bBuffer = new byte[iLength]; IntPtr ptrBytesWritten;
            for (int i = 0; i < iLength; i++)
            {
                bBuffer[i] = 0x90;
            }

            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)iLength, out ptrBytesWritten);
            return(ptrBytesWritten.ToInt32() == iLength);
        }
示例#7
0
 public static bool Write(long Address, byte[] buffer, int size)
 {
     if (Process.GameRunning)
     {
         return(ProcessMemoryReaderApi.WriteProcessMemory(Voodoo.Process.Handle, (UIntPtr)Address, buffer, (UIntPtr)size, IntPtr.Zero));
     }
     else
     {
         return(false);
     }
 }
        public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
        {
            IntPtr ptrBytesWritten;
            uint   oldProtect;
            bool   res = ProcessMemoryReaderApi.VirtualProtectEx(m_hProcess,
                                                                 MemoryAddress, new UIntPtr((uint)bytesToWrite.Length),
                                                                 0x40, out oldProtect);
            int code;

            code = Marshal.GetLastWin32Error();
            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten);
            code         = Marshal.GetLastWin32Error();
            bytesWritten = ptrBytesWritten.ToInt32();
        }
示例#9
0
        public bool Write(UInt64 iMemoryAddress, string sStringToWrite, int iMode = 0)
        {
            byte[] bBuffer = { 0 }; IntPtr ptrBytesWritten;

            if (iMode == 0)
            {
                bBuffer = CreateAOBText(sStringToWrite);
            }
            else if (iMode == 1)
            {
                bBuffer = ReverseBytes(CreateAOBString(sStringToWrite));
            }

            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)bBuffer.Length, out ptrBytesWritten);

            return(ptrBytesWritten.ToInt32() == bBuffer.Length);
        }
示例#10
0
文件: Form1.cs 项目: RenRyry/FPSHack
        private void timer3_Tick(object sender, EventArgs e)
        {
            IntPtr bytesRead;

            byte[] buffer = new byte[8];

            //actual aimbot code for horizontal plane
            ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, xMouseAddr, buffer, (uint)buffer.Length, out bytesRead);
            playerYaw = BitConverter.ToSingle(buffer, 0);

            directionLabel.Text = playerYaw.ToString();

            byte[] binNewYaw = BitConverter.GetBytes(yawAngle - readWriteXMouseDiff);
            ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, writableXMouseAddr, binNewYaw, (uint)binNewYaw.Length, out bytesRead);

            //aimbot code for vertical plane
            ProcessMemoryReaderApi.ReadProcessMemory(process.Handle, yMouseAddr, buffer, (uint)buffer.Length, out bytesRead);
            playerPitch = BitConverter.ToSingle(buffer, 0);

            byte[] binNewPitch = BitConverter.GetBytes(pitchAngle + 2 - readWriteYMouseDiff);
            ProcessMemoryReaderApi.WriteProcessMemory(process.Handle, writableYMouseAddr, binNewPitch, (uint)binNewPitch.Length, out bytesRead);
        }
示例#11
0
文件: Form1.cs 项目: RenRyry/FPSHack
        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);
        }
示例#12
0
文件: Form1.cs 项目: RenRyry/FPSHack
        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);
        }