示例#1
0
    // Token: 0x06000021 RID: 33 RVA: 0x00002A08 File Offset: 0x00000C08
    public bool WriteByteArray(IntPtr pOffset, byte[] pBytes)
    {
        if (this.processHandle == IntPtr.Zero)
        {
            this.CheckProcess();
        }
        bool result;

        try
        {
            uint flNewProtect;
            VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)((ulong)((long)pBytes.Length)), 4U, out flNewProtect);
            bool flag = VAMemory.WriteProcessMemory(this.processHandle, pOffset, pBytes, (uint)pBytes.Length, 0U);
            VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)((ulong)((long)pBytes.Length)), flNewProtect, out flNewProtect);
            result = flag;
        }
        catch (Exception ex)
        {
            if (VAMemory.debugMode)
            {
                Console.WriteLine("Error: WriteByteArray" + ex.ToString());
            }
            result = false;
        }
        return(result);
    }
示例#2
0
 // Token: 0x0600000D RID: 13 RVA: 0x00002144 File Offset: 0x00000344
 public byte[] ReadByteArray(IntPtr pOffset, uint pSize)
 {
     if (this.processHandle == IntPtr.Zero)
     {
         this.CheckProcess();
     }
     byte[] result;
     try
     {
         uint flNewProtect;
         VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)pSize, 4U, out flNewProtect);
         byte[] array = new byte[pSize];
         VAMemory.ReadProcessMemory(this.processHandle, pOffset, array, pSize, 0U);
         VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)pSize, flNewProtect, out flNewProtect);
         result = array;
     }
     catch (Exception ex)
     {
         if (VAMemory.debugMode)
         {
             Console.WriteLine("Error: ReadByteArray" + ex.ToString());
         }
         result = new byte[1];
     }
     return(result);
 }
示例#3
0
 public byte[] ReadByteArray(IntPtr pOffset, uint pSize)
 {
     if (this.processHandle == IntPtr.Zero)
     {
         this.CheckProcess();
     }
     try
     {
         uint lpflOldProtect;
         VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)pSize, 4U, out lpflOldProtect);
         byte[] lpBuffer = new byte[pSize];
         VAMemory.ReadProcessMemory(this.processHandle, pOffset, lpBuffer, pSize, 0U);
         VAMemory.VirtualProtectEx(this.processHandle, pOffset, (UIntPtr)pSize, lpflOldProtect, out lpflOldProtect);
         return(lpBuffer);
     }
     catch (Exception ex)
     {
         if (VAMemory.debugMode)
         {
             Console.WriteLine("Error: ReadByteArray" + ex.ToString());
         }
         return(new byte[1]);
     }
 }