示例#1
0
        private void next_scan_worker_DoWork(object sender, DoWorkEventArgs e)
        {
            ulong percent_len = 0;

            for (int section_idx = 0; section_idx < processManager.MappedSectionList.Count; ++section_idx)
            {
                MappedSection mappedSection = processManager.MappedSectionList[section_idx];
                AddressList   addressList   = mappedSection.AddressList;

                AddressList filtered_list = mappedSection.getFilteredAddressList(processManager, memoryHelper, value_box.Text,
                                                                                 next_scan_worker, ref percent_len, 0, 0.5f);
                mappedSection.AddressList = addressList.Intersect(memoryHelper, filtered_list, value_box.Text);
            }

            WorkerArgs args = (WorkerArgs)e.Argument;

            update_result_list_view(next_scan_worker, args.ValueType, false, 50, 0.5f);
        }
示例#2
0
        private void next_scan_worker_DoWork(object sender, DoWorkEventArgs e)
        {
            ulong percent_len = 0;

            for (int section_idx = 0; section_idx < processManager.mapped_section_list.Count; ++section_idx)
            {
                MappedSection mappedSection = processManager.mapped_section_list[section_idx];
                AddressList   addressList   = mappedSection.AddressList;

                if (mappedSection.AddressList.Count < 50)
                {
                    for (int address_idx = 0; address_idx < addressList.Count; ++address_idx)
                    {
                        Address address = addressList[address_idx];

                        byte[] compare_value = processManager.MemoryHelper.GetCompareBytes(address, value_box.Text);

                        byte[] value = processManager.MemoryHelper.GetBytesByType(address.AddressOffset + mappedSection.Start);
                        if (!processManager.MemoryHelper.Compare(compare_value, value))
                        {
                            addressList.RemoveAt(address_idx);
                            --address_idx;
                        }
                        else
                        {
                            Address address_tmp = new Address();
                            address_tmp.AddressOffset = addressList[address_idx].AddressOffset;
                            address_tmp.MemoryValue   = processManager.MemoryHelper.BytesToUint(value);
                            addressList[address_idx]  = address_tmp;
                        }
                    }
                }
                else
                {
                    AddressList filtered_list = mappedSection.getFilteredAddressList(processManager, value_box.Text,
                                                                                     next_scan_worker, ref percent_len, 0, 0.5f);
                    mappedSection.AddressList = addressList.Intersect(processManager.MemoryHelper, filtered_list, value_box.Text);
                }
            }

            WorkerArgs args = (WorkerArgs)e.Argument;

            update_result_list_view(next_scan_worker, args.ValueType, false, 50, 0.5f);
        }
示例#3
0
        public AddressList getFilteredAddressList(ProcessManager processManager, MemoryHelper memoryHelper,
                                                  string value, BackgroundWorker worker, ref ulong percent_len, int start, float percent)
        {
            AddressList filtered_list = new AddressList();

            worker.ReportProgress(start);

            if (!Check)
            {
                return(filtered_list);
            }

            ulong address = this.Start;
            int   length  = this.Length;

            const int block_length = 1024 * 1024 * 128;

            while (length != 0)
            {
                int cur_length = block_length;

                if (cur_length > length)
                {
                    cur_length = length;
                    length     = 0;
                }
                else
                {
                    length -= cur_length;
                }

                percent_len += (ulong)cur_length;
                worker.ReportProgress(start + (int)(((float)percent_len / processManager.TotalMemorySize) * 100 * percent));

                byte[] buffer = MemoryHelper.ReadMemory(address, (int)cur_length);

                byte[] match_value = memoryHelper.StringToBytes(value);

                memoryHelper.CompareWithFilterList(match_value, address, buffer, filtered_list);

                address += (ulong)cur_length;
            }
            return(filtered_list);
        }
