コード例 #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);
 }
コード例 #4
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);
 }