Skip to content

Commit

Permalink
fix windows bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
RadWolfie authored and mborgerson committed Nov 10, 2020
1 parent be3192d commit e44a60b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cp $XBSYMBOLDATABASE/XbSymbolDatabaseTool.linux64.Release os/linux64/XbSymbolD
cp $XBSYMBOLDATABASE/LICENSE os/linux64/XbSymbolDatabaseTool.LICENSE
cp $XBSYMBOLDATABASE/XbSymbolDatabaseTool.macos64.Release os/osx64/XbSymbolDatabaseTool
cp $XBSYMBOLDATABASE/LICENSE os/osx64/XbSymbolDatabaseTool.LICENSE
cp $XBSYMBOLDATABASE/XbSymbolDatabaseTool.win64.Release.exe os/win64/XbSymbolDatabaseTool
cp $XBSYMBOLDATABASE/XbSymbolDatabaseTool.win64.Release.exe os/win64/XbSymbolDatabaseTool.exe
cp $XBSYMBOLDATABASE/LICENSE os/win64/XbSymbolDatabaseTool.LICENSE

echo "[*] Building..."
Expand Down
23 changes: 18 additions & 5 deletions src/main/java/XbeLoader/XbeXbSymbolDatabaseAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import ghidra.app.services.AnalyzerType;
import ghidra.app.util.importer.MessageLog;
import ghidra.framework.Application;
import ghidra.framework.Platform;
import ghidra.framework.OperatingSystem;
import ghidra.framework.options.Options;
import ghidra.program.flatapi.FlatProgramAPI;
import ghidra.program.model.address.AddressSetView;
Expand All @@ -46,6 +48,9 @@
* TODO: Provide class-level documentation that describes what this analyzer does.
*/
public class XbeXbSymbolDatabaseAnalyzer extends AbstractAnalyzer {

private static final String xbsdb_tool_exec = "XbSymbolDatabaseTool";
private static final String xbsdb_tool_exec_wins = "XbSymbolDatabaseTool.exe";

public XbeXbSymbolDatabaseAnalyzer() {
super("Xbox Symbol Database Analyzer", "Scan XBE for known library functions", AnalyzerType.BYTE_ANALYZER);
Expand All @@ -71,11 +76,19 @@ public void registerOptions(Options options, Program program) {
public boolean added(Program program, AddressSetView set, TaskMonitor monitor, MessageLog log)
throws CancelledException {
FlatProgramAPI api = new FlatProgramAPI(program, monitor);

String toolExec;
if (Platform.CURRENT_PLATFORM.getOperatingSystem() == OperatingSystem.WINDOWS) {
toolExec = xbsdb_tool_exec_wins;
} else {
toolExec = xbsdb_tool_exec;
}

String toolPath;
try {
toolPath = Application.getOSFile("XbSymbolDatabaseTool").getAbsolutePath();
toolPath = Application.getOSFile(toolExec).getAbsolutePath();
} catch (FileNotFoundException e) {
log.appendMsg("Failed to find XbSymbolDatabase");
log.appendMsg("Failed to find " + toolExec);
return false;
}
String xbePath = program.getExecutablePath();
Expand All @@ -99,13 +112,13 @@ public boolean added(Program program, AddressSetView set, TaskMonitor monitor, M
program.getSymbolTable().createLabel(address, name, getNamespace(program, lib), SourceType.ANALYSIS);
}
} catch (InterruptedException e) {
log.appendMsg("Failed to run XbSymbolDatabaseTool");
log.appendMsg("Failed to run " + toolExec);
return false;
} catch (IOException e) {
log.appendMsg("Failed to run XbSymbolDatabaseTool");
log.appendMsg("Failed to run " + toolExec);
return false;
} catch (InvalidInputException e) {
log.appendMsg("Failed to run XbSymbolDatabaseTool");
log.appendMsg("Failed to run " + toolExec);
return false;
}

Expand Down

0 comments on commit e44a60b

Please sign in to comment.