Пример #1
0
        public byte[] ReadProcessMemory(IntPtr MemoryAddress, uint bytesToRead, out int bytesRead)
        {
            uint old;

            ProcessMemoryReaderApi.VirtualProtectEx(m_hProcess, MemoryAddress, bytesToRead, (uint)ProcessMemoryReaderApi.MemoryProtection.PAGE_READWRITE, out old);

            byte[] buffer = new byte[bytesToRead];

            IntPtr ptrBytesRead;

            ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead);

            bytesRead = ptrBytesRead.ToInt32();

            return(buffer);
        }