Example #1
0
        public static bool Do(Vector start, Vector end)
        {
            if (Address == IntPtr.Zero)
            {
                Alloc();
                if (Address == IntPtr.Zero)
                {
                    return(false);
                }
                int param_startAddr = (int)Address + 80;
                int param_endAddr   = param_startAddr + 12;
                int returnAddr      = param_endAddr + 12;

                ReturnAddress = new IntPtr(returnAddr);

                int param_end_y = param_endAddr + 4;
                int param_end_z = param_endAddr + 8;

                int param_start_y = param_startAddr + 4;
                int param_start_z = param_startAddr + 8;

                Buffer.BlockCopy(BitConverter.GetBytes(param_endAddr), 0, Shellcode, 0xA, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(param_end_y), 0, Shellcode, 0x12, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(param_end_z), 0, Shellcode, 0x1B, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(param_startAddr), 0, Shellcode, 0x28, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(param_start_y), 0, Shellcode, 0x30, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(param_start_z), 0, Shellcode, 0x38, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(Globals._signatures.dw_lineThroughSmoke), 0, Shellcode, 0x40, 4);
                Buffer.BlockCopy(BitConverter.GetBytes(returnAddr), 0, Shellcode, 0x47, 4);
            }

            Buffer.BlockCopy(MemoryAPI.GetStructBytes <struct_Vector>(start.ToStruct()), 0, Shellcode, 0x50, 12);
            Buffer.BlockCopy(MemoryAPI.GetStructBytes <struct_Vector>(end.ToStruct()), 0, Shellcode, 0x5C, 12);

            WinAPI.WriteProcessMemory(Globals._csgo.ProcessHandle, Address, Shellcode, Shellcode.Length, 0);

            IntPtr Thread = WinAPI.CreateRemoteThread(Globals._csgo.ProcessHandle, (IntPtr)null, IntPtr.Zero, Address, (IntPtr)null, 0, (IntPtr)null);

            WinAPI.WaitForSingleObject(Thread, 0xFFFFFFFF);

            WinAPI.CloseHandle(Thread);

            bool returnVal = MemoryAPI.ReadFromProcess <bool>(Globals._csgo.ProcessHandle, ReturnAddress);

            return(returnVal);
        }