Пример #1
0
        public bool FindPrev(out HookILCursor[] cursors, params Func <Instruction, bool>[] predicates)
        {
            cursors = new HookILCursor[predicates.Length];
            Instruction instrOrig = Instr;

            try {
                Func <Instruction, bool> last = predicates[predicates.Length - 1];
                while (GotoPrev(last))
                {
                    cursors[predicates.Length - 1] = Clone();
                    Instruction instrLast = Instr;
                    for (int i = predicates.Length - 2; i > -1; i--)
                    {
                        if (!GotoPrev(predicates[i]))
                        {
                            goto Skip;
                        }
                        cursors[i] = Clone();
                    }

                    Instr = instrLast;
                    return(true);

Skip:
                    Instr = instrLast;
                    continue;
                }
            } catch {
                // Fail silently.
            }
            Instr = instrOrig;
            return(false);
        }
Пример #2
0
        public bool FindNext(out HookILCursor[] cursors, params Func <Instruction, bool>[] predicates)
        {
            cursors = new HookILCursor[predicates.Length];
            Instruction instrOrig = Instr;

            try {
                Func <Instruction, bool> first = predicates[0];
                while (GotoNext(first))
                {
                    cursors[0] = Clone();
                    Instruction instrFirst = Instr;
                    for (int i = 1; i < predicates.Length; i++)
                    {
                        if (!GotoNext(predicates[i]))
                        {
                            goto Skip;
                        }
                        cursors[i] = Clone();
                    }

                    Instr = instrFirst;
                    return(true);

Skip:
                    Instr = instrFirst;
                    continue;
                }
            } catch {
                // Fail silently.
            }
            Instr = instrOrig;
            return(false);
        }
Пример #3
0
 public HookILCursor(HookILCursor old)
 {
     HookIL = old.HookIL;
     Instr  = old.Instr;
 }