301 lines
16 KiB
HTML
301 lines
16 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>binaryninja.mainthread — Binary Ninja API 1.1.0 documentation</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../_static/css/other.css" type="text/css" />
|
|
|
|
|
|
|
|
<link rel="top" title="Binary Ninja API 1.1.0 documentation" href="../../index.html"/>
|
|
<link rel="up" title="binaryninja" href="../binaryninja.html"/>
|
|
|
|
|
|
<script src="../../_static/js/modernizr.min.js"></script>
|
|
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav" role="document">
|
|
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search">
|
|
|
|
|
|
|
|
<a href="../../index.html" class="icon icon-home"> Binary Ninja API
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
<div class="version">
|
|
1.1
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div role="search">
|
|
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
|
|
|
|
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.architecture-module.html">architecture</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.atexit-module.html">atexit</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.basicblock-module.html">basicblock</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.binaryninja-module.html">binaryninja</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.binaryview-module.html">binaryview</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.builtins-module.html">builtins</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.callingconvention-module.html">callingconvention</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.databuffer-module.html">databuffer</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.demangle-module.html">demangle</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.downloadprovider-module.html">downloadprovider</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.enums-module.html">enums</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.fileaccessor-module.html">fileaccessor</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.filemetadata-module.html">filemetadata</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.function-module.html">function</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.functionrecognizer-module.html">functionrecognizer</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.highlight-module.html">highlight</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.interaction-module.html">interaction</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.lineardisassembly-module.html">lineardisassembly</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.log-module.html">log</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.lowlevelil-module.html">lowlevelil</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.mainthread-module.html">mainthread</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.mediumlevelil-module.html">mediumlevelil</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.metadata-module.html">metadata</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.platform-module.html">platform</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.plugin-module.html">plugin</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.pluginmanager-module.html">pluginmanager</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.pyopenssl-module.html">pyopenssl</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.requests-module.html">requests</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.scriptingprovider-module.html">scriptingprovider</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.setting-module.html">setting</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.transform-module.html">transform</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.types-module.html">types</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.undoaction-module.html">undoaction</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../binaryninja.update-module.html">update</a></li>
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
|
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="../../index.html">Binary Ninja API</a>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
|
|
<li><a href="../../index.html">Docs</a> »</li>
|
|
|
|
<li><a href="../index.html">Module code</a> »</li>
|
|
|
|
<li><a href="../binaryninja.html">binaryninja</a> »</li>
|
|
|
|
<li>binaryninja.mainthread</li>
|
|
|
|
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div itemprop="articleBody">
|
|
|
|
<h1>Source code for binaryninja.mainthread</h1><div class="highlight"><pre>
|
|
<span></span><span class="c1"># Copyright (c) 2015-2017 Vector 35 LLC</span>
|
|
<span class="c1">#</span>
|
|
<span class="c1"># Permission is hereby granted, free of charge, to any person obtaining a copy</span>
|
|
<span class="c1"># of this software and associated documentation files (the "Software"), to</span>
|
|
<span class="c1"># deal in the Software without restriction, including without limitation the</span>
|
|
<span class="c1"># rights to use, copy, modify, merge, publish, distribute, sublicense, and/or</span>
|
|
<span class="c1"># sell copies of the Software, and to permit persons to whom the Software is</span>
|
|
<span class="c1"># furnished to do so, subject to the following conditions:</span>
|
|
<span class="c1">#</span>
|
|
<span class="c1"># The above copyright notice and this permission notice shall be included in</span>
|
|
<span class="c1"># all copies or substantial portions of the Software.</span>
|
|
<span class="c1">#</span>
|
|
<span class="c1"># THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span>
|
|
<span class="c1"># IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
|
|
<span class="c1"># FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span>
|
|
<span class="c1"># AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
|
|
<span class="c1"># LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span>
|
|
<span class="c1"># FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS</span>
|
|
<span class="c1"># IN THE SOFTWARE.</span>
|
|
|
|
<span class="c1"># Binary Ninja components</span>
|
|
<span class="kn">from</span> <span class="nn">binaryninja</span> <span class="k">import</span> <span class="n">_binaryninjacore</span> <span class="k">as</span> <span class="n">core</span>
|
|
<span class="kn">from</span> <span class="nn">binaryninja</span> <span class="k">import</span> <span class="n">scriptingprovider</span>
|
|
|
|
|
|
<div class="viewcode-block" id="execute_on_main_thread"><a class="viewcode-back" href="../../binaryninja.mainthread.execute_on_main_thread.html#binaryninja.mainthread.execute_on_main_thread">[docs]</a><span class="k">def</span> <span class="nf">execute_on_main_thread</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
|
|
<span class="n">action</span> <span class="o">=</span> <span class="n">scriptingprovider</span><span class="o">.</span><span class="n">_ThreadActionContext</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
|
|
<span class="n">obj</span> <span class="o">=</span> <span class="n">core</span><span class="o">.</span><span class="n">BNExecuteOnMainThread</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">action</span><span class="o">.</span><span class="n">callback</span><span class="p">)</span>
|
|
<span class="k">if</span> <span class="n">obj</span><span class="p">:</span>
|
|
<span class="k">return</span> <span class="n">scriptingprovider</span><span class="o">.</span><span class="n">MainThreadAction</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
|
|
<span class="k">return</span> <span class="kc">None</span></div>
|
|
|
|
|
|
<div class="viewcode-block" id="execute_on_main_thread_and_wait"><a class="viewcode-back" href="../../binaryninja.mainthread.execute_on_main_thread_and_wait.html#binaryninja.mainthread.execute_on_main_thread_and_wait">[docs]</a><span class="k">def</span> <span class="nf">execute_on_main_thread_and_wait</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
|
|
<span class="n">action</span> <span class="o">=</span> <span class="n">scriptingprovider</span><span class="o">.</span><span class="n">_ThreadActionContext</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
|
|
<span class="n">core</span><span class="o">.</span><span class="n">BNExecuteOnMainThreadAndWait</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">action</span><span class="o">.</span><span class="n">callback</span><span class="p">)</span></div>
|
|
|
|
|
|
<div class="viewcode-block" id="worker_enqueue"><a class="viewcode-back" href="../../binaryninja.mainthread.worker_enqueue.html#binaryninja.mainthread.worker_enqueue">[docs]</a><span class="k">def</span> <span class="nf">worker_enqueue</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
|
|
<span class="n">action</span> <span class="o">=</span> <span class="n">scriptingprovider</span><span class="o">.</span><span class="n">_ThreadActionContext</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
|
|
<span class="n">core</span><span class="o">.</span><span class="n">BNWorkerEnqueue</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">action</span><span class="o">.</span><span class="n">callback</span><span class="p">)</span></div>
|
|
|
|
|
|
<div class="viewcode-block" id="worker_priority_enqueue"><a class="viewcode-back" href="../../binaryninja.mainthread.worker_priority_enqueue.html#binaryninja.mainthread.worker_priority_enqueue">[docs]</a><span class="k">def</span> <span class="nf">worker_priority_enqueue</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
|
|
<span class="n">action</span> <span class="o">=</span> <span class="n">scriptingprovider</span><span class="o">.</span><span class="n">_ThreadActionContext</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
|
|
<span class="n">core</span><span class="o">.</span><span class="n">BNWorkerPriorityEnqueue</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">action</span><span class="o">.</span><span class="n">callback</span><span class="p">)</span></div>
|
|
|
|
|
|
<div class="viewcode-block" id="worker_interactive_enqueue"><a class="viewcode-back" href="../../binaryninja.mainthread.worker_interactive_enqueue.html#binaryninja.mainthread.worker_interactive_enqueue">[docs]</a><span class="k">def</span> <span class="nf">worker_interactive_enqueue</span><span class="p">(</span><span class="n">func</span><span class="p">):</span>
|
|
<span class="n">action</span> <span class="o">=</span> <span class="n">scriptingprovider</span><span class="o">.</span><span class="n">_ThreadActionContext</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
|
|
<span class="n">core</span><span class="o">.</span><span class="n">BNWorkerInteractiveEnqueue</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">action</span><span class="o">.</span><span class="n">callback</span><span class="p">)</span></div>
|
|
|
|
|
|
<div class="viewcode-block" id="get_worker_thread_count"><a class="viewcode-back" href="../../binaryninja.mainthread.get_worker_thread_count.html#binaryninja.mainthread.get_worker_thread_count">[docs]</a><span class="k">def</span> <span class="nf">get_worker_thread_count</span><span class="p">():</span>
|
|
<span class="k">return</span> <span class="n">core</span><span class="o">.</span><span class="n">BNGetWorkerThreadCount</span><span class="p">()</span></div>
|
|
|
|
|
|
<div class="viewcode-block" id="set_worker_thread_count"><a class="viewcode-back" href="../../binaryninja.mainthread.set_worker_thread_count.html#binaryninja.mainthread.set_worker_thread_count">[docs]</a><span class="k">def</span> <span class="nf">set_worker_thread_count</span><span class="p">(</span><span class="n">count</span><span class="p">):</span>
|
|
<span class="n">core</span><span class="o">.</span><span class="n">BNSetWorkerThreadCount</span><span class="p">(</span><span class="n">count</span><span class="p">)</span></div>
|
|
</pre></div>
|
|
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<p>
|
|
© Copyright 2016, Vector 35 LLC.
|
|
|
|
</p>
|
|
</div>
|
|
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT:'../../',
|
|
VERSION:'1.1.0',
|
|
COLLAPSE_INDEX:false,
|
|
FILE_SUFFIX:'.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="../../_static/jquery.js"></script>
|
|
<script type="text/javascript" src="../../_static/underscore.js"></script>
|
|
<script type="text/javascript" src="../../_static/doctools.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="../../_static/js/theme.js"></script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function () {
|
|
SphinxRtdTheme.StickyNav.enable();
|
|
});
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html> |