Пример #1
0
 public void PokeByte(long address, byte data)
 {
     if (p == null || errCount > maxErrs)
     {
         return;
     }
     try
     {
         ProcessExtensions.WriteVirtualMemory(p, (IntPtr)((long)baseAddr + address), new[] { data });
     }
     catch (Exception e)
     {
         Console.WriteLine($"ProcessInterface PokeByte failed!\n{e.Message}\n{e.StackTrace}");
         errCount++;
     }
 }
Пример #2
0
 public byte[] PeekBytes(long address, int length)
 {
     if (p == null || errCount > maxErrs)
     {
         return(null);
     }
     try
     {
         return(ProcessExtensions.ReadVirtualMemory(p, (IntPtr)((long)baseAddr + address), length));
     }
     catch (Exception e)
     {
         Console.WriteLine($"ProcessInterface PeekBytes failed!\n{e.Message}");
         errCount++;
     }
     return(null);
 }
Пример #3
0
 public byte PeekByte(long address)
 {
     if (p == null || errCount > maxErrs)
     {
         return(0);
     }
     try
     {
         return(ProcessExtensions.ReadVirtualMemory(p, (IntPtr)((long)baseAddr + address), 1)[0]);
     }
     catch (Exception e)
     {
         Console.WriteLine($"ProcessInterface PeekByte failed!\n{e.Message}\n{e.StackTrace}");
         errCount++;
     }
     return(0);
 }
        public bool ResetMemoryProtection()
        {
            var    memoryProtection = mp;
            var    empty            = ProcessExtensions.MemProtection.Memory_Empty;
            IntPtr size             = (IntPtr)Size;

            bool memoryProtectionNotEmpty = memoryProtection != empty;

            ProcessExtensions.MemProtection ThrowOff;

            if (memoryProtectionNotEmpty)
            {
                return(ProcessExtensions.VirtualProtectEx(p, baseAddr, size, mp, out ThrowOff));
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
 public void FlushInstructionCache()
 {
     ProcessExtensions.FlushInstructionCache(p.Handle, baseAddr, (UIntPtr)Size);
 }