示例#4
0
        public AddressList Intersect(MemoryHelper memoryHelper, AddressList filteredList, string default_compare_value)
        {
            AddressList new_address_list = new AddressList();
            int         idx_i            = 0;
            int         idx_j            = 0;

            while (idx_i < address_list.Count && idx_j < filteredList.Count)
            {
                Address address  = address_list[idx_i];
                Address filtered = filteredList[idx_j];

                if (address.AddressOffset == filtered.AddressOffset)
                {
                    byte[] value = memoryHelper.UlongToBytes(filtered.MemoryValue);

                    byte[] compare_value = memoryHelper.GetCompareBytes(address, default_compare_value);

                    if (memoryHelper.Compare(compare_value, value))
                    {
                        new_address_list.Add(filtered);
                    }

                    idx_j++;
                    idx_i++;
                }
                else if (address.AddressOffset > filtered.AddressOffset)
                {
                    idx_j++;
                }
                else
                {
                    idx_i++;
                }
            }

            return(new_address_list);
        }
示例#5
0
 void compare_with_filter_list_2_bytes(byte[] match_value, ulong address, byte[] mem, AddressList filtered_list)
 {
     Byte[] bytes = new byte[8];
     for (int i = 0; i + 2 < mem.LongLength; i += 2)
     {
         Buffer.BlockCopy(mem, i, bytes, 0, 2);
         if (CompareInFilter(match_value, bytes))
         {
             Address addr = new Address();
             addr.AddressOffset = (uint)i;
             addr.MemoryValue   = BytesToUlong(bytes);
             filtered_list.Add(addr);
         }
     }
 }
示例#6
0
        private void update_result_list_view(BackgroundWorker worker, string value_type, bool refresh, int start, float percent)
        {
            worker.ReportProgress(start, 0);

            List <ListViewItem> listViewItems          = new List <ListViewItem>();
            HashSet <int>       mappedSectionCheckeSet = new HashSet <int>();

            ulong totalAddressCount = processManager.TotalAddressCount();
            ulong curAddressCount   = 0;

            for (int idx = 0; idx < processManager.mapped_section_list.Count; ++idx)
            {
                MappedSection mapped_section = processManager.mapped_section_list[idx];
                AddressList   address_list   = mapped_section.AddressList;
                if (address_list.Count > 0)
                {
                    mappedSectionCheckeSet.Add(idx);
                }
                for (int i = 0; i < address_list.Count; i++)
                {
                    if (curAddressCount >= 0x10000)
                    {
                        break;
                    }

                    curAddressCount++;
                    ListViewItem lvi = new ListViewItem();

                    lvi.Text = String.Format("{0:X}", address_list[i].AddressOffset + mapped_section.Start);

                    byte[] match_bytes = BitConverter.GetBytes(address_list[i].MemoryValue);

                    if (refresh)
                    {
                        match_bytes = processManager.MemoryHelper.GetBytesByType(address_list[i].AddressOffset + mapped_section.Start);
                        Address address_tmp = new Address();
                        address_tmp.AddressOffset = address_list[i].AddressOffset;
                        address_tmp.MemoryValue   = processManager.MemoryHelper.BytesToUint(match_bytes);
                        address_list[i]           = address_tmp;
                    }

                    string value_output = processManager.MemoryHelper.BytesToString(match_bytes);

                    lvi.SubItems.Add(value_type);
                    lvi.SubItems.Add(value_output);
                    lvi.SubItems.Add(processManager.MemoryHelper.PrintBytesByHex(match_bytes));
                    lvi.SubItems.Add(processManager.GetSectionName(idx));

                    listViewItems.Add(lvi);

                    if (i % 500 == 0)
                    {
                        worker.ReportProgress(start + (int)(i / (float)curAddressCount * 100 * percent));
                    }
                }
            }

            WorkerReturn workerReturn = new WorkerReturn();

            workerReturn.ListViewItems          = listViewItems;
            workerReturn.MappedSectionCheckeSet = mappedSectionCheckeSet;
            workerReturn.Results = totalAddressCount;

            worker.ReportProgress(start + (int)(100 * percent), workerReturn);
        }
示例#7
0
 public MappedSection()
 {
     AddressList = new AddressList();
 }