summaryrefslogtreecommitdiff
path: root/platform/efi/efi_resolver/src/Plugin.cpp
diff options
context:
space:
mode:
authorZichuan Li <34680029+river-li@users.noreply.github.com>2024-08-15 18:23:43 -0400
committerBrandon Miller <brandon@vector35.com>2025-05-08 07:23:08 -0400
commitf07f66ba03dfeed222f419e1bae274e95cbcd2d4 (patch)
treeac93834d248b5b2af242a9288785106bcecc354f /platform/efi/efi_resolver/src/Plugin.cpp
parent7f08117cfeb48a8f48d08e14cb498ee028efcef2 (diff)
misc: formated code and fixed several small issues
1. Fix code related to SMI handlers 2. also parse handlers registered by SxDispatch and parse them together 3. Set Progress Text properly
Diffstat (limited to 'platform/efi/efi_resolver/src/Plugin.cpp')
-rw-r--r--platform/efi/efi_resolver/src/Plugin.cpp69
1 files changed, 35 insertions, 34 deletions
diff --git a/platform/efi/efi_resolver/src/Plugin.cpp b/platform/efi/efi_resolver/src/Plugin.cpp
index bfa19a7f..b562975c 100644
--- a/platform/efi/efi_resolver/src/Plugin.cpp
+++ b/platform/efi/efi_resolver/src/Plugin.cpp
@@ -5,60 +5,61 @@
using namespace BinaryNinja;
-extern "C" {
+extern "C"
+{
BN_DECLARE_CORE_ABI_VERSION
BINARYNINJAPLUGIN void CorePluginDependencies()
{
- BinaryNinja::AddOptionalPluginDependency("arch_x86");
- BinaryNinja::AddOptionalPluginDependency("arch_armv7");
- BinaryNinja::AddOptionalPluginDependency("arch_arm64");
- BinaryNinja::AddOptionalPluginDependency("platform_efi");
+ BinaryNinja::AddOptionalPluginDependency("arch_x86");
+ BinaryNinja::AddOptionalPluginDependency("arch_armv7");
+ BinaryNinja::AddOptionalPluginDependency("arch_arm64");
+ BinaryNinja::AddOptionalPluginDependency("platform_efi");
}
static Ref<BackgroundTask> efiBackgroundTask = nullptr;
void Run(Ref<BinaryView> view)
{
- efiBackgroundTask = new BackgroundTask("Loading EFI protocol mappings!", true);
- thread resolverThread([view]() {
- LogInfo("Entering new thread");
+ efiBackgroundTask = new BackgroundTask("Loading EFI protocol mappings!", true);
+ thread resolverThread([view]() {
+ LogInfo("Entering new thread");
- LogInfo("Identifying module type");
- EFIModuleType moduleType = identifyModuleType(view);
+ LogInfo("Identifying module type");
+ EFIModuleType moduleType = identifyModuleType(view);
-#ifdef DEBUG
- auto undo = view->BeginUndoActions();
+#ifndef DEBUG
+ auto undo = view->BeginUndoActions();
#endif
- if (moduleType == PEI) {
- efiBackgroundTask->SetProgressText("Resolving PEIM...");
- auto resolver = PeiResolver(view, efiBackgroundTask);
- resolver.resolvePei();
- } else if (moduleType == DXE) {
- efiBackgroundTask->SetProgressText("Resolving DXE protocols...");
- auto resolver = DxeResolver(view, efiBackgroundTask);
- resolver.resolveDxe();
- efiBackgroundTask->SetProgressText("Resolving MM related protocols...");
- resolver.resolveSmm();
- }
+ if (moduleType == PEI)
+ {
+ efiBackgroundTask->SetProgressText("Resolving PEIM...");
+ auto resolver = PeiResolver(view, efiBackgroundTask);
+ resolver.resolvePei();
+ }
+ else if (moduleType == DXE)
+ {
+ efiBackgroundTask->SetProgressText("Resolving DXE protocols...");
+ auto resolver = DxeResolver(view, efiBackgroundTask);
+ resolver.resolveDxe();
+ efiBackgroundTask->SetProgressText("Resolving MM related protocols...");
+ resolver.resolveSmm();
+ }
-#ifdef DEBUG
- resolver.m_view->CommitUndoActions(undo);
+#ifndef DEBUG
+ view->CommitUndoActions(undo);
#endif
- efiBackgroundTask->Finish();
- });
- resolverThread.detach();
+ efiBackgroundTask->Finish();
+ });
+ resolverThread.detach();
}
BINARYNINJAPLUGIN bool CorePluginInit()
{
- EfiGuidRenderer::Register();
+ EfiGuidRenderer::Register();
- PluginCommand::Register(
- "EFI Resolver\\Resolve EFI Types And Protocols",
- "Resolve EFI Protocols",
- &Run);
+ PluginCommand::Register("EFI Resolver\\Resolve EFI Types And Protocols", "Resolve EFI Protocols", &Run);
- return true;
+ return true;
}
}