コード例 #1
0
        private void RunRawCommand(UInt32 target_address, byte[] code)
        {
            UInt32 stack_le        = Endianess.ToLittleEndian(0x20002000);
            UInt32 code_address_le = Endianess.ToLittleEndian(target_address + 8);
            UInt32 length          = (UInt32)code.Length + 8;

            using (MemoryStream ms = new MemoryStream())
            {
                ms.Write(BitConverter.GetBytes(stack_le), 0, sizeof(UInt32));
                ms.Write(BitConverter.GetBytes(code_address_le), 0, sizeof(UInt32));
                ms.Write(code, 0, code.Length);

                ms.Seek(0, SeekOrigin.Begin);

                WriteStreamToMemory(target_address, ms, null);
            }

            Go(target_address);
        }