コード例 #1
0
        private void DoScan(SubClassScan subScan)
        {
            var allowDeeper = subScan.Level < MVM.MaxLevel;
            var address     = subScan.Address;

            for (int offset = 0; offset < MVM.MaxScanLength; offset += MVM.Alignment)
            {
                var scanAddress = address + offset;

                if (ValueReader.CheckPointer(scanAddress) && allowDeeper)
                {
                    var allowAdd = true;

                    if (MVM.NoLooping)
                    {
                        var longPointer = ValueReader.LastReadPointer.ToInt64();
                        allowAdd = !ProcessedPointers.Contains(longPointer);

                        if (allowAdd)
                        {
                            ProcessedPointers.Add(longPointer);
                        }
                    }

                    if (allowAdd)
                    {
                        var newPointer = new SubClassScan()
                        {
                            Address = ValueReader.LastReadPointer, Level = subScan.Level + 1,
                        };

                        newPointer.Offsets = new List <int>(subScan.Offsets)
                        {
                            offset
                        };

                        PossibleSubPointers.Enqueue(newPointer);
                        MVM.CurrentEntries = PossibleSubPointers.Count;
                        MVM.PointersFound++;
                    }
                }

                var readCompareRezult = ValueReader.ReadCompareValue(scanAddress);

                if (readCompareRezult.IsSatisfying)
                {
                    var testOffsets = new List <int>(subScan.Offsets)
                    {
                        offset
                    };
                    var endsWithPass = _endsWith == null;
                    if (!endsWithPass)
                    {
                        if (testOffsets.Count > _endsWith.Count)
                        {
                            endsWithPass = true;
                            for (var i = 0; i < _endsWith.Count; i++)
                            {
                                var expectedOffset = _endsWith[_endsWith.Count - i - 1];
                                var actalOffset    = testOffsets[testOffsets.Count - i - 1];
                                if (expectedOffset != actalOffset)
                                {
                                    endsWithPass = false;
                                    break;
                                }
                            }
                        }
                    }

                    if (endsWithPass)
                    {
                        var newScanResult = new VisibleResult()
                        {
                            Offsets         = testOffsets,
                            Address         = scanAddress.ToString("x"),
                            Level           = subScan.Level,
                            Value           = readCompareRezult.DisplayValue,
                            ComparableValue = readCompareRezult.ComparableValue,
                        };
                        MVM.AddResultAsync(newScanResult);
                    }
                }

                MVM.ValuesScanned++;
            }
        }
コード例 #2
0
        public bool CheckTableRezult(VisibleResult rezult, IntPtr baseAddress, IComparable compareValue, RezultRefreshType refreshType)
        {
            var processingPointer = baseAddress;

            for (var i = 0; i < rezult.Offsets.Count; i++)
            {
                var offset = rezult.Offsets[i];

                //if (offset == rezult.Offsets.Last())  //I nade huge nistake -_\
                if (i == rezult.Offsets.Count - 1)
                {
                    processingPointer += offset;
                    break;
                }

                processingPointer = M.ReadPointer(processingPointer + offset);

                if (M.CheckPointer(processingPointer) != SectionCategory.HEAP)
                {
                    if (refreshType == RezultRefreshType.DeleteBroken || refreshType == RezultRefreshType.FilterValues)
                    {
                        return(false);
                    }
                    else if (refreshType == RezultRefreshType.RefreshValues)
                    {
                        rezult.Value   = "-";
                        rezult.Address = "-";
                        return(true);
                    }
                    else
                    {
                        ThrowRefreshTypeException(refreshType);
                    }
                }
            }

            if (refreshType == RezultRefreshType.DeleteBroken)
            {
                return(true);
            }


            if (refreshType == RezultRefreshType.FilterValues)
            {
                if (MVM.SelectedDataType == DataType.String || MVM.SelectedDataType == DataType.StringU)
                {
                    var readDisplayValue = ReadDisplayString(processingPointer);
                    var compareString    = (string)compareValue;
                    if (MVM.StringIgnoreCase)
                    {
                        compareString    = compareString.ToLower();
                        readDisplayValue = readDisplayValue.ToLower();
                    }

                    if (MVM.StringCompareType == StringCompareType.Contains)
                    {
                        if (!readDisplayValue.Contains(compareString))
                        {
                            return(false);
                        }
                    }
                    else if (MVM.StringCompareType == StringCompareType.StartWith)
                    {
                        if (!readDisplayValue.StartsWith(compareString))
                        {
                            return(false);
                        }
                    }
                    else if (MVM.StringCompareType == StringCompareType.EndsWith)
                    {
                        if (!readDisplayValue.EndsWith(compareString))
                        {
                            return(false);
                        }
                    }
                    else if (MVM.StringCompareType == StringCompareType.Equal)
                    {
                        if (compareString != readDisplayValue)
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    var compValue = ReadComparable(processingPointer);

                    if (!CheckSatisfies(compareValue, compValue))
                    {
                        return(false);
                    }

                    var readDisplayValue = ReadDisplayString(processingPointer);
                    rezult.Value   = readDisplayValue;
                    rezult.Address = processingPointer.ToString("x");
                }
            }
            else if (refreshType == RezultRefreshType.RefreshValues)
            {
                var readDisplayValue = ReadDisplayString(processingPointer);
                rezult.Value   = readDisplayValue;
                rezult.Address = processingPointer.ToString("x");
            }
            else
            {
                ThrowRefreshTypeException(refreshType);
            }

            return(true);
        }