diff options
Diffstat (limited to 'examples/mlil_parser/src/mlil_parser.cpp')
| -rw-r--r-- | examples/mlil_parser/src/mlil_parser.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/examples/mlil_parser/src/mlil_parser.cpp b/examples/mlil_parser/src/mlil_parser.cpp index ae0a0df3..66dcd45e 100644 --- a/examples/mlil_parser/src/mlil_parser.cpp +++ b/examples/mlil_parser/src/mlil_parser.cpp @@ -243,30 +243,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(argv[1]); 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(); - // Go through all functions in the binary for (auto& func : bv->GetAnalysisFunctionList()) { @@ -342,6 +325,9 @@ int main(int argc, char* argv[]) printf("\n"); } + // 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(); |
