Example #1
0
 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());
         }
     }
 }
Example #2
0
 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);
         }
     }
 }
Example #3
0
        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));
                }
            }
        }
Example #4
0
 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());
         }
     }
 }
Example #5
0
 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);
         }
     }
 }