public void EditFind() { using (ISearchDialog dlg = dlgFactory.CreateSearchDialog()) { if (uiSvc.ShowModalDialog(dlg) == DialogResult.OK) { Func <int, Program, bool> filter = GetScannedFilter(dlg); var re = Core.Dfa.Automaton.CreateFromPattern(dlg.Patterns.Text); if (re == null) { return; } var hits = this.decompilerSvc.Decompiler.Project.Programs .SelectMany(program => program.SegmentMap.Segments.Values.SelectMany(seg => { var linBaseAddr = seg.MemoryArea.BaseAddress.ToLinear(); return(re.GetMatches( seg.MemoryArea.Bytes, 0, (int)seg.MemoryArea.Length) .Where(o => filter(o, program)) .Select(offset => new AddressSearchHit { Program = program, Address = program.SegmentMap.MapLinearAddressToAddress( linBaseAddr + (ulong)offset) })); })); srSvc.ShowAddressSearchResults(hits, new CodeSearchDetails()); } } }
public void EditFind() { using (ISearchDialog dlg = dlgFactory.CreateSearchDialog()) { if (uiSvc.ShowModalDialog(dlg) == DialogResult.OK) { Func <int, Program, bool> filter = GetScannedFilter(dlg); var re = Scanning.Dfa.Automaton.CreateFromPattern(dlg.Patterns.Text); if (re == null) { return; } var hits = this.decompilerSvc.Decompiler.Project.Programs .SelectMany(program => program.ImageMap.Segments.Values.SelectMany(seg => { var segOffset = (int)(seg.Address - program.Image.BaseAddress); return(re.GetMatches( program.Image.Bytes, segOffset, segOffset + (int)seg.Size) .Where(o => filter(o, program)) .Select(offset => new ProgramAddress( program, program.ImageMap.MapLinearAddressToAddress( program.Image.BaseAddress.ToLinear() + (ulong)offset)))); })); srSvc.ShowAddressSearchResults(hits, AddressSearchDetails.Code); } } }
public void FindStrings(ISearchResultService srSvc) { using (var dlgStrings = dlgFactory.CreateFindStringDialog()) { if (uiSvc.ShowModalDialog(dlgStrings) == DialogResult.OK) { var criteria = dlgStrings.GetCriteria(); var hits = this.decompilerSvc.Decompiler.Project.Programs .SelectMany(p => new StringFinder(p).FindStrings(criteria)); srSvc.ShowAddressSearchResults( hits, new StringSearchDetails(criteria)); } } }
public void EditFind() { using (ISearchDialog dlg = dlgFactory.CreateSearchDialog()) { if (uiSvc.ShowModalDialog(dlg) == DialogResult.OK) { Func <int, Program, bool> filter = GetScannedFilter(dlg); var re = Core.Dfa.Automaton.CreateFromPattern(dlg.Patterns.Text); if (re == null) { return; } var hits = this.decompilerSvc.Decompiler.Project.Programs .SelectMany(program => program.SegmentMap.Segments.Values.SelectMany(seg => { return(ReMatches(program, seg, filter, re)); })); srSvc.ShowAddressSearchResults(hits, new CodeSearchDetails()); } } }
public void FindStrings(ISearchResultService srSvc) { using (var dlgStrings = dlgFactory.CreateFindStringDialog()) { if (uiSvc.ShowModalDialog(dlgStrings) == DialogResult.OK) { var hits = this.decompilerSvc.Decompiler.Project.Programs .SelectMany(p => new StringFinder(p).FindStrings( dlgStrings.GetStringType(), dlgStrings.MinLength)); srSvc.ShowAddressSearchResults( hits, AddressSearchDetails.Strings); } } }