Exemple #1
0
 private void btnAddModule_Click(object sender, EventArgs e)
 {
     DialogResult result = openFileDialog.ShowDialog();
     try
     {
         if (result == DialogResult.OK)
         {
             // add all modules to modules list
             PEModule exeModule = null;
             for (int i=0; i<openFileDialog.FileNames.Length; ++i)
             {
                 PEModule m = new PEModule(openFileDialog.FileNames[i]);
                 codeCoverage_.Modules.Add(m);
                 ListViewItem item = new ListViewItem(m.Path);
                 item.SubItems.Add(m.FunctionCount.ToString());
                 item.SubItems.Add(m.BasicBlockCount.ToString());
                 item.SubItems.Add(m.ImageBase.ToString("X"));
                 lsvModules.Items.Add(item);
                 log("Added module " + m.Path + " with " + m.FunctionCount + " functions to modules list");
                 if (exeModule == null && m.Path.EndsWith(".exe")) exeModule = m;
             }
             if (exeModule != null) txbCmdLine.Text = exeModule.Path;
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
Exemple #2
0
 /// <summary>
 /// copy constructor
 /// </summary>
 /// <param name="module"></param>
 public PEModule(PEModule module)
 {
     bpAddresses_   = new List <uint>(module.bpAddresses_);
     roBPAddresses_ = new ReadOnlyCollection <uint>(bpAddresses_);
     modulePath_    = module.modulePath_;
     imageBase_     = module.imageBase_;
     hitSet_        = new HitSet(imageBase_);
 }
Exemple #3
0
        /// <summary>
        /// add new module as well as all breakpoint addresses of the given module to internal list
        /// </summary>
        /// <param name="module"></param>
        public void addModule(PEModule module)
        {
            // we need to add a copy of the given module so we are able to count hits for this recording only
            PEModule moduleCopy = new PEModule(module);

            // add all breakpoint addresses (VA)
            foreach (uint bp in module.BreakPointAddresses)
            {
                addressMap_.Add(bp, moduleCopy);
            }
            modules_.Add(moduleCopy);
        }
Exemple #4
0
        /// <summary>
        /// add hit to module whose address space contains the given address
        /// </summary>
        /// <param name="address">VA of the breakpoint hit</param>
        /// <returns></returns>
        public bool addHit(uint address)
        {
            // find correct module
            PEModule module = addressMap_[address];

            if (module != null)
            {
                module.Hits.addHit(address);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
 /// <summary>
 /// copy constructor
 /// </summary>
 /// <param name="module"></param>
 public PEModule(PEModule module)
 {
     bpAddresses_ = new List<uint>(module.bpAddresses_);
     roBPAddresses_ = new ReadOnlyCollection<uint>(bpAddresses_);
     modulePath_ = module.modulePath_;
     imageBase_ = module.imageBase_;
     hitSet_ = new HitSet(imageBase_);
 }
Exemple #6
0
 /// <summary>
 /// add new module as well as all breakpoint addresses of the given module to internal list
 /// </summary>
 /// <param name="module"></param>
 public void addModule(PEModule module)
 {
     // we need to add a copy of the given module so we are able to count hits for this recording only
     PEModule moduleCopy = new PEModule(module);
     // add all breakpoint addresses (VA)
     foreach (uint bp in module.BreakPointAddresses) addressMap_.Add(bp, moduleCopy);
     modules_.Add(moduleCopy);
 }