예제 #1
0
파일: Utils.cs 프로젝트: xuan2261/UnSealer
        public static bool CheckTamper(ModuleDefMD module)
        {
            bool      IsTampred;
            MethodDef cctor = module.GlobalType.FindStaticConstructor();

            if (cctor == null)
            {
                IsTampred = false;
            }
            else
            {
                for (int i = 0; i < cctor.Body.Instructions.Count; i++)
                {
                    if (cctor.Body.Instructions[i].OpCode == OpCodes.Call)
                    {
                        try
                        {
                            MethodDef method = (MethodDef)cctor.Body.Instructions[i].Operand;
                            for (int z = 0; z < method.Body.Instructions.Count; z++)
                            {
                                if (method.Body.Instructions[z].OpCode == OpCodes.Call)
                                {
                                    string operand = method.Body.Instructions[z].Operand.ToString();
                                    if (operand.Contains("GetHINSTANCE"))
                                    {
                                        if (method.FindInstructionsNumber(OpCodes.Call, "(System.IntPtr,System.UInt32,System.UInt32,System.UInt32&)") == 1)
                                        {
                                            ATMeth = method;
                                            return(true);
                                        }
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                IsTampred = false;
            }
            return(IsTampred);
        }