Ejemplo n.º 1
0
        public static byte[] ReadMemory(int address, long bytesToRead)
        {
            Process process   = Process.GetProcessesByName("rocketleague")[0];
            IntPtr  hProcess1 = MemoryEdits.OpenProcess(16, false, process.Id);

            byte[] numArray      = new byte[bytesToRead];
            int    hProcess2     = (int)hProcess1;
            int    lpBaseAddress = address;

            byte[] lpBuffer = numArray;
            int    length   = lpBuffer.Length;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            int lpNumberOfBytesRead = 0;

            MemoryEdits.ReadProcessMemory(hProcess2, address, lpBuffer, length, ref lpNumberOfBytesRead);
            MemoryEdits.CloseHandle(hProcess1);

            //var remainingBytes = bytesToRead - lpNumberOfBytesRead;
            //if (remainingBytes > 0)
            //{
            //  numArray Array  ReadMemory(lpNumberOfBytesRead, remainingBytes);
            //}

            return(lpBuffer);
        }
Ejemplo n.º 2
0
        public static byte[] ReadMemory(IntPtr processHandle, int address, long bytesToRead)
        {
            byte[] numArray      = new byte[bytesToRead];
            int    hProcess2     = (int)processHandle;
            int    lpBaseAddress = address;

            byte[] lpBuffer = numArray;
            int    length   = lpBuffer.Length;

            int lpNumberOfBytesRead = 0;

            MemoryEdits.ReadProcessMemory(hProcess2, address, lpBuffer, length, ref lpNumberOfBytesRead);

            return(lpBuffer);
        }
Ejemplo n.º 3
0
        //public static IntPtr allocMemory()
        //{
        //    IntPtr hProcess = MemoryEdits.OpenProcess(2035711, false, MemoryEdits.process.Id);
        //    UIntPtr num1 = new UIntPtr(1024U);
        //    IntPtr lpAddress = new IntPtr(0);
        //    IntPtr num2 = (IntPtr)num1;
        //    int num3 = 4096;
        //    int num4 = 64;
        //    return MemoryEdits.VirtualAllocEx(hProcess, lpAddress, (UIntPtr)num2, (AllocationType)num3, (MemoryProtection)num4);
        //}

        //public static void writeMem(int address, byte[] buffer)
        //{
        //    IntPtr hProcess1 = MemoryEdits.OpenProcess(2035711, false, MemoryEdits.process.Id);
        //    int num = 0;
        //    int hProcess2 = (int)hProcess1;
        //    int lpBaseAddress = address;
        //    byte[] lpBuffer = buffer;
        //    int Length = lpBuffer.Length;
        //    // ISSUE: explicit reference operation
        //    // ISSUE: variable of a reference type
        //    int&lpNumberOfBytesWritten = @num;
        //    MemoryEdits.WriteProcessMemory(hProcess2, lpBaseAddress, lpBuffer, Length, lpNumberOfBytesWritten);
        //    MemoryEdits.CloseHandle(hProcess1);
        //}

        public static byte[] OffsetReadMem(int address, int bytesToRead)
        {
            Process process   = Process.GetProcessesByName("rocketleague")[0];
            IntPtr  hProcess1 = MemoryEdits.OpenProcess(16, false, process.Id);

            byte[] numArray      = new byte[bytesToRead];
            int    hProcess2     = (int)hProcess1;
            int    lpBaseAddress = address;

            byte[] lpBuffer = numArray;
            int    length   = lpBuffer.Length;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            int lpNumberOfBytesRead = 0;

            MemoryEdits.ReadProcessMemory(hProcess2, (int)process.MainModule.BaseAddress + lpBaseAddress, lpBuffer, length, ref lpNumberOfBytesRead);
            MemoryEdits.CloseHandle(hProcess1);
            return(numArray);
        }