Skip to content
Open
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "binexport"]
path = binexport
url = https://github.com/google/binexport.git
url = https://github.com/abd3lraouf-studios/binexport-ghidra-12.git
2 changes: 1 addition & 1 deletion binexport
Submodule binexport updated 108 files
15 changes: 9 additions & 6 deletions src/main/java/bindiffhelper/BinDiffHelperPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ public BinDiffHelperPlugin(PluginTool tool) {

}

if (System.getProperty("os.name").toLowerCase().contains("win")) {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
defaultBinPath = "C:\\Program Files\\BinDiff\\bin\\bindiff.exe";
defaultDiffCommand = "notepad++ -multiInst -nosession -lc -pluginMessage=compare \"$file1\" \"$file2\"";
}
if (System.getProperty("os.name").toLowerCase().contains("nix")) {
// defaultBinPath = "/opt/bindiff/bin/bindiff";
defaultDiffCommand = "x-terminal-emulator -e 'diff -u \"$file1\" \"$file2\"'";
} else if (os.contains("mac")) {
defaultBinPath = "/Applications/BinDiff/BinDiff.app/Contents/MacOS/bin/bindiff";
defaultDiffCommand = "opendiff \"$file1\" \"$file2\"";
} else { // Linux/BSD
defaultBinPath = "/opt/bindiff/bin/bindiff";
defaultDiffCommand = "meld \"$file1\" \"$file2\"";
}

binDiffBinary = Preferences.getProperty(BDBINPROPERTY, defaultBinPath);
Expand Down Expand Up @@ -311,7 +314,7 @@ public void updateEnableNamespace(boolean enable)

public void updateDiffCommand(String cmd)
{
diffCommand = cmd == null || cmd.isEmpty() ? defaultDiffCommand : cmd;
diffCommand = cmd == null || cmd.isBlank() ? defaultDiffCommand : cmd;
Preferences.setProperty(DIFFCOMMAND, cmd);
}

Expand Down
9 changes: 8 additions & 1 deletion src/main/java/bindiffhelper/BinDiffHelperProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,14 @@ public void mousePressed(MouseEvent e) {

String command = plugin.diffCommand.replace("$file1", path1.toString()).replace("$file2",
path2.toString());
Runtime.getRuntime().exec(command);

if (System.getProperty("os.name").toLowerCase().contains("win")) {
String[] shellCommand = { "cmd.exe", "/c", command };
Runtime.getRuntime().exec(shellCommand);
} else {
String[] shellCommand = { "/bin/sh", "-c", command };
Runtime.getRuntime().exec(shellCommand);
}
} catch (Exception ex) {
Msg.showError(this, getComponent(), "Error", ex.getMessage());
}
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/bindiffhelper/DiffWizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,13 @@ public boolean isValid() {
if (tp == null || tp.getSelectedItemCount() != 1)
return false;

if (tp.getSelectedDomainFolder() != null)
return false;

var df = tp.getSelectedDomainFile();
return df != null;
}

@Override
public boolean canFinish(DiffWizardData data) {
// TODO Auto-generated method stub
return false;
return isValid();
}

@Override
Expand Down Expand Up @@ -408,28 +404,31 @@ public void initialize(DiffWizardData data) {
this.panel.add(cb);
this.panel.add(tp);

cb.addActionListener(e -> notifyStatusChanged());
tp.addTreeSelectionListener(new GTreeSelectionListener() {
@Override
public void valueChanged(GTreeSelectionEvent e) {
notifyStatusChanged();
}
});
}


@Override
public boolean isValid() {
if (!cb.isSelected())
if (cb == null || !cb.isSelected())
return true;

if (tp == null || tp.getSelectedItemCount() != 1)
return false;

if (tp.getSelectedDomainFolder() != null)
return false;

var df = tp.getSelectedDomainFile();
return df != null;
}

@Override
public boolean canFinish(DiffWizardData data) {
// TODO Auto-generated method stub
return false;
return isValid();
}

@Override
Expand All @@ -439,7 +438,7 @@ public void populateData(DiffWizardData data) {

@Override
public boolean apply(DiffWizardData data) {
if (cb.isSelected()) {
if (data.useProgram2) {
try {
data.program2Df = tp.getSelectedDomainFile();
Tool newTool = plugin.getTool().getToolServices().launchDefaultTool(Collections.singletonList(data.program2Df));
Expand All @@ -458,7 +457,7 @@ public boolean apply(DiffWizardData data) {
public JComponent getComponent() {
return this.panel;
}

@Override
public boolean isApplicable(DiffWizardData data) {
return !data.isFromProject;
Expand Down
Loading