Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Show a warning if we detect that native components are missing

Ryan Kurtz7e1bf0f9b5d9
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java b/Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java
index b5e1baf93e..3dfd34dbcb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java
@@ -27,8 +27,7 @@ import org.apache.logging.log4j.Logger;
import docking.framework.SplashScreen;
import generic.jar.ResourceFile;
import ghidra.base.help.GhidraHelpService;
-import ghidra.framework.Application;
-import ghidra.framework.GhidraApplicationConfiguration;
+import ghidra.framework.*;
import ghidra.framework.client.RepositoryAdapter;
import ghidra.framework.main.FrontEndTool;
import ghidra.framework.model.*;
@@ -96,6 +95,8 @@ public class GhidraRun implements GhidraLaunchable {
log.info("Ghidra startup complete (" + GhidraLauncher.getMillisecondsFromLaunch() +
" ms)");
+
+ checkForMissingNativeComponents();
});
};
@@ -249,6 +250,22 @@ public class GhidraRun implements GhidraLaunchable {
}
}
+ private void checkForMissingNativeComponents() {
+ boolean isWin = Platform.CURRENT_PLATFORM.getOperatingSystem() == OperatingSystem.WINDOWS;
+
+ try {
+ Application.getOSFile("Decompiler", isWin ? "decompile.exe" : "decompile");
+ }
+ catch (OSFileNotFoundException e) {
+ //@formatter:off
+ String msg =
+ "It appears that native components have not been built for this Ghidra installation.\n" +
+ "See the \"Building Native Components\" section of the Getting Started guide for build instructions.";
+ //@formatter:on
+ Msg.showWarn(GhidraRun.class, null, "Missing Native Components", msg);
+ }
+ }
+
private class GhidraProjectManager extends DefaultProjectManager {
// this exists just to allow access to the constructor
}