Exemple #1
0
        /// <remarks>Unsure</remarks>
        public static Boolean Is_Ldarga(this VirtualOpCode ins)
        {
            var sub = ins.Find(Pattern_Ldarga);

            return(sub != null &&
                   ((FieldDef)sub[2].Operand).MDToken == ins.VType.ArgumentsField.MDToken &&
                   ((MethodDef)sub[4].Operand).ReturnType.FullName.Equals("System.UInt16"));
        }
Exemple #2
0
        public static Boolean Is_Starg_S(this VirtualOpCode ins)
        {
            var sub = ins.Find(Pattern_Starg);

            return(sub != null && sub[3].Operand is MethodDef &&
                   ((MethodDef)sub[3].Operand).ReturnType.FullName.Equals("System.Byte") &&
                   ins.Matches(Pattern_Tail_Starg));
        }
Exemple #3
0
        public static Boolean Is_Ldelem_I(this VirtualOpCode ins)
        {
            var sub = ins.Find(new Code[] {
                Code.Ldarg_0, Code.Ldsfld, Code.Call, Code.Ret
            });

            return(sub != null &&
                   ((IField)sub[1].Operand).MDToken == ins.VType.GetTypeField("System.IntPtr").MDToken &&
                   _Is_Ldelem(ins));
        }
Exemple #4
0
        public static Boolean Is_Rethrow(this VirtualOpCode ins)
        {
            var sub = ins.Find(new Code[] {
                Code.Newobj, Code.Throw, Code.Ldarg_0, Code.Ldarg_0, Code.Ldfld,
                Code.Callvirt, Code.Callvirt, Code.Stfld, Code.Ldarg_0, Code.Ldfld,
                Code.Call, Code.Ret
            });

            return(sub != null && _Is_Throw(ins, ((MethodDef)sub[10].Operand)));
        }
Exemple #5
0
        public static Boolean Is_Callvirt(this VirtualOpCode ins)
        {
            MethodDef method;
            var       sub = ins.Find(new Code[] {
                Code.Ldarg_1, Code.Castclass, Code.Stloc_S, Code.Ldarg_0, Code.Ldloc_S,
                Code.Callvirt, Code.Call, Code.Stloc_0, Code.Ldarg_0, Code.Ldfld, Code.Brfalse_S
            });

            return(sub != null &&
                   (method = sub[6].Operand as MethodDef) != null &&
                   method.HasReturnType && method.ReturnType.FullName.Equals("System.Reflection.MethodBase"));
        }
Exemple #6
0
        public static Boolean Is_Ckfinite(this VirtualOpCode ins)
        {
            var sub = ins.Find(new Code[] {
                Code.Ldloc_0, Code.Callvirt, Code.Call, Code.Brtrue_S,
                Code.Ldloc_0, Code.Callvirt, Code.Call, Code.Brfalse_S,
                Code.Ldstr, Code.Newobj, Code.Throw
            });

            return(sub != null &&
                   ((IMethod)sub[2].Operand).FullName.Contains("System.Double::IsNaN") &&
                   ((IMethod)sub[6].Operand).FullName.Contains("System.Double::IsInfinity"));
        }