mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-3013 Refactor of Relocation API (created V6 DB adapter) to include
status and stored length when original FileBytes are used.
This commit is contained in:
@@ -974,42 +974,27 @@ public class DexHeaderFormatMarkup {
|
||||
}
|
||||
|
||||
String string = stringDataItem.getString();
|
||||
DataType stringDataType = stringDataItem.toDataType();
|
||||
api.createData(stringDataAddress, stringDataType);
|
||||
api.setPlateComment(stringDataAddress,
|
||||
Integer.toHexString(index) + "\n" + string.trim());
|
||||
fragmentManager.stringDataAddressSet.add(stringDataAddress,
|
||||
stringDataAddress.add(stringDataType.getLength() - 1));
|
||||
|
||||
try {
|
||||
DataType stringDataType = stringDataItem.toDataType();
|
||||
api.createData(stringDataAddress, stringDataType);
|
||||
api.setPlateComment(stringDataAddress,
|
||||
Integer.toHexString(index) + "\n" + string.trim());
|
||||
fragmentManager.stringDataAddressSet.add(stringDataAddress,
|
||||
stringDataAddress.add(stringDataType.getLength() - 1));
|
||||
|
||||
createStringSymbol(stringDataAddress, string, "strings");
|
||||
}
|
||||
catch (DuplicateNameException e) {
|
||||
log.appendException(e); // Report the exception but keep going
|
||||
}
|
||||
catch (InvalidInputException e) {
|
||||
log.appendException(e);
|
||||
}
|
||||
createStringSymbol(stringDataAddress, string, "strings");
|
||||
|
||||
// markup string Id items
|
||||
DataType dataType = item.toDataType();
|
||||
try {
|
||||
Data data = api.createData(address, dataType);
|
||||
fragmentManager.stringsDataSet.add(address, address.add(dataType.getLength() - 1));
|
||||
|
||||
api.setPlateComment(address, "String Index: 0x" + Integer.toHexString(index) +
|
||||
"\nString: " + string.trim() + "\nString Data Address: " + stringDataAddress);
|
||||
createStringSymbol(address, string, "string_data");
|
||||
Data data = api.createData(address, dataType);
|
||||
fragmentManager.stringsDataSet.add(address, address.add(dataType.getLength() - 1));
|
||||
|
||||
api.setPlateComment(address, "String Index: 0x" + Integer.toHexString(index) +
|
||||
"\nString: " + string.trim() + "\nString Data Address: " + stringDataAddress);
|
||||
createStringSymbol(address, string, "string_data");
|
||||
|
||||
api.createMemoryReference(data, stringDataAddress, RefType.DATA);
|
||||
|
||||
api.createMemoryReference(data, stringDataAddress, RefType.DATA);
|
||||
}
|
||||
catch (DuplicateNameException e) {
|
||||
log.appendException(e); // Report the exception but keep going
|
||||
}
|
||||
catch (InvalidInputException e) {
|
||||
log.appendException(e);
|
||||
}
|
||||
++index;
|
||||
|
||||
address = address.add(dataType.getLength());
|
||||
|
||||
@@ -22,11 +22,8 @@ import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.dwarf4.LEB128;
|
||||
import ghidra.file.formats.android.dex.util.DexUtil;
|
||||
import ghidra.program.model.data.ArrayDataType;
|
||||
import ghidra.program.model.data.CategoryPath;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.Structure;
|
||||
import ghidra.program.model.data.StructureDataType;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
/**
|
||||
@@ -73,11 +70,17 @@ public class StringDataItem implements StructConverter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType toDataType() throws DuplicateNameException, IOException {
|
||||
public DataType toDataType() {
|
||||
Structure structure = new StructureDataType("string_data_item_" + actualLength, 0);
|
||||
structure.add(new ArrayDataType(BYTE, lebLength, BYTE.getLength()), "utf16_size", null);
|
||||
structure.add(UTF8, actualLength, "data", null);
|
||||
structure.setCategoryPath(new CategoryPath("/dex/string_data_item"));
|
||||
try {
|
||||
structure.setCategoryPath(new CategoryPath("/dex/string_data_item"));
|
||||
}
|
||||
catch (DuplicateNameException e) {
|
||||
// will not occur for new StructureDataType
|
||||
throw new AssertException(e);
|
||||
}
|
||||
return structure;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user