diff --git a/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm b/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm
index defc2b3767..7101d52a49 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/AutoAnalysisPlugin/AutoAnalysis.htm
@@ -392,6 +392,8 @@
Demangler Analyzer
+ Demangler GNU or Demangeler Microsoft
+
This analyzer examines the name of the newly created function. If the name appears to be
a GCC v3 or Microsoft Visual Studio mangled symbol, then it will demangle the
@@ -577,25 +579,14 @@
Started By: Importing or adding to a program, Auto Analyze command
- Format String Analyzer
+
+
+ Embedded Media Analyzer
- This analyzer detects variadic function calls in the bodies of each function that intersect
- the current selection. It then parses their format string arguments to infer the correct function
- call signatures. Currently, this analyzer only supports printf, scanf, and their variants (e.g., snprintf, fscanf).
- If the current selection is empty, it searches through every function within the binary. Once
- the signatures are inferred, they are overridden.
-
- Started By: Importing or adding to a program, Auto Analyze command
-
-
-
- Image Analyzer
-
-
- This analyzer searches the program for images. If a valid image is found an appropriate
- image data type is applied at that location with the corresponding visual representation of
- the image. Also, a bookmark is added to indicate an image.
+ Finds embedded media data types (e.g., png, gif, jpeg, wav). If a valid image is found an
+ appropriate image data type is applied at that location with the corresponding visual
+ representation of image. Also, a bookmark is added to indicate an image.
Started By: Importing or adding to a program, Auto Analyze command
@@ -727,6 +718,22 @@
Started By: Auto Analyze command
+
+ Format String Analyzer
+ (Variadic Function Signature Override)
+
+
+ This analyzer detects variadic function calls in the bodies of each function that intersect
+ the current selection. It then parses their format string arguments to infer the correct function
+ call signatures. Currently, this analyzer only supports printf, scanf, and their variants (e.g., snprintf, fscanf).
+ If the current selection is empty, it searches through every function within the binary. Once
+ the signatures are inferred, they are overridden.
+
+ Started By: Importing or adding to a program, Auto Analyze command
+
+
+
+
Provided by: AutoAnalysisPlugin
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/EmbeddedMediaAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/EmbeddedMediaAnalyzer.java
index 334acc3a1f..8ae2a5233a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/EmbeddedMediaAnalyzer.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/EmbeddedMediaAnalyzer.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,11 +35,12 @@ import ghidra.util.task.TaskMonitor;
public class EmbeddedMediaAnalyzer extends AbstractAnalyzer {
private static final String NAME = "Embedded Media";
private static final String DESCRIPTION =
- "Finds embedded media data types (ie png, gif, jpeg, wav)";
+ "Finds embedded media data types (e.g., png, gif, jpeg, wav)";
private static final String OPTION_NAME_CREATE_BOOKMARKS = "Create Analysis Bookmarks";
private static final String OPTION_DESCRIPTION_CREATE_BOOKMARKS =
- "If checked, an analysis bookmark will be created at each location where embedded media data is identified.";
+ "If checked, an analysis bookmark will be created at each location where embedded media " +
+ "data is identified.";
private static final boolean OPTION_DEFAULT_CREATE_BOOKMARKS_ENABLED = true;
private boolean createBookmarksEnabled = OPTION_DEFAULT_CREATE_BOOKMARKS_ENABLED;
@@ -101,14 +102,16 @@ public class EmbeddedMediaAnalyzer extends AbstractAnalyzer {
private void addByteSearchPattern(MemoryBytePatternSearcher searcher, Program program,
List
foundMedia, DataType mediaDT, String mediaName, byte[] bytes,
byte[] mask) {
+
if (bytes == null) {
return;
}
GenericMatchAction action = new GenericMatchAction(mediaDT) {
+
@Override
- public void apply(Program prog, Address addr, Match match) {
- //See if it is already an applied media data type
+ public void apply(Program prog, Address addr, Match match) {
+ // See if it is already an applied media data type
if (!program.getListing().isUndefined(addr, addr)) {
return;
}
@@ -117,23 +120,26 @@ public class EmbeddedMediaAnalyzer extends AbstractAnalyzer {
CreateDataCmd cmd = new CreateDataCmd(addr, mediaDT);
if (cmd.applyTo(program)) {
if (createBookmarksEnabled) {
- program.getBookmarkManager().setBookmark(addr, BookmarkType.ANALYSIS,
- "Embedded Media", "Found " + mediaName + " Embedded Media");
+ program.getBookmarkManager()
+ .setBookmark(addr, BookmarkType.ANALYSIS,
+ "Embedded Media", "Found " + mediaName + " Embedded Media");
}
foundMedia.add(addr);
}
+
+ // If media does not apply correctly then it is not really that media data type
+ // or there is other data in the way.
}
- //If media does not apply correctly then it is not really a that media data type or there is other data in the way
catch (Exception e) {
- // Not a valid embedded media or no room to apply it so just ignore it and skip it
+ // Not a valid embedded media or no room to apply it so just ignore it and skip
+
}
}
};
- GenericByteSequencePattern genericByteMatchPattern =
- new GenericByteSequencePattern(bytes, mask, action);
-
- searcher.addPattern(genericByteMatchPattern);
+ GenericByteSequencePattern pattern =
+ new GenericByteSequencePattern<>(bytes, mask, action);
+ searcher.addPattern(pattern);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/DummyMatchAction.java b/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/DummyMatchAction.java
index e8e58e4c37..f49b5ce1ac 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/DummyMatchAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/DummyMatchAction.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,8 @@ import ghidra.xml.XmlPullParser;
public class DummyMatchAction implements MatchAction {
@Override
- public void apply(Program program, Address addr, Match match) {
+ public void apply(Program program, Address addr, Match match) {
+ // stub
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/GenericMatchAction.java b/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/GenericMatchAction.java
index 3b337c6fed..6ab762067a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/GenericMatchAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/GenericMatchAction.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@ package ghidra.util.bytesearch;
* The associated value can be retrieved when the sequence is matched.
*
* @param - object to attach to match sequence, generally used to specify
- * a specialized momento to be used by the action when it is "applied".
+ * a specialized memento to be used by the action when it is "applied".
*/
public class GenericMatchAction extends DummyMatchAction {
T matchValue;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/MatchAction.java b/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/MatchAction.java
index 94d43bcec5..e69d724d61 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/MatchAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/util/bytesearch/MatchAction.java
@@ -20,14 +20,14 @@ import ghidra.program.model.listing.Program;
import ghidra.xml.XmlPullParser;
/**
- * Interface for a match action to be taken for the Program@Address for a ditted bit seqence pattern
+ * Interface for a match action to be taken for the Program@Address for a ditted bit sequence pattern
*/
public interface MatchAction {
/**
* Apply the match action to the program at the address.
*
* @param program program in which the match occurred
- * @param addr where the match occured
+ * @param addr where the match occurred
* @param match information about the match that occurred
*/
public void apply(Program program, Address addr, Match match);
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java b/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java
index d4ffc93dc3..a3c87507f8 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/help/HelpManager.java
@@ -102,6 +102,11 @@ public class HelpManager implements HelpService {
Help.installHelpService(this);
}
+ @Override
+ public boolean isShowing() {
+ return mainHB.isDisplayed();
+ }
+
@Override
public boolean helpExists() {
return isValidHelp && hasMergedHelpSets;
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/help/HelpViewSearcher.java b/Ghidra/Framework/Docking/src/main/java/docking/help/HelpViewSearcher.java
index 77196d8968..09e2962dd0 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/help/HelpViewSearcher.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/help/HelpViewSearcher.java
@@ -39,6 +39,8 @@ import generic.util.WindowUtilities;
import ghidra.util.exception.AssertException;
import ghidra.util.task.TaskMonitor;
import ghidra.util.worker.Worker;
+import help.Help;
+import help.HelpService;
/**
* Enables the Find Dialog for searching through the current page of a help document.
@@ -273,6 +275,12 @@ class HelpViewSearcher {
@Override
public void activate() {
+
+ HelpService help = Help.getHelpService();
+ if (!help.isShowing()) {
+ help.showHelp(searchUrl);
+ }
+
//
// When we activate, a new page load may get triggered. When that happens the caret
// position will get moved by the help viewer. We will put back the last active search
diff --git a/Ghidra/Framework/Help/src/main/java/docking/DefaultHelpService.java b/Ghidra/Framework/Help/src/main/java/docking/DefaultHelpService.java
index 993d23009d..846301e6e0 100644
--- a/Ghidra/Framework/Help/src/main/java/docking/DefaultHelpService.java
+++ b/Ghidra/Framework/Help/src/main/java/docking/DefaultHelpService.java
@@ -33,6 +33,11 @@ public class DefaultHelpService implements HelpService {
}
}
+ @Override
+ public boolean isShowing() {
+ return false;
+ }
+
@Override
public void showHelp(java.net.URL url) {
// no-op
diff --git a/Ghidra/Framework/Help/src/main/java/help/HelpService.java b/Ghidra/Framework/Help/src/main/java/help/HelpService.java
index d6aff75c31..64af48df5e 100644
--- a/Ghidra/Framework/Help/src/main/java/help/HelpService.java
+++ b/Ghidra/Framework/Help/src/main/java/help/HelpService.java
@@ -28,6 +28,11 @@ public interface HelpService {
public static final String DUMMY_HELP_SET_NAME = "Dummy_HelpSet.hs";
+ /**
+ * {@return true if the main help window is showing}
+ */
+ public boolean isShowing();
+
/**
* Display the Help content identified by the help object.
*