summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.cpp6
-rw-r--r--binaryninjaapi.h5
-rw-r--r--binaryninjacore.h5
-rw-r--r--examples/bin-info/src/bin-info.cpp3
-rw-r--r--examples/cmdline_disasm/src/disasm.cpp2
-rw-r--r--examples/llil_parser/src/llil_parser.cpp3
-rw-r--r--examples/mlil_parser/src/mlil_parser.cpp3
-rw-r--r--examples/print_syscalls/src/arm-syscall.cpp3
-rw-r--r--python/__init__.py5
9 files changed, 19 insertions, 16 deletions
diff --git a/binaryninjaapi.cpp b/binaryninjaapi.cpp
index 59c554b0..a789cdcd 100644
--- a/binaryninjaapi.cpp
+++ b/binaryninjaapi.cpp
@@ -42,6 +42,12 @@ bool BinaryNinja::IsPluginsEnabled()
}
+bool BinaryNinja::InitPlugins(bool allowUserPlugins)
+{
+ return BNInitPlugins(allowUserPlugins);
+}
+
+
void BinaryNinja::InitCorePlugins()
{
BNInitCorePlugins();
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 930bfe4e..96500934 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -659,8 +659,9 @@ __attribute__ ((format (printf, 1, 2)))
void DisablePlugins();
bool IsPluginsEnabled();
- void InitCorePlugins();
- void InitUserPlugins();
+ bool InitPlugins(bool allowUserPlugins = true);
+ void InitCorePlugins(); // Deprecated, use InitPlugins
+ void InitUserPlugins(); // Deprecated, use InitPlugins
void InitRepoPlugins();
std::string GetBundledPluginDirectory();
diff --git a/binaryninjacore.h b/binaryninjacore.h
index dfd78fad..189a3ea2 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2448,10 +2448,11 @@ extern "C"
BINARYNINJACOREAPI char* BNGetUniqueIdentifierString(void);
// Plugin initialization
- BINARYNINJACOREAPI bool BNInitCorePlugins(void);
+ BINARYNINJACOREAPI bool BNInitPlugins(bool allowUserPlugins);
+ BINARYNINJACOREAPI bool BNInitCorePlugins(void); // Deprecated, use BNInitPlugins
BINARYNINJACOREAPI void BNDisablePlugins(void);
BINARYNINJACOREAPI bool BNIsPluginsEnabled(void);
- BINARYNINJACOREAPI void BNInitUserPlugins(void);
+ BINARYNINJACOREAPI void BNInitUserPlugins(void); // Deprecated, use BNInitPlugins
BINARYNINJACOREAPI void BNInitRepoPlugins(void);
BINARYNINJACOREAPI char* BNGetInstallDirectory(void);
diff --git a/examples/bin-info/src/bin-info.cpp b/examples/bin-info/src/bin-info.cpp
index c56f07f7..33f84f7d 100644
--- a/examples/bin-info/src/bin-info.cpp
+++ b/examples/bin-info/src/bin-info.cpp
@@ -62,8 +62,7 @@ int main(int argc, char *argv[])
* libbinaryninjacore is in the path get the path to it and use it to
* determine the plugins directory */
SetBundledPluginDirectory(get_plugins_directory());
- InitCorePlugins();
- InitUserPlugins();
+ InitPlugins();
Ref<BinaryData> bd = new BinaryData(new FileMetadata(), argv[1]);
Ref<BinaryView> bv;
diff --git a/examples/cmdline_disasm/src/disasm.cpp b/examples/cmdline_disasm/src/disasm.cpp
index e0790300..6d350526 100644
--- a/examples/cmdline_disasm/src/disasm.cpp
+++ b/examples/cmdline_disasm/src/disasm.cpp
@@ -58,7 +58,7 @@ int main(int ac, char **av)
path_bundled_plugins = BNGetBundledPluginDirectory();
printf("using bundled plugin path: %s\n", path_bundled_plugins);
BNSetBundledPluginDirectory(path_bundled_plugins);
- BNInitCorePlugins();
+ BNInitPlugins(true);
/* parse architecture argument */
if(ac < 2)
diff --git a/examples/llil_parser/src/llil_parser.cpp b/examples/llil_parser/src/llil_parser.cpp
index db9652bd..8df89558 100644
--- a/examples/llil_parser/src/llil_parser.cpp
+++ b/examples/llil_parser/src/llil_parser.cpp
@@ -313,8 +313,7 @@ int main(int argc, char *argv[])
// libbinaryninjacore is in the path get the path to it and use it to
// determine the plugins directory
SetBundledPluginDirectory(GetPluginsDirectory());
- InitCorePlugins();
- InitUserPlugins();
+ InitPlugins();
Ref<BinaryData> bd = new BinaryData(new FileMetadata(), argv[1]);
Ref<BinaryView> bv;
diff --git a/examples/mlil_parser/src/mlil_parser.cpp b/examples/mlil_parser/src/mlil_parser.cpp
index 3d0101b5..1a347dc3 100644
--- a/examples/mlil_parser/src/mlil_parser.cpp
+++ b/examples/mlil_parser/src/mlil_parser.cpp
@@ -261,8 +261,7 @@ int main(int argc, char *argv[])
// libbinaryninjacore is in the path get the path to it and use it to
// determine the plugins directory
SetBundledPluginDirectory(GetPluginsDirectory());
- InitCorePlugins();
- InitUserPlugins();
+ InitPlugins();
Ref<BinaryData> bd = new BinaryData(new FileMetadata(), argv[1]);
Ref<BinaryView> bv;
diff --git a/examples/print_syscalls/src/arm-syscall.cpp b/examples/print_syscalls/src/arm-syscall.cpp
index 4a61d3c2..e291f30a 100644
--- a/examples/print_syscalls/src/arm-syscall.cpp
+++ b/examples/print_syscalls/src/arm-syscall.cpp
@@ -61,8 +61,7 @@ int main(int argc, char *argv[])
* libbinaryninjacore is in the path get the path to it and use it to
* determine the plugins directory */
SetBundledPluginDirectory(get_plugins_directory());
- InitCorePlugins();
- InitUserPlugins();
+ InitPlugins();
Ref<BinaryData> bd = new BinaryData(new FileMetadata(), argv[1]);
Ref<BinaryView> bv;
diff --git a/python/__init__.py b/python/__init__.py
index ebde1769..167fedc7 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -166,12 +166,11 @@ def _init_plugins():
global _plugin_init
if not _plugin_init:
# The first call to BNInitCorePlugins returns True for successful initialization and True in this context indicates headless operation.
- is_headless = core.BNInitCorePlugins()
+ is_headless = not core.BNIsUIEnabled()
min_level = Settings().get_string("python.log.minLevel")
if _enable_default_log and is_headless and min_level in LogLevel.__members__ and not core_ui_enabled() and sys.stderr.isatty():
log_to_stderr(LogLevel[min_level])
- if not os.environ.get('BN_DISABLE_USER_PLUGINS'):
- core.BNInitUserPlugins()
+ core.BNInitPlugins(not os.environ.get('BN_DISABLE_USER_PLUGINS'))
core.BNInitRepoPlugins()
if core.BNIsLicenseValidated():
_plugin_init = True