diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/AbstractCreateDataBackgroundCmd.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/AbstractCreateDataBackgroundCmd.java index 02b3147e43..51fcdd5ae2 100644 --- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/AbstractCreateDataBackgroundCmd.java +++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/AbstractCreateDataBackgroundCmd.java @@ -167,7 +167,7 @@ public abstract class AbstractCreateDataBackgroundCmdIf you need to create data other than by using the data type returned from getDataType(), * you should override this method. - * @return true if had to create, false otherwise + * @return false if the data type was not created because it already exists, true otherwise * @throws CodeUnitInsertionException if the data can't be created. * @throws CancelledException if the user cancels this task. */ diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java index 55ad6b8b16..89eb5b74a1 100644 --- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java +++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/CreateTypeDescriptorBackgroundCmd.java @@ -21,7 +21,6 @@ import ghidra.program.model.address.Address; import ghidra.program.model.data.*; import ghidra.program.model.listing.*; import ghidra.program.model.util.CodeUnitInsertionException; -import ghidra.util.Msg; import ghidra.util.exception.CancelledException; import ghidra.util.exception.InvalidInputException; @@ -90,13 +89,15 @@ public class CreateTypeDescriptorBackgroundCmd * as its last component ( char[0] name ). The string data associated with this flexible char array will * be applied as a sized character array immediately following the structure whose size does not include * the char array bytes. - * @return true if the data type needed to be created + * @return false if the data type was not created because it already exists, true otherwise * @throws CodeUnitInsertionException * @throws CancelledException */ @Override protected boolean createData() throws CodeUnitInsertionException, CancelledException { - super.createData(); // create the TypeDesciptor structure + if (!super.createData()) { // create the TypeDesciptor structure + return false; + } // Determine the size of the flexible char array storage and create properly sized array DataType dataType = model.getDataType(); @@ -110,12 +111,7 @@ public class CreateTypeDescriptorBackgroundCmd Data nameData = DataUtilities.createData(program, arrayAddr, charArray, charArray.getLength(), false, getClearDataMode()); - if (nameData != null) { - nameData.setComment(CodeUnit.EOL_COMMENT, "TypeDescriptor.name"); - } - else { - Msg.error(this, "Failed to create TypeDescriptor name at " + arrayAddr); - } + nameData.setComment(CodeUnit.EOL_COMMENT, "TypeDescriptor.name"); return true; }