コード例 #1
0
//--------------------------------------------------------------------------
// Initialize the plugin.
int idaapi init(void)
{
	if ( !init_hexrays_plugin() )
    return PLUGIN_SKIP; // no decompiler
	install_hexrays_callback(callback, NULL);
	const char *hxver = get_hexrays_version();
	msg("Hex-rays version %s has been detected, %s ready to use\n", hxver, PLUGIN.wanted_name);
	inited = true;
	hotcode_dg = 84; // T
	hotcode_ce = 79; // O
	hotcode_rt = 82; // R
	hotcode_gd = 74; // J
	msg(
		"\nHexRaysCodeXplorer plugin by @REhints loaded.\n\n\n");

	return PLUGIN_KEEP;
}
コード例 #2
0
//-------------------------------------------------------------------------
// Initialize the Python environment
bool HexraysPython_Init(void)
{
    // Already initialized?
    if ( g_initialized  )
        return true;

    if( !init_hexrays_plugin(0) ) {
        hexdsp = NULL;
        return false;
    }

    {
        const char *hxver = get_hexrays_version();
        msg("hexrays-python: Hex-rays version %s has been detected\n", hxver);
    }

#ifdef Py_DEBUG
    msg("HexraysPython: Python compiled with DEBUG enabled.\n");
#endif

    // Start the interpreter
    Py_Initialize();

    if ( !Py_IsInitialized() )
    {
        warning("hexrays-python: Py_Initialize() failed");
        return false;
    }

    // Enable multi-threading support
    if ( !PyEval_ThreadsInitialized() )
        PyEval_InitThreads();

    // Init the SWIG wrapper
    init_hexrays();

    // Import hexrays in python the dirty way until we can do better.
    PyRun_SimpleString("import hexrays; from hexrays import *;");

    g_initialized = true;

    return true;
}