Exemplo n.º 1
0
        static void write(Memory mem, IntPtr addr, IConvertible val)
        {
            var size       = val.GetType() == typeof(string) ? ((string)val).Length : val.MemSize();
            var protection = mem.RemoveProtection(addr, size);

            mem.Write(addr, (string)val);
            mem.AddProtection(addr, size, protection);
        }
Exemplo n.º 2
0
        static T read <T>(Memory mem, IntPtr addr) where T : IConvertible
        {
            var size       = typeof(T) == typeof(string) ? 309 : typeof(T).MemSize();
            var protection = mem.RemoveProtection(addr, size);
            var ret        = mem.Read <T>(addr);

            mem.AddProtection(addr, size, protection);
            return(ret);
        }