Ejemplo n.º 1
0
        public void SetRef <T>(int level, int slot, ref T r)
        {
            var baseAddress = Levels[level].BaseAddress;

            if (baseAddress != IntPtr.Zero)
            {
                var slotAddress = baseAddress;
                if (GetStackDir() > 0)
                {
                    slotAddress -= (slot) * IntPtr.Size;
                }
                else
                {
                    slotAddress += (slot) * IntPtr.Size;
                }
                while (true)
                {
                    RawRef source = new RawRef();
                    source.SetRef(ref r);
                    var sourceAddress = source.Address;

                    RawRef dest = new RawRef();
                    dest.Address = slotAddress;
                    dest.SetValue(sourceAddress);

                    source.SetRef(ref r);
                    if (sourceAddress == source.Address)
                    {
                        return;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static int GetStackDir()
        {
            RawRef r1 = new RawRef();

            r1.SetRef(ref r1);
            RawRef r2 = new RawRef();

            r2.SetRef(ref r2);
            return((int)(((long)r2.Address) - ((long)r1.Address)));
        }