Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/Ghidra_12.1'

Ryan Kurtz45e236267c4d
diff --cc Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java
index c26ebc934e,3dfd34dbcb..fa9b2e91a0
--- a/Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/GhidraRun.java
@@@ -105,11 -90,13 +104,13 @@@ public class GhidraRun implements Ghidr
updateSplashScreenStatusMessage("Checking for previous project...");
SystemUtilities.runSwingLater(() -> {
- String projectPath = processArguments(args);
- openProject(projectPath);
-
+ LaunchArguments launchArgs = processArguments(args);
+ openProject(launchArgs);
+
log.info("Ghidra startup complete (" + GhidraLauncher.getMillisecondsFromLaunch() +
" ms)");
+
+ checkForMissingNativeComponents();
});
};
@@@ -295,32 -250,22 +296,48 @@@
}
}
+ private void openDomainFileInTool(Project project, String domainFilePath) {
+ // Ensure path starts with /
+ if (!domainFilePath.startsWith("/")) {
+ domainFilePath = "/" + domainFilePath;
+ }
+
+ ProjectData projectData = project.getProjectData();
+ DomainFile domainFile = projectData.getFile(domainFilePath);
+
+ if (domainFile == null) {
+ Msg.showError(GhidraRun.class, null, "File Not Found",
+ "Could not find file in project: " + domainFilePath);
+ return;
+ }
+
+ log.info("Opening file from command line: " + domainFilePath);
+
+ ToolServices toolServices = project.getToolServices();
+ PluginTool tool = toolServices.launchDefaultTool(List.of(domainFile));
+
+ if (tool == null) {
+ Msg.showError(GhidraRun.class, null, "Tool Launch Failed",
+ "Failed to launch tool for: " + domainFile.getName());
+ }
+ }
+
+ 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
}