Esempio n. 1
0
        public static object IsInstanceOfInterfaceType(int interfaceSlot, object obj)
        {
            if (obj == null)
            {
                return(null);
            }

            var o = Intrinsic.GetObjectAddress(obj);
            var objTypeDefinition = new TypeDefinition(Intrinsic.LoadPointer(o));

            var bitmap = objTypeDefinition.Bitmap;

            if (bitmap == IntPtr.Zero)
            {
                return(null);
            }

            int index = interfaceSlot / 32;
            int bit   = interfaceSlot % 32;

            uint value  = Intrinsic.Load32(bitmap, index * 4);
            uint result = value & (uint)(1 << bit);

            if (result == 0)
            {
                return(null);
            }

            return(obj);
        }
Esempio n. 2
0
        public static void Setup()
        {
            Assemblies = new LinkedList <RuntimeAssembly>();

            // Get AssemblyListTable and Assembly count
            var  assemblyListTable = Intrinsic.GetAssemblyListTable();
            uint assemblyCount     = Intrinsic.Load32(assemblyListTable);

            // Loop through and populate the array
            for (int i = 0; i < assemblyCount; i++)
            {
                // Get the pointer to the Assembly Metadata
                var ptr = Intrinsic.LoadPointer(assemblyListTable, IntPtr.Size + (IntPtr.Size * i));

                Assemblies.AddLast(new RuntimeAssembly(ptr));
            }
        }
Esempio n. 3
0
 public uint Load32(int offset)
 {
     return(Intrinsic.Load32(this, offset));
 }
Esempio n. 4
0
 public uint Load32()
 {
     return(Intrinsic.Load32(this));
 }
Esempio n. 5
0
 public static int GetLength(IntPtr array, int dimension)
 {
     return((int)Intrinsic.Load32(array, IntPtr.Size * 2));
 }