Exemple #1
0
        public void UpdateResultList(ProcessManager processManager, MemoryHelper memoryHelper,
                                     string default_value_0_str, string default_value_1_str, bool is_hex, bool isGroup, bool newScan)
        {
            if (!Check)
            {
                ResultList  = null;
                ResultLists = null;
                return;
            }

            ResultList        new_result_list = new ResultList(memoryHelper.Length, memoryHelper.Alignment);
            List <ResultList> nowResults      = ResultLists != null && ResultLists.Count > 0 ? ResultLists : new List <ResultList>(); //For GroupScan

            ulong address      = this.Start;
            uint  base_address = 0;
            int   length       = this.Length;

            const int buffer_length = 1024 * 1024 * 128;

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

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

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

                byte[] default_value_0 = null;
                if (memoryHelper.ParseFirstValue)
                {
                    if (is_hex)
                    {
                        default_value_0 = memoryHelper.HexStringToBytes(default_value_0_str);
                    }
                    else
                    {
                        default_value_0 = memoryHelper.StringToBytes(default_value_0_str);
                    }
                }

                byte[] default_value_1 = null;
                if (memoryHelper.ParseSecondValue)
                {
                    if (is_hex)
                    {
                        default_value_1 = memoryHelper.HexStringToBytes(default_value_1_str);
                    }
                    else
                    {
                        default_value_1 = memoryHelper.StringToBytes(default_value_1_str);
                    }
                }

                if (isGroup)
                {
                    memoryHelper.CompareWithMemoryBufferGroupScanner(default_value_0_str, buffer, ref nowResults, base_address, newScan);
                }
                else if (newScan)
                {
                    memoryHelper.CompareWithMemoryBufferNewScanner(default_value_0, default_value_1, buffer, new_result_list, base_address);
                }
                else
                {
                    memoryHelper.CompareWithMemoryBufferNextScanner(default_value_0, default_value_1, buffer, ResultList, new_result_list);
                }

                address      += (ulong)cur_length;
                base_address += (uint)cur_length;
            }
            if (isGroup)
            {
                ResultLists = nowResults;
            }
            else
            {
                ResultList = new_result_list;
            }
        }