Example #1
0
        private void PointerFinder(List <long> path_offset, List <Pointer> path_address,
                                   ulong address, List <int> range, int level)
        {
            if (Stop)
            {
                return;
            }

            if (level < range.Count)
            {
                Pointer position = new Pointer();
                int     index    = GetPointerByAddress(address, ref position);
                int     counter  = 0;

                for (int i = index; i >= 0; i--)
                {
                    if (Stop)
                    {
                        break;
                    }

                    if ((long)pointer_list_order_by_address[i].Address + range[level] < (long)address)
                    {
                        break;
                    }

                    List <Pointer> pointerList = GetPointerListByValue(pointer_list_order_by_address[i].Address);

                    if (pointerList.Count > 0)
                    {
                        path_offset.Add((long)(address - pointer_list_order_by_address[i].Address));
                        const int max_pointer_count   = 15;
                        int       cur_pointer_counter = 0;

                        bool in_new_level = false;

                        for (int j = 0; j < pointerList.Count; ++j)
                        {
                            bool in_stack = false;
                            for (int k = 0; k < path_address.Count; ++k)
                            {
                                if (path_address[k].PointerValue == pointerList[j].PointerValue ||
                                    path_address[k].Address == pointerList[j].Address)
                                {
                                    in_stack = true;
                                    break;
                                }
                            }
                            if (in_stack)
                            {
                                continue;
                            }

                            in_new_level = true;
                            if (cur_pointer_counter >= max_pointer_count)
                            {
                                break;
                            }

                            ++cur_pointer_counter;

                            path_address.Add(pointerList[j]);
                            PointerFinder(path_offset, path_address, pointerList[j].Address, range, level + 1);
                            path_address.RemoveAt(path_address.Count - 1);
                        }

                        path_offset.RemoveAt(path_offset.Count - 1);

                        if (counter >= 1)
                        {
                            break;
                        }

                        if (in_new_level)
                        {
                            ++counter;
                        }
                    }
                }
            }

            if (Stop)
            {
                return;
            }

            NewPathGeneratedEvent?.Invoke(this, path_offset, path_address);
        }
Example #2
0
 public void Add(Pointer pointer)
 {
     pointer_list_order_by_address.Add(pointer);
     pointer_list_order_by_pointer_value.Add(pointer);
 }