11using System ;
22using System . Collections . Generic ;
33using System . Windows . Forms ;
4+ using StructureSpiderAdvanced . ValueReaders ;
5+ using StructureSpiderAdvanced . ValueReaders . Base ;
46
57namespace StructureSpiderAdvanced
68{
@@ -22,36 +24,36 @@ public Scanner(MainViewModel viewModel, Memory m)
2224 MVM . PointersEvaluated = 0 ;
2325 MVM . ValuesScanned = 0 ;
2426
25- var pLength = ( ushort ) M . PointerLength ;
27+ var pLength = ( ushort ) M . PointerLength ;
2628
2729 if ( viewModel . SelectedDataType == DataType . Pointer ||
2830 viewModel . SelectedDataType == DataType . String ||
2931 viewModel . SelectedDataType == DataType . StringU
30- )
32+ )
3133 {
32- if ( MVM . Alignment != pLength )
34+ if ( MVM . Alignment != pLength )
3335 {
3436 var bits = m . Is64Bit ? "x64" : "x32" ;
3537
3638 var result = MessageBox . Show ( $ "Do you really want to scan with alignment { MVM . Alignment } " +
37- $ "(For { bits } process structure alignment is { pLength } )? " + Environment . NewLine +
38- $ "For this scan type recommended value is { pLength } " + Environment . NewLine +
39- $ "Yes - continue using { MVM . Alignment } " + Environment . NewLine +
40- $ "No - set to { pLength } (Recommended)", "Alighnment" , MessageBoxButtons . YesNo ) ;
39+ $ "(For { bits } process structure alignment is { pLength } )? " + Environment . NewLine +
40+ $ "For this scan type recommended value is { pLength } " + Environment . NewLine +
41+ $ "Yes - continue using { MVM . Alignment } " + Environment . NewLine +
42+ $ "No - set to { pLength } (Recommended)", "Alighnment" , MessageBoxButtons . YesNo ) ;
4143
4244 if ( result == DialogResult . No )
4345 MVM . Alignment = pLength ;
4446 }
4547 }
4648
4749 var scansCount = MVM . MaxScanLength / MVM . Alignment ;
48- MVM . MaxScanLength = ( ushort ) ( scansCount * MVM . Alignment ) ;
50+ MVM . MaxScanLength = ( ushort ) ( scansCount * MVM . Alignment ) ;
4951
5052 ValueReader = GetValueReaderByDataType ( viewModel . SelectedDataType , M , MVM ) ;
5153 ValueReader . SetCompareValue ( MVM . ScanValue ) ;
5254
5355 var startPointer = new IntPtr ( MVM . StartSearchAddress ) ;
54- PossibleSubPointers . Enqueue ( new SubClassScan ( ) { Address = startPointer } ) ;
56+ PossibleSubPointers . Enqueue ( new SubClassScan ( ) { Address = startPointer } ) ;
5557 MVM . PointersFound = 1 ;
5658
5759 while ( PossibleSubPointers . Count > 0 )
@@ -89,7 +91,7 @@ public static BaseValueReader GetValueReaderByDataType(DataType dataType, Memory
8991 return new UStringValueReader ( m , mvm ) ;
9092 default :
9193 throw new NotImplementedException ( $ "Scan type is not defined in code: { dataType } ") ;
92- }
94+ }
9395 }
9496
9597 private void DoScan ( SubClassScan subScan )
@@ -109,29 +111,41 @@ private void DoScan(SubClassScan subScan)
109111 {
110112 var longPointer = ValueReader . LastReadPointer . ToInt64 ( ) ;
111113 allowAdd = ! ProcessedPointers . Contains ( longPointer ) ;
114+
112115 if ( allowAdd )
113116 ProcessedPointers . Add ( longPointer ) ;
114117 }
115118
116119 if ( allowAdd )
117120 {
118- var newPointer = new SubClassScan ( ) { Address = ValueReader . LastReadPointer , Level = subScan . Level + 1 , } ;
121+ var newPointer = new SubClassScan ( ) { Address = ValueReader . LastReadPointer , Level = subScan . Level + 1 , } ;
122+
119123 newPointer . Offsets = new List < int > ( subScan . Offsets )
120124 {
121125 offset
122126 } ;
127+
123128 PossibleSubPointers . Enqueue ( newPointer ) ;
124129 MVM . CurrentEntries = PossibleSubPointers . Count ;
125130 MVM . PointersFound ++ ;
126131 }
127132 }
128133
129134 var readCompareRezult = ValueReader . ReadCompareValue ( scanAddress ) ;
130- if ( readCompareRezult . IsEqual )
135+
136+ if ( readCompareRezult . IsSatisfying )
131137 {
132- var newScanResult = new VisibleResult ( ) { Offsets = new List < int > ( subScan . Offsets ) { offset } , Address = scanAddress . ToString ( "x" ) , Level = subScan . Level , Value = readCompareRezult . DisplayValue } ;
138+ var newScanResult = new VisibleResult ( )
139+ {
140+ Offsets = new List < int > ( subScan . Offsets ) { offset } ,
141+ Address = scanAddress . ToString ( "x" ) ,
142+ Level = subScan . Level ,
143+ Value = readCompareRezult . DisplayValue ,
144+ ComparableValue = readCompareRezult . ComparableValue ,
145+ } ;
133146 MVM . AddRezultAsync ( newScanResult ) ;
134147 }
148+
135149 MVM . ValuesScanned ++ ;
136150 }
137151 }
0 commit comments