Example #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);
    }