diff options
Diffstat (limited to 'examples/print_syscalls/src/arm-syscall.cpp')
| -rw-r--r-- | examples/print_syscalls/src/arm-syscall.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/examples/print_syscalls/src/arm-syscall.cpp b/examples/print_syscalls/src/arm-syscall.cpp index 0623a4a7..c7d3e4b5 100644 --- a/examples/print_syscalls/src/arm-syscall.cpp +++ b/examples/print_syscalls/src/arm-syscall.cpp @@ -44,30 +44,13 @@ int main(int argc, char* argv[]) SetBundledPluginDirectory(GetBundledPluginDirectory()); InitPlugins(); - Ref<BinaryData> bd = BinaryData::CreateFromFilename(new FileMetadata(), argv[1]); - if (!bd) - { - fprintf(stderr, "Could not open input file.\n"); - return -1; - } - Ref<BinaryView> bv; - for (auto type : BinaryViewType::GetViewTypes()) - { - if (type->IsTypeValidForData(bd) && type->GetName() != "Raw") - { - bv = type->Create(bd); - break; - } - } - + Ref<BinaryView> bv = BinaryNinja::Load(fname); if (!bv || bv->GetTypeName() == "Raw") { - fprintf(stderr, "Input file does not appear to be an exectuable\n"); + fprintf(stderr, "Input file does not appear to be an executable\n"); return -1; } - bv->UpdateAnalysisAndWait(); - auto arch = bv->GetDefaultArchitecture(); auto platform = bv->GetDefaultPlatform(); @@ -97,6 +80,9 @@ int main(int argc, char* argv[]) } } + // Close the file so that the resources can be freed + bv->GetFile()->Close(); + // Shutting down is required to allow for clean exit of the core BNShutdown(); |
