public static object IsInstanceOfInterfaceType(int interfaceSlot, object obj) { if (obj == null) { return(null); } var o = Intrinsic.GetObjectAddress(obj); var objTypeDefinition = new TypeDefinition(o.LoadPointer()); var bitmap = objTypeDefinition.Bitmap; if (bitmap.IsNull) { return(null); } int index = interfaceSlot / 32; int bit = interfaceSlot % 32; uint value = bitmap.Load32(index * 4); uint result = value & (uint)(1 << bit); if (result == 0) { return(null); } return(obj); }
public static Pointer IsInstanceOfType(RuntimeTypeHandle handle, object obj) { if (obj == null) { return(Pointer.Zero); } var o = Intrinsic.GetObjectAddress(obj); var objTypeDefinition = new TypeDefinition(o.LoadPointer()); var typeDefinition = new TypeDefinition(new Pointer(handle.Value)); if (IsTypeInInheritanceChain(typeDefinition, objTypeDefinition)) { return(o); } return(Pointer.Zero); }
private static RuntimeTypeHandle GetTypeHandle(object obj) { var o = Intrinsic.GetObjectAddress(obj); return(new RuntimeTypeHandle(Intrinsic.LoadPointer(o))); }
public static Pointer GetObjectHashValue(object obj) { var address = Intrinsic.GetObjectAddress(obj); return(address - Pointer.Size - 4 - 4); }
public static Pointer GetObjectLockAndStatus(object obj) { var address = Intrinsic.GetObjectAddress(obj); return(address - Pointer.Size - 4); }
public static Pointer GetTypeDefinition(object obj) { var address = Intrinsic.GetObjectAddress(obj); return(address.LoadPointer(-Pointer.Size)); }