directoryMap;
- static ResourceDataDirectory createResourceDataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
- ResourceDataDirectory resourceDataDirectory =
- (ResourceDataDirectory) reader.getFactory().create(ResourceDataDirectory.class);
- resourceDataDirectory.initResourceDataDirectory(ntHeader, reader);
- return resourceDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ResourceDataDirectory() {
- }
-
- private void initResourceDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
+ ResourceDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
directoryMap = new HashSet<>();
processDataDirectory(ntHeader, reader);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/RichHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/RichHeader.java
index b573add8e8..6fe847e5fc 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/RichHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/RichHeader.java
@@ -18,8 +18,8 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import java.io.RandomAccessFile;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.Writeable;
import ghidra.app.util.bin.format.pe.rich.RichHeaderRecord;
import ghidra.program.model.data.DataType;
@@ -35,33 +35,17 @@ public class RichHeader implements StructConverter, Writeable {
public final static int IMAGE_DANS_SIGNATURE = 0x536E6144; // DanS
public final static String NAME = "IMAGE_RICH_HEADER";
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private RichTable table;
/**
- * Create and returns the Rich header found from the given reader. The reader should be
+ * Creates the Rich header found from the given reader. The reader should be
* positioned directly after the DOS header.
*
* @param reader The reader to read the PE with.
- * @return The Rich header associated with the given reader.
*/
- public static RichHeader createRichHeader(FactoryBundledWithBinaryReader reader) {
- RichHeader richHeader = (RichHeader) reader.getFactory().create(RichHeader.class);
- richHeader.initRichHeader(reader);
- return richHeader;
- }
-
- /**
- * Do not directly call this constructor.
- *
- * Use {@link #createRichHeader(FactoryBundledWithBinaryReader)}
- */
- public RichHeader() {
- // Constructor needs to exist, but shouldn't do anything.
- }
-
- private void initRichHeader(FactoryBundledWithBinaryReader binaryReader) {
- this.reader = binaryReader;
+ public RichHeader(BinaryReader reader) {
+ this.reader = reader;
parse();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityCertificate.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityCertificate.java
index 6f5d9055fe..d16131dc8a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityCertificate.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityCertificate.java
@@ -108,11 +108,6 @@ public class SecurityCertificate implements StructConverter {
return result;
}
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SecurityCertificate() {}
-
int getNumberOfBytesConsumed() {
return (int) NumericUtilities.getUnsignedAlignedValue(dwLength, 8);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityDataDirectory.java
index 73d521be0a..5ac8cf65bc 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SecurityDataDirectory.java
@@ -20,8 +20,8 @@ import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.List;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.ByteArrayConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSpace;
@@ -40,20 +40,7 @@ public class SecurityDataDirectory extends DataDirectory implements ByteArrayCon
private SecurityCertificate [] certificates;
- static SecurityDataDirectory createSecurityDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- SecurityDataDirectory securityDataDirectory = (SecurityDataDirectory) reader.getFactory().create(SecurityDataDirectory.class);
- securityDataDirectory.initSecurityDataDirectory(ntHeader, reader);
- return securityDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SecurityDataDirectory() {}
-
- private void initSecurityDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ SecurityDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
if (certificates == null) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SeparateDebugHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SeparateDebugHeader.java
index f8f80d0702..9ddd6695e5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SeparateDebugHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/SeparateDebugHeader.java
@@ -19,9 +19,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import generic.continues.GenericFactory;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.ByteProvider;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.pe.debug.DebugDirectoryParser;
import ghidra.util.Conv;
import ghidra.util.Msg;
@@ -80,9 +79,8 @@ public class SeparateDebugHeader implements OffsetValidator {
* @param bp the byte provider
* @throws IOException if an I/O error occurs.
*/
- public SeparateDebugHeader(GenericFactory factory, ByteProvider bp) throws IOException {
- FactoryBundledWithBinaryReader reader =
- new FactoryBundledWithBinaryReader(factory, bp, true);
+ public SeparateDebugHeader(ByteProvider bp) throws IOException {
+ BinaryReader reader = new BinaryReader(bp, true);
reader.setPointerIndex(0);
@@ -133,8 +131,7 @@ public class SeparateDebugHeader implements OffsetValidator {
ptr += exportedNamesSize;
- parser =
- DebugDirectoryParser.createDebugDirectoryParser(reader, ptr, debugDirectorySize, this);
+ parser = new DebugDirectoryParser(reader, ptr, debugDirectorySize, this);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDataDirectory.java
index 9a13b20567..7a9c92de3d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDataDirectory.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSpace;
@@ -38,21 +38,9 @@ public class TLSDataDirectory extends DataDirectory {
private TLSDirectory tls;
- static TLSDataDirectory createTLSDataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
- TLSDataDirectory tlsDataDirectory = (TLSDataDirectory) reader.getFactory().create(TLSDataDirectory.class);
- tlsDataDirectory.initTLSDataDirectory(ntHeader, reader);
- return tlsDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public TLSDataDirectory() {}
-
- private void initTLSDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ TLSDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+ }
/**
* Returns the thread local storage directory.
@@ -113,7 +101,7 @@ public class TLSDataDirectory extends DataDirectory {
return false;
}
- tls = TLSDirectory.createTLSDirectory(reader, ptr, ntHeader.getOptionalHeader().is64bit());
+ tls = new TLSDirectory(reader, ptr, ntHeader.getOptionalHeader().is64bit());
return true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDirectory.java
index 6e69bc9c37..c315c4bfd5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/TLSDirectory.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.Conv;
import ghidra.util.Msg;
@@ -64,36 +63,33 @@ public class TLSDirectory implements StructConverter {
private int sizeOfZeroFill;
private int characteristics;
- static TLSDirectory createTLSDirectory(
- FactoryBundledWithBinaryReader reader, int index, boolean is64bit)
- throws IOException {
- TLSDirectory tlsDirectory = (TLSDirectory) reader.getFactory().create(TLSDirectory.class);
- tlsDirectory.initTLSDirectory(reader, index, is64bit);
- return tlsDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public TLSDirectory() {}
-
- private void initTLSDirectory(FactoryBundledWithBinaryReader reader, int index, boolean is64bit) throws IOException {
- this.is64bit = is64bit;
- if (is64bit) {
- startAddressOfRawData = reader.readLong(index); index += BinaryReader.SIZEOF_LONG;
- endAddressOfRawData = reader.readLong(index); index += BinaryReader.SIZEOF_LONG;
- addressOfIndex = reader.readLong(index); index += BinaryReader.SIZEOF_LONG;
- addressOfCallBacks = reader.readLong(index); index += BinaryReader.SIZEOF_LONG;
- }
- else {
- startAddressOfRawData = reader.readInt(index) & Conv.INT_MASK; index += BinaryReader.SIZEOF_INT;
- endAddressOfRawData = reader.readInt(index) & Conv.INT_MASK; index += BinaryReader.SIZEOF_INT;
- addressOfIndex = reader.readInt(index) & Conv.INT_MASK; index += BinaryReader.SIZEOF_INT;
- addressOfCallBacks = reader.readInt(index) & Conv.INT_MASK; index += BinaryReader.SIZEOF_INT;
- }
- Msg.info(this, "TLS callbacks at "+Long.toHexString(addressOfCallBacks));
- sizeOfZeroFill = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- characteristics = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
+ TLSDirectory(BinaryReader reader, int index, boolean is64bit) throws IOException {
+ this.is64bit = is64bit;
+ if (is64bit) {
+ startAddressOfRawData = reader.readLong(index);
+ index += BinaryReader.SIZEOF_LONG;
+ endAddressOfRawData = reader.readLong(index);
+ index += BinaryReader.SIZEOF_LONG;
+ addressOfIndex = reader.readLong(index);
+ index += BinaryReader.SIZEOF_LONG;
+ addressOfCallBacks = reader.readLong(index);
+ index += BinaryReader.SIZEOF_LONG;
+ }
+ else {
+ startAddressOfRawData = reader.readInt(index) & Conv.INT_MASK;
+ index += BinaryReader.SIZEOF_INT;
+ endAddressOfRawData = reader.readInt(index) & Conv.INT_MASK;
+ index += BinaryReader.SIZEOF_INT;
+ addressOfIndex = reader.readInt(index) & Conv.INT_MASK;
+ index += BinaryReader.SIZEOF_INT;
+ addressOfCallBacks = reader.readInt(index) & Conv.INT_MASK;
+ index += BinaryReader.SIZEOF_INT;
+ }
+ Msg.info(this, "TLS callbacks at " + Long.toHexString(addressOfCallBacks));
+ sizeOfZeroFill = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ characteristics = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ThunkData.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ThunkData.java
index efd1187238..c384d43c59 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ThunkData.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ThunkData.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +15,14 @@
*/
package ghidra.app.util.bin.format.pe;
-import ghidra.app.util.bin.ByteArrayConverter;
-import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import java.io.IOException;
+
+import ghidra.app.util.bin.*;
import ghidra.program.model.data.*;
import ghidra.util.Conv;
import ghidra.util.DataConverter;
import ghidra.util.exception.DuplicateNameException;
-import java.io.IOException;
-
/**
* A class to represent the
* IMAGE_THUNK_DATA32 struct
@@ -63,21 +60,7 @@ public class ThunkData implements StructConverter, ByteArrayConverter {
private long value;
private ImportByName ibn;
- static ThunkData createThunkData(FactoryBundledWithBinaryReader reader, int index,
- boolean is64bit) throws IOException {
- ThunkData thunkData = (ThunkData) reader.getFactory().create(ThunkData.class);
- thunkData.initThunkData(reader, index, is64bit);
- return thunkData;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThunkData() {
- }
-
- private void initThunkData(FactoryBundledWithBinaryReader reader, int index, boolean is64bit)
- throws IOException {
+ ThunkData(BinaryReader reader, int index, boolean is64bit) throws IOException {
this.is64bit = is64bit;
if (is64bit) {
value = reader.readLong(index);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataDirectory.java
index 3893b3d511..4714d41d8f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/CliMetadataDirectory.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.pe.cli;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.pe.*;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.Address;
@@ -37,22 +37,7 @@ public class CliMetadataDirectory extends DataDirectory {
private CliMetadataRoot metadataRoot;
- public static CliMetadataDirectory createCliMetadataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
- CliMetadataDirectory cliMetadataDirectory =
- (CliMetadataDirectory) reader.getFactory().create(CliMetadataDirectory.class);
- cliMetadataDirectory.initCliMetadataDirectory(ntHeader, reader);
- return cliMetadataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public CliMetadataDirectory() {
- }
-
- private void initCliMetadataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
+ public CliMetadataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
this.ntHeader = ntHeader;
this.reader = reader;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32.java
index 8bfc48e940..d96e59e7a0 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -39,20 +37,8 @@ class DataSym32 extends DebugSymbol {
private short typeIndex;
private byte nameChar;
- static DataSym32 createDataSym32(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- DataSym32 dataSym32 = (DataSym32) reader.getFactory().create(DataSym32.class);
- dataSym32.initDataSym32(length, type, reader, ptr);
- return dataSym32;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DataSym32() {}
-
- private void initDataSym32(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- processDebugSymbol(length, type);
+ DataSym32(short length, short type, BinaryReader reader, int ptr) throws IOException {
+ processDebugSymbol(length, type);
this.offset = reader.readInt (ptr); ptr += BinaryReader.SIZEOF_INT;
this.section = reader.readShort(ptr); ptr += BinaryReader.SIZEOF_SHORT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32_new.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32_new.java
index de5424d047..1acbca4b4b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32_new.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DataSym32_new.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
*
@@ -40,20 +38,8 @@ class DataSym32_new extends DebugSymbol {
private int typeIndex;
private byte nameChar;
- static DataSym32_new createDataSym32_new(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- DataSym32_new dataSym32_new = (DataSym32_new) reader.getFactory().create(DataSym32_new.class);
- dataSym32_new.initDataSym32_new(length, type, reader, ptr);
- return dataSym32_new;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DataSym32_new() {}
-
- private void initDataSym32_new(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- processDebugSymbol(length, type);
+ DataSym32_new(short length, short type, BinaryReader reader, int ptr) throws IOException {
+ processDebugSymbol(length, type);
this.typeIndex = reader.readInt (ptr); ptr += BinaryReader.SIZEOF_INT;
this.offset = reader.readInt (ptr); ptr += BinaryReader.SIZEOF_INT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFLineNumber.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFLineNumber.java
index 3802f65d35..c66138f41a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFLineNumber.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFLineNumber.java
@@ -18,7 +18,6 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
import ghidra.app.util.bin.BinaryReader;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.util.Conv;
/**
@@ -44,20 +43,7 @@ public class DebugCOFFLineNumber {
private int virtualAddress;
private int lineNumber;
- public static DebugCOFFLineNumber createDebugCOFFLineNumber(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- DebugCOFFLineNumber debugCOFFLineNumber = (DebugCOFFLineNumber) reader.getFactory().create(DebugCOFFLineNumber.class);
- debugCOFFLineNumber.initDebugCOFFLineNumber(reader, index);
- return debugCOFFLineNumber;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCOFFLineNumber() {}
-
- private void initDebugCOFFLineNumber(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ public DebugCOFFLineNumber(BinaryReader reader, int index) throws IOException {
symbolTableIndex = reader.readInt(index);
virtualAddress = reader.readInt(index);
index += BinaryReader.SIZEOF_INT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbol.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbol.java
index 8af28f604a..c7f58b52be 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbol.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbol.java
@@ -18,7 +18,6 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.Conv;
import ghidra.util.exception.DuplicateNameException;
@@ -129,27 +128,13 @@ public class DebugCOFFSymbol implements StructConverter {
private byte numberOfAuxSymbols;
private DebugCOFFSymbolAux [] auxSymbols;
- public static DebugCOFFSymbol createDebugCOFFSymbol(
- FactoryBundledWithBinaryReader reader, int index,
- DebugCOFFSymbolTable symbolTable) throws IOException {
- return createDebugCOFFSymbol(reader, index, symbolTable.getStringTableIndex());
+ public DebugCOFFSymbol(BinaryReader reader, int index, DebugCOFFSymbolTable symbolTable)
+ throws IOException {
+ this(reader, index, symbolTable.getStringTableIndex());
}
- public static DebugCOFFSymbol createDebugCOFFSymbol(FactoryBundledWithBinaryReader reader,
- int index, long stringTableIndex) throws IOException {
- DebugCOFFSymbol debugCOFFSymbol =
- (DebugCOFFSymbol) reader.getFactory().create(DebugCOFFSymbol.class);
- debugCOFFSymbol.initDebugCOFFSymbol(reader, index, stringTableIndex);
- return debugCOFFSymbol;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCOFFSymbol() {}
-
- private void initDebugCOFFSymbol(FactoryBundledWithBinaryReader reader, int index,
- long stringTableIndex) throws IOException {
+ public DebugCOFFSymbol(BinaryReader reader, int index, long stringTableIndex)
+ throws IOException {
// read the union first...
//
int shortVal = reader.readInt(index);
@@ -177,7 +162,7 @@ public class DebugCOFFSymbol implements StructConverter {
for (int i = 0 ; i < numberOfAuxSymbols ; ++i) {
- auxSymbols[i] = DebugCOFFSymbolAux.createDebugCOFFSymbolAux(reader, index, this);
+ auxSymbols[i] = new DebugCOFFSymbolAux(reader, index, this);
index += DebugCOFFSymbolAux.IMAGE_SIZEOF_AUX_SYMBOL;
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolAux.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolAux.java
index 089f2406db..8b70a3ff9a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolAux.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolAux.java
@@ -18,7 +18,6 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -68,39 +67,26 @@ public class DebugCOFFSymbolAux implements StructConverter {
private AuxFile file;
private AuxSection section;
- static DebugCOFFSymbolAux createDebugCOFFSymbolAux(
- FactoryBundledWithBinaryReader reader, int index,
- DebugCOFFSymbol symbol) throws IOException {
- DebugCOFFSymbolAux debugCOFFSymbolAux = (DebugCOFFSymbolAux) reader.getFactory().create(DebugCOFFSymbolAux.class);
- debugCOFFSymbolAux.initDebugCOFFSymbolAux(reader, index, symbol);
- return debugCOFFSymbolAux;
+ DebugCOFFSymbolAux(BinaryReader reader, int index, DebugCOFFSymbol symbol) throws IOException {
+ switch (symbol.getStorageClass()) {
+ case DebugCOFFSymbol.IMAGE_SYM_CLASS_FILE:
+ file = new AuxFile(reader, index);
+ break;
+ case DebugCOFFSymbol.IMAGE_SYM_CLASS_EXTERNAL:
+ case DebugCOFFSymbol.IMAGE_SYM_CLASS_FUNCTION:
+ sym = new AuxSym(reader, index);
+ break;
+ case DebugCOFFSymbol.IMAGE_SYM_CLASS_STATIC:
+ section = new AuxSection(reader, index);
+ break;
+// case IMAGE_SYM_CLASS_CLR_TOKEN:
+// break:
+ default:
+ // unhandled aux symbol...
+ break;
+ }
}
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCOFFSymbolAux() {}
-
- private void initDebugCOFFSymbolAux(FactoryBundledWithBinaryReader reader, int index, DebugCOFFSymbol symbol) throws IOException {
- switch (symbol.getStorageClass()) {
- case DebugCOFFSymbol.IMAGE_SYM_CLASS_FILE:
- file = AuxFile.createAuxFile(reader, index);
- break;
- case DebugCOFFSymbol.IMAGE_SYM_CLASS_EXTERNAL:
- case DebugCOFFSymbol.IMAGE_SYM_CLASS_FUNCTION:
- sym = AuxSym.createAuxSym(reader, index);
- break;
- case DebugCOFFSymbol.IMAGE_SYM_CLASS_STATIC:
- section = AuxSection.createAuxSection(reader, index);
- break;
-// case IMAGE_SYM_CLASS_CLR_TOKEN:
-// break:
- default:
- // unhandled aux symbol...
- break;
- }
- }
-
/**
* @see java.lang.Object#toString()
*/
@@ -153,19 +139,7 @@ public class DebugCOFFSymbolAux implements StructConverter {
private short [] fncAryArrayDimension = new short[4];
private short tvIndex;
- private static AuxSym createAuxSym(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- AuxSym auxSym = (AuxSym) reader.getFactory().create(AuxSym.class);
- auxSym.initAuxSym(reader, index);
- return auxSym;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public AuxSym() {
- }
-
- private void initAuxSym(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ private AuxSym(BinaryReader reader, int index) throws IOException {
tagIndex = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
miscLnSzLinenumber = reader.readShort(index);
@@ -179,6 +153,7 @@ public class DebugCOFFSymbolAux implements StructConverter {
tvIndex = reader.readShort(index); index += BinaryReader.SIZEOF_SHORT;
}
+
int getTagIndex() {
return tagIndex;
}
@@ -212,20 +187,8 @@ public class DebugCOFFSymbolAux implements StructConverter {
public static class AuxFile implements StructConverter {
private String name;
- private static AuxFile createAuxFile(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- AuxFile auxFile = (AuxFile) reader.getFactory().create(AuxFile.class);
- auxFile.initAuxFile(reader, index);
- return auxFile;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public AuxFile() {
- }
-
- private void initAuxFile(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- name = reader.readAsciiString(index, DebugCOFFSymbol.IMAGE_SIZEOF_SYMBOL);
+ private AuxFile(BinaryReader reader, int index) throws IOException {
+ name = reader.readAsciiString(index, DebugCOFFSymbol.IMAGE_SIZEOF_SYMBOL);
}
String getName() {
@@ -248,19 +211,7 @@ public class DebugCOFFSymbolAux implements StructConverter {
private short number;
private byte selection;
- private static AuxSection createAuxSection(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- AuxSection auxSection = (AuxSection) reader.getFactory().create(AuxSection.class);
- auxSection.initAuxSection(reader, index);
- return auxSection;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public AuxSection() {
- }
-
- private void initAuxSection(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ private AuxSection(BinaryReader reader, int index) throws IOException {
length = reader.readInt (index); index += BinaryReader.SIZEOF_INT;
numberOfRelocations = reader.readShort(index); index += BinaryReader.SIZEOF_SHORT;
numberOfLinenumbers = reader.readShort(index); index += BinaryReader.SIZEOF_SHORT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolTable.java
index 6cc1dff839..d89b0c88ce 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolTable.java
@@ -15,10 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.format.*;
-import ghidra.app.util.bin.format.pe.NTHeader;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.format.pe.NTHeader;
/**
* A class to represent the COFF Symbol Table.
@@ -29,20 +29,8 @@ public class DebugCOFFSymbolTable {
private DebugCOFFSymbol [] symbols;
- public static DebugCOFFSymbolTable createDebugCOFFSymbolTable(
- FactoryBundledWithBinaryReader reader,
- DebugCOFFSymbolsHeader coffHeader, int offset) throws IOException {
- DebugCOFFSymbolTable debugCOFFSymbolTable = (DebugCOFFSymbolTable) reader.getFactory().create(DebugCOFFSymbolTable.class);
- debugCOFFSymbolTable.initDebugCOFFSymbolTable(reader, coffHeader, offset);
- return debugCOFFSymbolTable;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCOFFSymbolTable() {}
-
- private void initDebugCOFFSymbolTable(FactoryBundledWithBinaryReader reader, DebugCOFFSymbolsHeader coffHeader, int offset) throws IOException {
+ public DebugCOFFSymbolTable(BinaryReader reader, DebugCOFFSymbolsHeader coffHeader, int offset)
+ throws IOException {
this.ptrToSymbolTable = coffHeader.getFirstSymbolLVA() + offset;
this.symbolCount = coffHeader.getNumberOfSymbols();
@@ -52,7 +40,8 @@ public class DebugCOFFSymbolTable {
if (symbolCount > 0 && symbolCount < NTHeader.MAX_SANE_COUNT) {
symbols = new DebugCOFFSymbol[symbolCount];
for (int i = 0 ; i < symbolCount ; ++i) {
- symbols[i] = DebugCOFFSymbol.createDebugCOFFSymbol(reader, ptrToSymbolTable + (i * DebugCOFFSymbol.IMAGE_SIZEOF_SYMBOL), this);
+ symbols[i] = new DebugCOFFSymbol(reader,
+ ptrToSymbolTable + (i * DebugCOFFSymbol.IMAGE_SIZEOF_SYMBOL), this);
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolsHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolsHeader.java
index e99c6c593a..3641b97ed1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolsHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCOFFSymbolsHeader.java
@@ -15,14 +15,13 @@
*/
package ghidra.app.util.bin.format.pe.debug;
+import java.io.IOException;
+
import ghidra.app.util.bin.BinaryReader;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.pe.NTHeader;
import ghidra.app.util.bin.format.pe.OffsetValidator;
import ghidra.util.Msg;
-import java.io.IOException;
-
/**
* A class to represent the COFF Symbols Header.
*
@@ -58,23 +57,8 @@ public class DebugCOFFSymbolsHeader {
* @param debugDir the debug directory associated to this COFF symbol header
* @param ntHeader
*/
- static DebugCOFFSymbolsHeader createDebugCOFFSymbolsHeader(
- FactoryBundledWithBinaryReader reader, DebugDirectory debugDir,
- OffsetValidator validator) throws IOException {
- DebugCOFFSymbolsHeader debugCOFFSymbolsHeader =
- (DebugCOFFSymbolsHeader) reader.getFactory().create(DebugCOFFSymbolsHeader.class);
- debugCOFFSymbolsHeader.initDebugCOFFSymbolsHeader(reader, debugDir, validator);
- return debugCOFFSymbolsHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCOFFSymbolsHeader() {
- }
-
- private void initDebugCOFFSymbolsHeader(FactoryBundledWithBinaryReader reader,
- DebugDirectory debugDir, OffsetValidator validator) throws IOException {
+ DebugCOFFSymbolsHeader(BinaryReader reader, DebugDirectory debugDir, OffsetValidator validator)
+ throws IOException {
int ptr = debugDir.getPointerToRawData();
if (!validator.checkPointer(ptr)) {
Msg.error(this, "Invalid pointer " + Long.toHexString(ptr));
@@ -101,14 +85,12 @@ public class DebugCOFFSymbolsHeader {
if (numberOfLinenumbers > 0 && numberOfLinenumbers < NTHeader.MAX_SANE_COUNT) {
lineNumbers = new DebugCOFFLineNumber[numberOfLinenumbers];
for (int i = 0; i < numberOfLinenumbers; ++i) {
- lineNumbers[i] = DebugCOFFLineNumber.createDebugCOFFLineNumber(reader, ptr);
+ lineNumbers[i] = new DebugCOFFLineNumber(reader, ptr);
ptr += DebugCOFFLineNumber.IMAGE_SIZEOF_LINENUMBER;
}
- }
+ }
- symbolTable =
- DebugCOFFSymbolTable.createDebugCOFFSymbolTable(reader, this,
- debugDir.getPointerToRawData());
+ symbolTable = new DebugCOFFSymbolTable(reader, this, debugDir.getPointerToRawData());
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeView.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeView.java
index 1c9154eca1..51ec569758 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeView.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeView.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.pdb.PdbInfoCodeView;
import ghidra.app.util.bin.format.pdb.PdbInfoDotNet;
import ghidra.app.util.bin.format.pe.OffsetValidator;
@@ -41,22 +41,8 @@ public class DebugCodeView implements StructConverter {
* @param debugDir the code view debug directory
* @param ntHeader
*/
- static DebugCodeView createDebugCodeView(FactoryBundledWithBinaryReader reader,
- DebugDirectory debugDir, OffsetValidator validator) throws IOException {
- DebugCodeView debugCodeView =
- (DebugCodeView) reader.getFactory().create(DebugCodeView.class);
- debugCodeView.initDebugCodeView(reader, debugDir, validator);
- return debugCodeView;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCodeView() {
- }
-
- private void initDebugCodeView(FactoryBundledWithBinaryReader reader, DebugDirectory debugDir,
- OffsetValidator validator) throws IOException {
+ DebugCodeView(BinaryReader reader, DebugDirectory debugDir, OffsetValidator validator)
+ throws IOException {
this.debugDir = debugDir;
int ptr = debugDir.getPointerToRawData();
@@ -68,16 +54,15 @@ public class DebugCodeView implements StructConverter {
dotNetPdbInfo = PdbInfoDotNet.isMatch(reader, ptr) ? PdbInfoDotNet.read(reader, ptr) : null;
pdbInfo = PdbInfoCodeView.isMatch(reader, ptr) ? PdbInfoCodeView.read(reader, ptr) : null;
if (DebugCodeViewSymbolTable.isMatch(reader, ptr)) {
- symbolTable =
- DebugCodeViewSymbolTable.createDebugCodeViewSymbolTable(reader,
- debugDir.getSizeOfData(), debugDir.getPointerToRawData(), ptr);
+ symbolTable = new DebugCodeViewSymbolTable(reader, debugDir.getSizeOfData(),
+ debugDir.getPointerToRawData(), ptr);
}
else {
//TODO??
-// Err.warn(this, null, "Warning", "Unhandled CodeView Information Format: "+
-// Integer.toHexString(reader.readShort(ptr+0)&0xffff)+
-// " "+
-// Integer.toHexString(reader.readShort(ptr+1)&0xffff));
+// Err.warn(this, null, "Warning", "Unhandled CodeView Information Format: "+
+// Integer.toHexString(reader.readShort(ptr+0)&0xffff)+
+// " "+
+// Integer.toHexString(reader.readShort(ptr+1)&0xffff));
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeViewSymbolTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeViewSymbolTable.java
index 2390b1dc17..47bbc173e9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeViewSymbolTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugCodeViewSymbolTable.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +15,14 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.program.model.data.*;
-import ghidra.util.exception.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
-import java.io.*;
-import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.StructConverter;
+import ghidra.program.model.data.DataType;
+import ghidra.util.exception.DuplicateNameException;
/**
* A class to represent the Object Module Format (OMF)
@@ -42,7 +42,7 @@ public class DebugCodeViewSymbolTable implements StructConverter {
DebugCodeViewConstants.SIGNATURE_N1 << 16 |
DebugCodeViewConstants.VERSION_13;
- public static boolean isMatch(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ public static boolean isMatch(BinaryReader reader, int ptr) throws IOException {
//read value out as big endian
int value = reader.readByte(ptr ) << 24 |
reader.readByte(ptr+1) << 16 |
@@ -68,52 +68,42 @@ public class DebugCodeViewSymbolTable implements StructConverter {
private OMFLibrary library;
- static DebugCodeViewSymbolTable createDebugCodeViewSymbolTable(
- FactoryBundledWithBinaryReader reader, int size, int base, int ptr)
- throws IOException {
- DebugCodeViewSymbolTable debugCodeViewSymbolTable = (DebugCodeViewSymbolTable) reader.getFactory().create(DebugCodeViewSymbolTable.class);
- debugCodeViewSymbolTable.initDebugCodeViewSymbolTable(reader, size, base, ptr);
- return debugCodeViewSymbolTable;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugCodeViewSymbolTable() {}
-
- private void initDebugCodeViewSymbolTable(FactoryBundledWithBinaryReader reader, int size, int base, int ptr) throws IOException {
- magic = reader.readByteArray(ptr, 4); ptr += 4;
+ DebugCodeViewSymbolTable(BinaryReader reader, int size, int base, int ptr) throws IOException {
+ magic = reader.readByteArray(ptr, 4);
+ ptr += 4;
lfoDirectoryPos = reader.readInt(ptr);
omfDirHeaderPos = base + lfoDirectoryPos;
- header = OMFDirHeader.createOMFDirHeader(reader, omfDirHeaderPos);
+ header = new OMFDirHeader(reader, omfDirHeaderPos);
omfDirEntryPos = omfDirHeaderPos + OMFDirHeader.IMAGE_SIZEOF_OMF_DIR_HEADER;
for (int i = 0 ; i < header.getNumberOfEntries() ; ++i) {
- OMFDirEntry entry = OMFDirEntry.createOMFDirEntry(reader, omfDirEntryPos);
+ OMFDirEntry entry = new OMFDirEntry(reader, omfDirEntryPos);
entriesList.add(entry);
switch (entry.getSubSectionType()) {
case DebugCodeViewConstants.sstModule:
- modulesList.add(OMFModule.createOMFModule(reader, entry.getLargeFileOffset()+base, entry.getNumberOfBytes()));
+ modulesList.add(new OMFModule(reader, entry.getLargeFileOffset() + base,
+ entry.getNumberOfBytes()));
break;
case DebugCodeViewConstants.sstSegMap:
- segMapsList.add(OMFSegMap.createOMFSegMap(reader, entry.getLargeFileOffset()+base));
+ segMapsList.add(new OMFSegMap(reader, entry.getLargeFileOffset() + base));
break;
case DebugCodeViewConstants.sstGlobalPub:
case DebugCodeViewConstants.sstGlobalSym:
case DebugCodeViewConstants.sstStaticSym:
- globalsList.add(OMFGlobal.createOMFGlobal(reader, entry.getLargeFileOffset()+base));
+ globalsList.add(new OMFGlobal(reader, entry.getLargeFileOffset() + base));
break;
case DebugCodeViewConstants.sstSrcModule:
- srcModuleList.add(OMFSrcModule.createOMFSrcModule(reader, entry.getLargeFileOffset()+base));
+ srcModuleList.add(new OMFSrcModule(reader, entry.getLargeFileOffset() + base));
break;
case DebugCodeViewConstants.sstFileIndex:
- fileIndexList.add(OMFFileIndex.createOMFFileIndex(reader, entry.getLargeFileOffset()+base));
+ fileIndexList.add(new OMFFileIndex(reader, entry.getLargeFileOffset() + base));
break;
case DebugCodeViewConstants.sstAlignSym:
- alignSymsList.add(OMFAlignSym.createOMFAlignSym(reader, entry.getLargeFileOffset()+base));
+ alignSymsList.add(new OMFAlignSym(reader, entry.getLargeFileOffset() + base));
break;
case DebugCodeViewConstants.sstLibraries:
- library = OMFLibrary.createOMFLibrary(reader, entry.getLargeFileOffset()+base, entry.getNumberOfBytes());
+ library = new OMFLibrary(reader, entry.getLargeFileOffset() + base,
+ entry.getNumberOfBytes());
break;
case DebugCodeViewConstants.sstGlobalTypes:
//int type = entry.getLargeFileOffset()+base;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectory.java
index 275a0b08fb..1502b8884a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectory.java
@@ -18,9 +18,7 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
import java.io.RandomAccessFile;
-import ghidra.app.util.bin.ByteArrayConverter;
-import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.pe.OffsetValidator;
import ghidra.program.model.data.*;
import ghidra.util.DataConverter;
@@ -74,22 +72,7 @@ public class DebugDirectory implements StructConverter, ByteArrayConverter {
* @param index the index where this debug directory begins
* @param ntHeader
*/
- static DebugDirectory createDebugDirectory(FactoryBundledWithBinaryReader reader, long index,
- OffsetValidator validator) throws IOException {
- DebugDirectory debugDirectory =
- (DebugDirectory) reader.getFactory().create(DebugDirectory.class);
- debugDirectory.initDebugDirectory(reader, index, validator);
- return debugDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugDirectory() {
- }
-
- private void initDebugDirectory(FactoryBundledWithBinaryReader reader, long index,
- OffsetValidator validator) throws IOException {
+ DebugDirectory(BinaryReader reader, long index, OffsetValidator validator) throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(index);
@@ -104,22 +87,22 @@ public class DebugDirectory implements StructConverter, ByteArrayConverter {
if (type < 0 || type > 16 || sizeOfData < 0) {
Msg.error(this, "Invalid DebugDirectory");
- sizeOfData = 0;
- reader.setPointerIndex(oldIndex);
- return;
- }
- if (sizeOfData > 0) {
- if (!validator.checkPointer(pointerToRawData)) {
- Msg.error(this, "Invalid pointerToRawData " + pointerToRawData);
sizeOfData = 0;
reader.setPointerIndex(oldIndex);
return;
}
- blobBytes = reader.readByteArray(pointerToRawData, sizeOfData);
- }
+ if (sizeOfData > 0) {
+ if (!validator.checkPointer(pointerToRawData)) {
+ Msg.error(this, "Invalid pointerToRawData " + pointerToRawData);
+ sizeOfData = 0;
+ reader.setPointerIndex(oldIndex);
+ return;
+ }
+ blobBytes = reader.readByteArray(pointerToRawData, sizeOfData);
+ }
- this.index = index;
- reader.setPointerIndex(oldIndex);
+ this.index = index;
+ reader.setPointerIndex(oldIndex);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectoryParser.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectoryParser.java
index f0adf5fcc4..66b3adb728 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectoryParser.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugDirectoryParser.java
@@ -15,12 +15,12 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
-import ghidra.app.util.bin.format.pe.OffsetValidator;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.format.pe.OffsetValidator;
+
/**
* A helper class to parsing different types of
* debug information from a debug directory
@@ -90,27 +90,12 @@ public class DebugDirectoryParser {
* @param validator the validator for the directory
* @throws IOException if an I/O error occurs
*/
- public static DebugDirectoryParser createDebugDirectoryParser(
- FactoryBundledWithBinaryReader reader, long ptr, int size, OffsetValidator validator)
+ public DebugDirectoryParser(BinaryReader reader, long ptr, int size, OffsetValidator validator)
throws IOException {
- DebugDirectoryParser debugDirectoryParser =
- (DebugDirectoryParser) reader.getFactory().create(DebugDirectoryParser.class);
- debugDirectoryParser.initDebugDirectoryParser(reader, ptr, size, validator);
- return debugDirectoryParser;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugDirectoryParser() {
- }
-
- private void initDebugDirectoryParser(FactoryBundledWithBinaryReader reader, long ptr,
- int size, OffsetValidator validator) throws IOException {
int debugFormatsCount = size / DebugDirectory.IMAGE_SIZEOF_DEBUG_DIRECTORY;
for (int i = 0; i < debugFormatsCount; ++i) {
- DebugDirectory debugDir = DebugDirectory.createDebugDirectory(reader, ptr, validator);
+ DebugDirectory debugDir = new DebugDirectory(reader, ptr, validator);
if (debugDir.getSizeOfData() == 0)
break;
@@ -134,27 +119,26 @@ public class DebugDirectoryParser {
break;
case IMAGE_DEBUG_TYPE_FIXUP:
debugDir.setDescription("Fixup");
- fixupDebug = DebugFixup.createDebugFixup(reader, debugDir, validator);
+ fixupDebug = new DebugFixup(reader, debugDir, validator);
break;
case IMAGE_DEBUG_TYPE_EXCEPTION:
debugDir.setDescription("Exception");
break;
case IMAGE_DEBUG_TYPE_MISC:
debugDir.setDescription("Misc");
- miscDebug = DebugMisc.createDebugMisc(reader, debugDir, validator);
+ miscDebug = new DebugMisc(reader, debugDir, validator);
break;
case IMAGE_DEBUG_TYPE_FPO:
debugDir.setDescription("FPO");
break;
case IMAGE_DEBUG_TYPE_CODEVIEW:
debugDir.setDescription("CodeView");
- codeViewDebug = DebugCodeView.createDebugCodeView(reader, debugDir, validator);
+ codeViewDebug = new DebugCodeView(reader, debugDir, validator);
break;
case IMAGE_DEBUG_TYPE_COFF:
debugDir.setDescription("COFF");
coffDebug =
- DebugCOFFSymbolsHeader.createDebugCOFFSymbolsHeader(reader, debugDir,
- validator);
+ new DebugCOFFSymbolsHeader(reader, debugDir, validator);
break;
case IMAGE_DEBUG_TYPE_UNKNOWN:
debugDir.setDescription("Unknown");
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixup.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixup.java
index d0e0b9aae7..e9a871497e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixup.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixup.java
@@ -15,13 +15,13 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
-import ghidra.app.util.bin.format.pe.OffsetValidator;
-import ghidra.util.Msg;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.format.pe.OffsetValidator;
+import ghidra.util.Msg;
+
/**
* A possible implementation of the FIXUP debug directory.
* It may be inaccurate and/or incomplete.
@@ -35,21 +35,8 @@ public class DebugFixup {
* @param debugDir the debug directory associated to this FIXUP
* @param ntHeader
*/
- static DebugFixup createDebugFixup(FactoryBundledWithBinaryReader reader,
- DebugDirectory debugDir, OffsetValidator validator) throws IOException {
- DebugFixup debugFixup = (DebugFixup) reader.getFactory().create(DebugFixup.class);
- debugFixup.initDebugFixup(reader, debugDir, validator);
- return debugFixup;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugFixup() {
- }
-
- private void initDebugFixup(FactoryBundledWithBinaryReader reader, DebugDirectory debugDir,
- OffsetValidator validator) throws IOException {
+ DebugFixup(BinaryReader reader, DebugDirectory debugDir, OffsetValidator validator)
+ throws IOException {
int ptr = debugDir.getPointerToRawData();
if (!validator.checkPointer(ptr)) {
Msg.error(this, "Invalid pointer " + Long.toHexString(ptr));
@@ -60,7 +47,7 @@ public class DebugFixup {
ArrayList list = new ArrayList();
while (size > 0) {
- list.add(DebugFixupElement.createDebugFixupElement(reader, ptr));
+ list.add(new DebugFixupElement(reader, ptr));
ptr += DebugFixupElement.SIZEOF;
size -= DebugFixupElement.SIZEOF;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixupElement.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixupElement.java
index 26ef1b7af7..d451eb6a5e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixupElement.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugFixupElement.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +18,6 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
import ghidra.app.util.bin.BinaryReader;
-import ghidra.app.util.bin.format.*;
/**
* A possible implementation of the FIXUP debug directory elements.
@@ -34,23 +32,13 @@ public class DebugFixupElement {
private int addr1;
private int addr2;
- static DebugFixupElement createDebugFixupElement(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- DebugFixupElement debugFixupElement = (DebugFixupElement) reader.getFactory().create(DebugFixupElement.class);
- debugFixupElement.initDebugFixupElement(reader, index);
- return debugFixupElement;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugFixupElement() {}
-
- private void initDebugFixupElement(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- type = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- addr1 = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- addr2 = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
+ DebugFixupElement(BinaryReader reader, int index) throws IOException {
+ type = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ addr1 = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ addr2 = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugMisc.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugMisc.java
index bce056c067..a1453f1972 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugMisc.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugMisc.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.pe.OffsetValidator;
import ghidra.program.model.data.*;
import ghidra.util.Conv;
@@ -62,21 +62,8 @@ public class DebugMisc implements StructConverter {
* @param debugDir the debug directory associated to this MISC debug
* @param ntHeader
*/
- static DebugMisc createDebugMisc(FactoryBundledWithBinaryReader reader,
- DebugDirectory debugDir, OffsetValidator validator) throws IOException {
- DebugMisc debugMisc = (DebugMisc) reader.getFactory().create(DebugMisc.class);
- debugMisc.initDebugMisc(reader, debugDir, validator);
- return debugMisc;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugMisc() {
- }
-
- private void initDebugMisc(FactoryBundledWithBinaryReader reader, DebugDirectory debugDir,
- OffsetValidator validator) throws IOException {
+ DebugMisc(BinaryReader reader, DebugDirectory debugDir, OffsetValidator validator)
+ throws IOException {
this.debugDir = debugDir;
long oldIndex = reader.getPointerIndex();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugSymbolSelector.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugSymbolSelector.java
index 1b7ecc6a89..16f55e4161 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugSymbolSelector.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/DebugSymbolSelector.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,14 +18,13 @@ package ghidra.app.util.bin.format.pe.debug;
import java.io.IOException;
import ghidra.app.util.bin.BinaryReader;
-import ghidra.app.util.bin.format.*;
/**
*
*/
public class DebugSymbolSelector {
- public static DebugSymbol selectSymbol(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ public static DebugSymbol selectSymbol(BinaryReader reader, int ptr) throws IOException {
short length = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
short type = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
@@ -38,57 +36,57 @@ public class DebugSymbolSelector {
case DebugCodeViewConstants.S_LDATA32:
case DebugCodeViewConstants.S_GDATA32:
case DebugCodeViewConstants.S_PUB32:
- return DataSym32.createDataSym32(length, type, reader, ptr);
+ return new DataSym32(length, type, reader, ptr);
case DebugCodeViewConstants.S_PUBSYM32_NEW:
- return DataSym32_new.createDataSym32_new(length, type, reader, ptr);
+ return new DataSym32_new(length, type, reader, ptr);
case DebugCodeViewConstants.S_PROCREF:
case DebugCodeViewConstants.S_LPROCREF:
- return S_PROCREF.createS_PROCREF(length, type, reader, ptr);
+ return new S_PROCREF(length, type, reader, ptr);
case DebugCodeViewConstants.S_DATAREF:
- return S_DATAREF.createS_DATAREF(length, type, reader, ptr);
+ return new S_DATAREF(length, type, reader, ptr);
case DebugCodeViewConstants.S_ALIGN:
- return S_ALIGN.createS_ALIGN(length, type, reader, ptr);
+ return new S_ALIGN(length, type, reader, ptr);
case DebugCodeViewConstants.S_UDT32:
- return S_UDT32_NEW.createS_UDT32_NEW(length, type, reader, ptr);
+ return new S_UDT32_NEW(length, type, reader, ptr);
case DebugCodeViewConstants.S_LDATA32_NEW:
- return S_LDATA32_NEW.createS_LDATA32_NEW(length, type, reader, ptr);
+ return new S_LDATA32_NEW(length, type, reader, ptr);
case DebugCodeViewConstants.S_LPROC32_NEW:
case DebugCodeViewConstants.S_GPROC32_NEW:
- return S_GPROC32_NEW.createS_GPROC32_NEW(length, type, reader, ptr);
+ return new S_GPROC32_NEW(length, type, reader, ptr);
case DebugCodeViewConstants.S_BPREL32_NEW:
- return S_BPREL32_NEW.createS_BPREL32_NEW(length, type, reader, ptr);
+ return new S_BPREL32_NEW(length, type, reader, ptr);
case DebugCodeViewConstants.S_END:
- return S_END.createS_END(length, type, reader, ptr);
+ return new S_END(length, type, reader, ptr);
case DebugCodeViewConstants.S_BLOCK32:
- return S_BLOCK32.createS_BLOCK32(length, type);
+ return new S_BLOCK32(length, type);
case DebugCodeViewConstants.S_COMPILE:
- return S_COMPILE.createS_COMPILE(length, type);
+ return new S_COMPILE(length, type);
case DebugCodeViewConstants.S_OBJNAME:
- return S_OBJNAME.createS_OBJNAME(length, type, reader, ptr);
+ return new S_OBJNAME(length, type, reader, ptr);
case DebugCodeViewConstants.S_CONSTANT32:
- return S_CONSTANT32.createS_CONSTANT32(length, type, reader, ptr);
+ return new S_CONSTANT32(length, type, reader, ptr);
case DebugCodeViewConstants.S_GDATA32_NEW:
- return S_GDATA32_NEW.createS_GDATA32_NEW(length, type, reader, ptr);
+ return new S_GDATA32_NEW(length, type, reader, ptr);
case DebugCodeViewConstants.S_LABEL32:
- return S_LABEL32.createS_LABEL32(length, type, reader, ptr);
+ return new S_LABEL32(length, type, reader, ptr);
default:
- return UnknownSymbol.createUnknownSymbol(length, type, reader, ptr);
+ return new UnknownSymbol(length, type, reader, ptr);
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFAlignSym.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFAlignSym.java
index 3ceb227913..3e4976ecf5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFAlignSym.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFAlignSym.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
* A class to represent the Object Module Format (OMF) alignment symbol.
@@ -29,22 +27,11 @@ public class OMFAlignSym {
private short length;
private byte [] pad;
- static OMFAlignSym createOMFAlignSym(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFAlignSym omfAlignSym = (OMFAlignSym) reader.getFactory().create(OMFAlignSym.class);
- omfAlignSym.initOMFAlignSym(reader, ptr);
- return omfAlignSym;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFAlignSym() {}
-
- private void initOMFAlignSym(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- length = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
+ OMFAlignSym(BinaryReader reader, int ptr) throws IOException {
+ length = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
pad = reader.readByteArray(ptr, length);
- }
+ }
/**
* Returns the alignment padding bytes.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirEntry.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirEntry.java
index bc1b41d994..e5bbb3c1f4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirEntry.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirEntry.java
@@ -15,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -38,24 +37,15 @@ class OMFDirEntry {
private int lfo;
private int cb;
- static OMFDirEntry createOMFDirEntry(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- OMFDirEntry omfDirEntry = (OMFDirEntry) reader.getFactory().create(OMFDirEntry.class);
- omfDirEntry.initOMFDirEntry(reader, index);
- return omfDirEntry;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFDirEntry() {}
-
- private void initOMFDirEntry(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- subsection = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- imod = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- lfo = reader.readInt (index); index+=BinaryReader.SIZEOF_INT;
- cb = reader.readInt (index); index+=BinaryReader.SIZEOF_INT;
+ OMFDirEntry(BinaryReader reader, int index) throws IOException {
+ subsection = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ imod = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ lfo = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ cb = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
short getSubSectionType() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirHeader.java
index 72f4c6d035..888000513d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFDirHeader.java
@@ -15,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -42,25 +41,17 @@ class OMFDirHeader {
private int lfoNextDir;
private int flags;
- static OMFDirHeader createOMFDirHeader(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- OMFDirHeader omfDirHeader = (OMFDirHeader) reader.getFactory().create(OMFDirHeader.class);
- omfDirHeader.initOMFDirHeader(reader, index);
- return omfDirHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFDirHeader() {}
-
- private void initOMFDirHeader(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- cbDirHeader = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- cbDirEntry = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- cDir = reader.readInt (index); index+=BinaryReader.SIZEOF_INT;
- lfoNextDir = reader.readInt (index); index+=BinaryReader.SIZEOF_INT;
- flags = reader.readInt (index); index+=BinaryReader.SIZEOF_INT;
+ OMFDirHeader(BinaryReader reader, int index) throws IOException {
+ cbDirHeader = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ cbDirEntry = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ cDir = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ lfoNextDir = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ flags = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
int getFlags() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFFileIndex.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFFileIndex.java
index e3f7f66038..da93c758be 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFFileIndex.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFFileIndex.java
@@ -15,12 +15,11 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
-import java.io.*;
-import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the Object Module Format (OMF) File Index data structure.
@@ -44,44 +43,38 @@ public class OMFFileIndex {
private int [] nameRef;
private String [] names;
- static OMFFileIndex createOMFFileIndex(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFFileIndex omfFileIndex = (OMFFileIndex) reader.getFactory().create(OMFFileIndex.class);
- omfFileIndex.initOMFFileIndex(reader, ptr);
- return omfFileIndex;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFFileIndex() {}
-
- private void initOMFFileIndex(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ OMFFileIndex(BinaryReader reader, int ptr) throws IOException {
int index = ptr;
- cMod = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- cRef = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ cMod = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ cRef = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
modStart = new short[Conv.shortToInt(cMod)];
- for(int i = 0; i < cMod; ++i){
- modStart[i] = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ for (int i = 0; i < cMod; ++i) {
+ modStart[i] = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
}
cRefCnt = new short[Conv.shortToInt(cMod)];
- for(int i = 0; i < cMod; i++){
- cRefCnt[i] = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ for (int i = 0; i < cMod; i++) {
+ cRefCnt[i] = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
}
nameRef = new int[Conv.shortToInt(cRef)];
- for(int i = 0; i < cRef; ++i){
- nameRef[i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
+ for (int i = 0; i < cRef; ++i) {
+ nameRef[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
ArrayList namesList = new ArrayList();
- for (int i = 0 ; i < Conv.shortToInt(cRef) ; ++i) {
+ for (int i = 0; i < Conv.shortToInt(cRef); ++i) {
int nameIndex = index + nameRef[i];
- byte len = reader.readByte(nameIndex); nameIndex+=BinaryReader.SIZEOF_BYTE;
+ byte len = reader.readByte(nameIndex);
+ nameIndex += BinaryReader.SIZEOF_BYTE;
int length = Conv.byteToInt(len);
String name = reader.readAsciiString(nameIndex, length);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFGlobal.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFGlobal.java
index b79e874f0f..1be34e4404 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFGlobal.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFGlobal.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,12 +15,12 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
-import java.io.*;
-import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the Object Module Format (OMF) Global data structure.
@@ -35,39 +34,32 @@ public class OMFGlobal {
private int cbAddrHash;
private ArrayList symbols = new ArrayList();
- static OMFGlobal createOMFGlobal(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFGlobal omfGlobal = (OMFGlobal) reader.getFactory().create(OMFGlobal.class);
- omfGlobal.initOMFGlobal(reader, ptr);
- return omfGlobal;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFGlobal() {}
-
- private void initOMFGlobal(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- symHash = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- addrHash = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- cbSymbol = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
- cbSymHash = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
- cbAddrHash = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
+ OMFGlobal(BinaryReader reader, int ptr) throws IOException {
+ symHash = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ addrHash = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ cbSymbol = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ cbSymHash = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ cbAddrHash = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
int bytesLeft = cbSymbol;
while (bytesLeft > 0) {
DebugSymbol sym = DebugSymbolSelector.selectSymbol(reader, ptr);
- ptr += 2*BinaryReader.SIZEOF_SHORT;
- bytesLeft -= 2*BinaryReader.SIZEOF_SHORT;
+ ptr += 2 * BinaryReader.SIZEOF_SHORT;
+ bytesLeft -= 2 * BinaryReader.SIZEOF_SHORT;
if (sym != null) {
symbols.add(sym);
int recLen = Conv.shortToInt(sym.getLength());
bytesLeft -= recLen;
- ptr += recLen-2;
+ ptr += recLen - 2;
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFLibrary.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFLibrary.java
index f8a1fdf851..55b69e471d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFLibrary.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFLibrary.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,12 +15,11 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
-import java.io.*;
-import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the Object Module Format (OMF) Library data structure.
@@ -30,34 +28,21 @@ import java.util.*;
public class OMFLibrary {
private String [] libs;
- static OMFLibrary createOMFLibrary(
- FactoryBundledWithBinaryReader reader, int ptr, int numBytes)
- throws IOException {
- OMFLibrary omfLibrary = (OMFLibrary) reader.getFactory().create(OMFLibrary.class);
- omfLibrary.initOMFLibrary(reader, ptr, numBytes);
- return omfLibrary;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFLibrary() {}
-
- private void initOMFLibrary(FactoryBundledWithBinaryReader reader, int ptr, int numBytes) throws IOException {
+ OMFLibrary(BinaryReader reader, int ptr, int numBytes) throws IOException {
ArrayList libList = new ArrayList();
while (numBytes > 0) {
byte len = reader.readByte(ptr);
- ptr+=BinaryReader.SIZEOF_BYTE;
- numBytes-=BinaryReader.SIZEOF_BYTE;
+ ptr += BinaryReader.SIZEOF_BYTE;
+ numBytes -= BinaryReader.SIZEOF_BYTE;
int length = Conv.byteToInt(len);
String lib = reader.readAsciiString(ptr, length);
- ptr+=length;
- numBytes-=length;
+ ptr += length;
+ numBytes -= length;
libList.add(lib);
}
libs = new String[libList.size()];
libList.toArray(libs);
- }
+ }
/**
* Returns the array of library names.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFModule.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFModule.java
index 025226295e..c00abeac9b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFModule.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFModule.java
@@ -15,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -40,38 +39,29 @@ public class OMFModule {
private OMFSegDesc [] segDescArr;
private String name;
- static OMFModule createOMFModule(
- FactoryBundledWithBinaryReader reader, int ptr, int byteCount)
- throws IOException {
- OMFModule omfModule = (OMFModule) reader.getFactory().create(OMFModule.class);
- omfModule.initOMFModule(reader, ptr, byteCount);
- return omfModule;
- }
+ OMFModule(BinaryReader reader, int ptr, int byteCount) throws IOException {
+ int index = ptr;
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFModule() {}
+ this.ovlNumber = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ this.iLib = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ this.cSeg = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ this.style = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
- private void initOMFModule(FactoryBundledWithBinaryReader reader, int ptr, int byteCount) throws IOException {
- int index = ptr;
+ this.segDescArr = new OMFSegDesc[cSeg];
- this.ovlNumber = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- this.iLib = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- this.cSeg = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- this.style = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ for (int i = 0; i < cSeg; ++i) {
+ segDescArr[i] = new OMFSegDesc(reader, index);
- this.segDescArr = new OMFSegDesc[cSeg];
+ index += OMFSegDesc.IMAGE_SIZEOF_OMF_SEG_DESC;
+ }
- for (int i = 0 ; i < cSeg ; ++i) {
- segDescArr[i] = OMFSegDesc.createOMFSegDesc(reader, index);
+ ++index; // why do we need to increment?????
- index += OMFSegDesc.IMAGE_SIZEOF_OMF_SEG_DESC;
- }
-
- ++index; // why do we need to increment?????
-
- name = reader.readAsciiString(index);
+ name = reader.readAsciiString(index);
}
public short getOvlNumber() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegDesc.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegDesc.java
index f3ab2c32c8..7936a73f84 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegDesc.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegDesc.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
* A class to represent the Object Module Format (OMF) Segment Descriptor data structure.
@@ -44,24 +42,15 @@ public class OMFSegDesc {
private int offset;
private int cbSeg;
- static OMFSegDesc createOMFSegDesc(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- OMFSegDesc omfSegDesc = (OMFSegDesc) reader.getFactory().create(OMFSegDesc.class);
- omfSegDesc.initOMFSegDesc(reader, index);
- return omfSegDesc;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFSegDesc() {}
-
- private void initOMFSegDesc(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- seg = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- pad = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- offset = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- cbSeg = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ OMFSegDesc(BinaryReader reader, int index) throws IOException {
+ seg = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ pad = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ offset = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ cbSeg = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMap.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMap.java
index 1a93c20289..89a1b494ca 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMap.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMap.java
@@ -15,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -36,26 +35,16 @@ public class OMFSegMap {
private short cSegLog;
private OMFSegMapDesc [] segmentMapDesc;
- static OMFSegMap createOMFSegMap(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFSegMap omfSegMap = (OMFSegMap) reader.getFactory().create(OMFSegMap.class);
- omfSegMap.initOMFSegMap(reader, ptr);
- return omfSegMap;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFSegMap() {}
-
- private void initOMFSegMap(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- cSeg = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- cSegLog = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- segmentMapDesc = new OMFSegMapDesc[cSeg];
- for (int i = 0 ; i < cSeg ; ++i) {
- segmentMapDesc[i] = OMFSegMapDesc.createOMFSegMapDesc(reader, ptr);
- ptr += OMFSegMapDesc.IMAGE_SIZEOF_OMF_SEG_MAP_DESC;
- }
+ OMFSegMap(BinaryReader reader, int ptr) throws IOException {
+ cSeg = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ cSegLog = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ segmentMapDesc = new OMFSegMapDesc[cSeg];
+ for (int i = 0; i < cSeg; ++i) {
+ segmentMapDesc[i] = new OMFSegMapDesc(reader, ptr);
+ ptr += OMFSegMapDesc.IMAGE_SIZEOF_OMF_SEG_MAP_DESC;
+ }
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMapDesc.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMapDesc.java
index e3eba54573..8822024196 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMapDesc.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSegMapDesc.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
* A class to represent the Object Module Format (OMF) Segment Mapping Descriptor data structure.
@@ -51,27 +49,23 @@ public class OMFSegMapDesc {
private int offset;
private int cbSeg;
- static OMFSegMapDesc createOMFSegMapDesc(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFSegMapDesc omfSegMapDesc = (OMFSegMapDesc) reader.getFactory().create(OMFSegMapDesc.class);
- omfSegMapDesc.initOMFSegMapDesc(reader, ptr);
- return omfSegMapDesc;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFSegMapDesc() {}
-
- private void initOMFSegMapDesc(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- flags = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- ovl = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- group = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- frame = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- iSegName = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- iClassName = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- offset = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
- cbSeg = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
+ OMFSegMapDesc(BinaryReader reader, int ptr) throws IOException {
+ flags = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ ovl = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ group = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ frame = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ iSegName = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ iClassName = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ offset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ cbSeg = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModule.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModule.java
index 84b77225ee..213a144609 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModule.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModule.java
@@ -15,12 +15,11 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
-import java.io.*;
-import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the Object Module Format (OMF) Source Module data structure.
@@ -48,44 +47,38 @@ public class OMFSrcModule {
private ArrayList moduleFileList = new ArrayList();
- static OMFSrcModule createOMFSrcModule(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFSrcModule omfSrcModule = (OMFSrcModule) reader.getFactory().create(OMFSrcModule.class);
- omfSrcModule.initOMFSrcModule(reader, ptr);
- return omfSrcModule;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFSrcModule() {}
-
- private void initOMFSrcModule(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ OMFSrcModule(BinaryReader reader, int ptr) throws IOException {
int index = ptr;
- cFile = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- cSeg = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ cFile = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ cSeg = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
baseSrcFile = new int[Conv.shortToInt(cFile)];
- for (int i = 0 ; i < Conv.shortToInt(cFile) ; ++i) {
- baseSrcFile[i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
+ for (int i = 0; i < Conv.shortToInt(cFile); ++i) {
+ baseSrcFile[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
starts = new int[Conv.shortToInt(cSeg)];
- ends = new int[Conv.shortToInt(cSeg)];
+ ends = new int[Conv.shortToInt(cSeg)];
- for (int i = 0 ; i < Conv.shortToInt(cSeg) ; ++i) {
- starts[i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
- ends [i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
+ for (int i = 0; i < Conv.shortToInt(cSeg); ++i) {
+ starts[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ ends[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
segs = new short[Conv.shortToInt(cSeg)];
- for (int i = 0 ; i < Conv.shortToInt(cSeg) ; ++i) {
- segs[i] = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ for (int i = 0; i < Conv.shortToInt(cSeg); ++i) {
+ segs[i] = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
}
- for (int i = 0 ; i < Conv.shortToInt(cFile) ; ++i) {
- moduleFileList.add(OMFSrcModuleFile.createOMFSrcModuleFile(reader, ptr+baseSrcFile[i]));
+ for (int i = 0; i < Conv.shortToInt(cFile); ++i) {
+ moduleFileList.add(new OMFSrcModuleFile(reader, ptr + baseSrcFile[i]));
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleFile.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleFile.java
index 7baa7001eb..43964f6371 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleFile.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleFile.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,12 +15,11 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
-import java.io.*;
-import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the Object Module Format (OMF) Source Module File data structure.
@@ -55,46 +53,41 @@ public class OMFSrcModuleFile {
private ArrayList moduleLineList = new ArrayList();
- static OMFSrcModuleFile createOMFSrcModuleFile(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFSrcModuleFile omfSrcModuleFile = (OMFSrcModuleFile) reader.getFactory().create(OMFSrcModuleFile.class);
- omfSrcModuleFile.initOMFSrcModuleFile(reader, ptr);
- return omfSrcModuleFile;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFSrcModuleFile() {}
-
- private void initOMFSrcModuleFile(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ OMFSrcModuleFile(BinaryReader reader, int ptr) throws IOException {
int index = ptr;
- cSeg = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
- pad = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
+ cSeg = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
+ pad = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
baseSrcLn = new int[Conv.shortToInt(cSeg)];
- for (int i = 0 ; i < cSeg ; ++i) {
- baseSrcLn[i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
+ for (int i = 0; i < cSeg; ++i) {
+ baseSrcLn[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
starts = new int[Conv.shortToInt(cSeg)];
- ends = new int[Conv.shortToInt(cSeg)];
+ ends = new int[Conv.shortToInt(cSeg)];
- for (int i = 0 ; i < Conv.shortToInt(cSeg) ; ++i) {
- starts[i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
- ends [i] = reader.readInt(index); index+=BinaryReader.SIZEOF_INT;
+ for (int i = 0; i < Conv.shortToInt(cSeg); ++i) {
+ starts[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ ends[i] = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
- cbName = reader.readByte(index); index+=BinaryReader.SIZEOF_BYTE;
+ cbName = reader.readByte(index);
+ index += BinaryReader.SIZEOF_BYTE;
- name = reader.readAsciiString(index, cbName); index+=cbName;
+ name = reader.readAsciiString(index, cbName);
+ index += cbName;
- for (int i = 0 ; i < Conv.shortToInt(cSeg) ; ++i) {
+ for (int i = 0; i < Conv.shortToInt(cSeg); ++i) {
//OMFSrcModuleLine line = new OMFSrcModuleLine(reader, index);
- OMFSrcModuleLine line = OMFSrcModuleLine.createOMFSrcModuleLine(reader, ptr+baseSrcLn[i]);
+ OMFSrcModuleLine line = new OMFSrcModuleLine(reader, ptr + baseSrcLn[i]);
moduleLineList.add(line);
- index+=line.getByteCount();
+ index += line.getByteCount();
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleLine.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleLine.java
index 7bbb5c7a3a..a5a9a484a1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleLine.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/OMFSrcModuleLine.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the Object Module Format (OMF) Source Module Line data structure.
@@ -41,19 +39,7 @@ public class OMFSrcModuleLine {
private int [] offsets;
private short [] linenumbers;
- static OMFSrcModuleLine createOMFSrcModuleLine(
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- OMFSrcModuleLine omfSrcModuleLine = (OMFSrcModuleLine) reader.getFactory().create(OMFSrcModuleLine.class);
- omfSrcModuleLine.initOMFSrcModuleLine(reader, ptr);
- return omfSrcModuleLine;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFSrcModuleLine() {}
-
- private void initOMFSrcModuleLine(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ OMFSrcModuleLine(BinaryReader reader, int ptr) throws IOException {
int index = ptr;
seg = reader.readShort(index); index+=BinaryReader.SIZEOF_SHORT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_ALIGN.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_ALIGN.java
index 0e544327f3..e48f734a8f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_ALIGN.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_ALIGN.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -27,19 +26,7 @@ import java.io.*;
class S_ALIGN extends DebugSymbol {
private byte [] pad;
- static S_ALIGN createS_ALIGN(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_ALIGN s_align = (S_ALIGN) reader.getFactory().create(S_ALIGN.class);
- s_align.initS_ALIGN(length, type, reader, ptr);
- return s_align;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_ALIGN() {}
-
- private void initS_ALIGN(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_ALIGN(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
if (type != DebugCodeViewConstants.S_ALIGN) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BLOCK32.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BLOCK32.java
index b0e164958c..a8a3144d4c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BLOCK32.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BLOCK32.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +20,7 @@ package ghidra.app.util.bin.format.pe.debug;
*/
class S_BLOCK32 extends DebugSymbol {
- static S_BLOCK32 createS_BLOCK32(short length, short type) {
- return new S_BLOCK32(length, type);
- }
-
- private S_BLOCK32(short length, short type) {
+ S_BLOCK32(short length, short type) {
processDebugSymbol(length, type);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BPREL32_NEW.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BPREL32_NEW.java
index a3bea5bbdc..c04fe62139 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BPREL32_NEW.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_BPREL32_NEW.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
* A class to represent the S_BPREL32_NEW data structure.
@@ -30,26 +28,18 @@ public class S_BPREL32_NEW extends DebugSymbol {
private short variableType;
private short symbolType;
- static S_BPREL32_NEW createS_BPREL32_NEW(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_BPREL32_NEW s_bprel32_new = (S_BPREL32_NEW) reader.getFactory().create(S_BPREL32_NEW.class);
- s_bprel32_new.initS_BPREL32_NEW(length, type, reader, ptr);
- return s_bprel32_new;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_BPREL32_NEW() {}
-
- private void initS_BPREL32_NEW(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_BPREL32_NEW(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
- offset = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
- variableType = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
- symbolType = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
+ offset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ variableType = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ symbolType = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
- byte nameLen = reader.readByte (ptr); ptr+=BinaryReader.SIZEOF_BYTE;
+ byte nameLen = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_COMPILE.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_COMPILE.java
index fa5a453bf1..ce2622e20d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_COMPILE.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_COMPILE.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,11 +20,7 @@ package ghidra.app.util.bin.format.pe.debug;
*/
class S_COMPILE extends DebugSymbol {
- static S_COMPILE createS_COMPILE(short length, short type) {
- return new S_COMPILE(length, type);
- }
-
- private S_COMPILE(short length, short type) {
+ S_COMPILE(short length, short type) {
processDebugSymbol(length, type);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_CONSTANT32.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_CONSTANT32.java
index 41dce65681..caa749700e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_CONSTANT32.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_CONSTANT32.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,40 +15,31 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+import ghidra.util.Msg;
/**
*
*/
class S_CONSTANT32 extends DebugSymbol {
- static S_CONSTANT32 createS_CONSTANT32(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_CONSTANT32 s_constant32 = (S_CONSTANT32) reader.getFactory().create(S_CONSTANT32.class);
- s_constant32.initS_CONSTANT32(length, type, reader, ptr);
- return s_constant32;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_CONSTANT32() {}
-
- private void initS_CONSTANT32(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_CONSTANT32(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
- int unknown1 = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
- short unknown2 = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
+ int unknown1 = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ short unknown2 = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
- byte nameLen = reader.readByte(ptr); ptr+=BinaryReader.SIZEOF_BYTE;
+ byte nameLen = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
- Msg.debug(this, "S_CONSTANT32: "+unknown1+" - "+unknown2);
+ Msg.debug(this, "S_CONSTANT32: " + unknown1 + " - " + unknown2);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_DATAREF.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_DATAREF.java
index 4ed7d6ec3c..7fe8ff3e96 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_DATAREF.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_DATAREF.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
*
@@ -28,28 +26,19 @@ import java.io.*;
class S_DATAREF extends DebugSymbol {
private int checksum;
- static S_DATAREF createS_DATAREF(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_DATAREF s_dataref = (S_DATAREF) reader.getFactory().create(S_DATAREF.class);
- s_dataref.initS_DATAREF(length, type, reader, ptr);
- return s_dataref;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_DATAREF() {}
-
- private void initS_DATAREF(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_DATAREF(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
if (type != DebugCodeViewConstants.S_DATAREF) {
throw new IllegalArgumentException("Incorrect type!");
}
- this.checksum = reader.readInt (ptr); ptr += BinaryReader.SIZEOF_INT;
- this.offset = reader.readInt (ptr); ptr += BinaryReader.SIZEOF_INT;
- this.section = reader.readShort(ptr); ptr += BinaryReader.SIZEOF_SHORT;
+ this.checksum = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ this.offset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ this.section = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
}
public int getChecksum() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_END.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_END.java
index 28408c61c9..3b1b08f7ad 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_END.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_END.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,31 +15,20 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Msg;
/**
*
*/
class S_END extends DebugSymbol {
- static S_END createS_END(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) {
- S_END s_end = (S_END) reader.getFactory().create(S_END.class);
- s_end.initS_END(length, type, reader, ptr);
- return s_end;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_END() {}
-
- private void initS_END(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) {
+ S_END(short length, short type, BinaryReader reader, int ptr) {
processDebugSymbol(length, type);
- Msg.debug(this, reader.getPointerIndex()+" -- "+ptr);
+ Msg.debug(this, reader.getPointerIndex() + " -- " + ptr);
this.name = "END";
this.offset = 0;
- this.section = 0;
- }
+ this.section = 0;
+ }
+
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GDATA32_NEW.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GDATA32_NEW.java
index 083266b453..a0ef07661f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GDATA32_NEW.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GDATA32_NEW.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,42 +15,34 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+import ghidra.util.Msg;
/**
*
*/
class S_GDATA32_NEW extends DebugSymbol {
- static S_GDATA32_NEW createS_GDATA32_NEW(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_GDATA32_NEW s_gdata32_new = (S_GDATA32_NEW) reader.getFactory().create(S_GDATA32_NEW.class);
- s_gdata32_new.initS_GDATA32_NEW(length, type, reader, ptr);
- return s_gdata32_new;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_GDATA32_NEW() {}
-
- private void initS_GDATA32_NEW(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_GDATA32_NEW(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
- int unknown = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
+ int unknown = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
- offset = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
- section = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
+ offset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ section = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
- byte nameLen = reader.readByte(ptr); ptr+=BinaryReader.SIZEOF_BYTE;
+ byte nameLen = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
- Msg.debug(this, "S_DATA32_NEW: "+unknown);
+ Msg.debug(this, "S_DATA32_NEW: " + unknown);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GPROC32_NEW.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GPROC32_NEW.java
index 32be488d5d..3cbd1cdbb7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GPROC32_NEW.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_GPROC32_NEW.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,9 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
/**
* A class to represent the S_GPROC32_NEW data structure.
@@ -35,32 +33,31 @@ public class S_GPROC32_NEW extends DebugSymbol{
private int procOffset; //offset to start of procedure...
private short procType;
- static S_GPROC32_NEW createS_GPROC32_NEW(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_GPROC32_NEW s_gproc32_new = (S_GPROC32_NEW) reader.getFactory().create(S_GPROC32_NEW.class);
- s_gproc32_new.initS_GPROC32_NEW(length, type, reader, ptr);
- return s_gproc32_new;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_GPROC32_NEW() {}
-
- private void initS_GPROC32_NEW(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_GPROC32_NEW(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
- pParent = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- pEnd = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- pNext = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- procLen = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- debugStart = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- debugEnd = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- offset = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- procOffset = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- section = reader.readShort(ptr); ptr += BinaryReader.SIZEOF_SHORT;
- procType = reader.readShort(ptr); ptr += BinaryReader.SIZEOF_SHORT;
- name = reader.readAsciiString(ptr); ptr += name.length();
- }
+ pParent = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ pEnd = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ pNext = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ procLen = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ debugStart = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ debugEnd = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ offset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ procOffset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ section = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ procType = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ name = reader.readAsciiString(ptr);
+ ptr += name.length();
+ }
public int getParent() {
return pParent;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LABEL32.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LABEL32.java
index 6f9ddef963..b030615ebc 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LABEL32.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LABEL32.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,11 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+import ghidra.util.Msg;
/**
*
@@ -28,30 +27,22 @@ import java.io.*;
class S_LABEL32 extends DebugSymbol {
private byte flags;
- static S_LABEL32 createS_LABEL32(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_LABEL32 s_label32 = (S_LABEL32) reader.getFactory().create(S_LABEL32.class);
- s_label32.initS_LABEL32(length, type, reader, ptr);
- return s_label32;
+ S_LABEL32(short length, short type, BinaryReader reader, int ptr) throws IOException {
+ processDebugSymbol(length, type);
+
+ offset = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ section = reader.readShort(ptr);
+ ptr += BinaryReader.SIZEOF_SHORT;
+ flags = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
+
+ byte nameLen = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
+ name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
+ Msg.debug(this, "Created label symbol: " + name);
}
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_LABEL32() {}
-
- private void initS_LABEL32(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- processDebugSymbol(length, type);
-
- offset = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- section = reader.readShort(ptr); ptr += BinaryReader.SIZEOF_SHORT;
- flags = reader.readByte(ptr); ptr += BinaryReader.SIZEOF_BYTE;
-
- byte nameLen = reader.readByte(ptr); ptr += BinaryReader.SIZEOF_BYTE;
- name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
- Msg.debug(this, "Created label symbol: " +name);
-
- }
/**
* @return the flags of this S_LABEL32 symbol
*/
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LDATA32_NEW.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LDATA32_NEW.java
index 6e822b900f..ff7b0bead0 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LDATA32_NEW.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_LDATA32_NEW.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
*
@@ -29,19 +27,7 @@ class S_LDATA32_NEW extends DebugSymbol{
private int reserved;
private byte [] padding;
- static S_LDATA32_NEW createS_LDATA32_NEW(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_LDATA32_NEW s_ldata32_new = (S_LDATA32_NEW) reader.getFactory().create(S_LDATA32_NEW.class);
- s_ldata32_new.initS_LDATA32_NEW(length, type, reader, ptr);
- return s_ldata32_new;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_LDATA32_NEW() {}
-
- private void initS_LDATA32_NEW(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_LDATA32_NEW(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
reserved = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
offset = reader.readInt (ptr); ptr+=BinaryReader.SIZEOF_INT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_OBJNAME.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_OBJNAME.java
index 3c502e1d15..31bdd2bbf5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_OBJNAME.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_OBJNAME.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
*
@@ -30,19 +28,7 @@ class S_OBJNAME extends DebugSymbol {
private byte nameLen;
private byte [] padding;
- static S_OBJNAME createS_OBJNAME(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_OBJNAME s_objname = (S_OBJNAME) reader.getFactory().create(S_OBJNAME.class);
- s_objname.initS_OBJNAME(length, type, reader, ptr);
- return s_objname;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_OBJNAME() {}
-
- private void initS_OBJNAME(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_OBJNAME(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
signature = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_PROCREF.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_PROCREF.java
index a7ee5f664c..691205739b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_PROCREF.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_PROCREF.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,30 +15,17 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
class S_PROCREF extends DebugSymbol {
private int module;
private int checksum;
private int paddingLen;
- static S_PROCREF createS_PROCREF(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_PROCREF s_procref = (S_PROCREF) reader.getFactory().create(S_PROCREF.class);
- s_procref.initS_PROCREF(length, type, reader, ptr);
- return s_procref;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_PROCREF() {}
-
- private void initS_PROCREF(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_PROCREF(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
// if (type != DebugCodeViewConstants.S_PROCREF) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32.java
index 3021323f1f..7778397853 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
*
@@ -29,28 +27,18 @@ class S_UDT32 extends DebugSymbol {
private int checksum;
private byte typeLen;
- static S_UDT32 createS_UDT32(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_UDT32 s_udt32 = (S_UDT32) reader.getFactory().create(S_UDT32.class);
- s_udt32.initS_UDT32(length, type, reader, ptr);
- return s_udt32;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_UDT32() {}
-
- private void initS_UDT32(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_UDT32(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
if (type != DebugCodeViewConstants.S_UDT32) {
throw new IllegalArgumentException("Incorrect type!");
}
- this.checksum = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
- this.typeLen = reader.readByte(ptr); ptr += BinaryReader.SIZEOF_BYTE;
- this.name = reader.readAsciiString(ptr, Conv.byteToInt(typeLen));
+ this.checksum = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
+ this.typeLen = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
+ this.name = reader.readAsciiString(ptr, Conv.byteToInt(typeLen));
}
public int getChecksum() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32_NEW.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32_NEW.java
index a8a20f24a4..3f70ba38a0 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32_NEW.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/S_UDT32_NEW.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +15,10 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
/**
*
@@ -28,26 +26,16 @@ import java.io.*;
class S_UDT32_NEW extends DebugSymbol {
private int symType;
- static S_UDT32_NEW createS_UDT32_NEW(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- S_UDT32_NEW s_udt32_new = (S_UDT32_NEW) reader.getFactory().create(S_UDT32_NEW.class);
- s_udt32_new.initS_UDT32_NEW(length, type, reader, ptr);
- return s_udt32_new;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_UDT32_NEW() {}
-
- private void initS_UDT32_NEW(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ S_UDT32_NEW(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
- symType = reader.readInt(ptr); ptr += BinaryReader.SIZEOF_INT;
+ symType = reader.readInt(ptr);
+ ptr += BinaryReader.SIZEOF_INT;
- byte nameLen = reader.readByte(ptr); ptr += BinaryReader.SIZEOF_BYTE;
+ byte nameLen = reader.readByte(ptr);
+ ptr += BinaryReader.SIZEOF_BYTE;
- name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
+ name = reader.readAsciiString(ptr, Conv.byteToInt(nameLen));
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/UnknownSymbol.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/UnknownSymbol.java
index afbb6e7ea2..ffa08cda94 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/UnknownSymbol.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/debug/UnknownSymbol.java
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
- * REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +15,11 @@
*/
package ghidra.app.util.bin.format.pe.debug;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+import ghidra.util.Msg;
/**
*
@@ -27,19 +27,7 @@ import java.io.*;
class UnknownSymbol extends DebugSymbol{
private byte [] unknown;
- static UnknownSymbol createUnknownSymbol(short length, short type,
- FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
- UnknownSymbol unknownSymbol = (UnknownSymbol) reader.getFactory().create(UnknownSymbol.class);
- unknownSymbol.initUnknownSymbol(length, type, reader, ptr);
- return unknownSymbol;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public UnknownSymbol() {}
-
- private void initUnknownSymbol(short length, short type, FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
+ UnknownSymbol(short length, short type, BinaryReader reader, int ptr) throws IOException {
processDebugSymbol(length, type);
try {
unknown = reader.readByteArray(ptr, Conv.shortToInt(length));
@@ -47,6 +35,7 @@ class UnknownSymbol extends DebugSymbol{
catch (RuntimeException e) {
Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
}
+
}
public byte[] getUnknown() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDataEntry.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDataEntry.java
index d308cfdce7..5d08dc844a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDataEntry.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDataEntry.java
@@ -15,14 +15,13 @@
*/
package ghidra.app.util.bin.format.pe.resource;
+import java.io.IOException;
+
import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.*;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
-import java.io.IOException;
-
/**
*
* typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
@@ -46,7 +45,7 @@ public class ResourceDataEntry implements StructConverter {
* @param reader the binary reader
* @param index the index where this entry begins
*/
- public ResourceDataEntry(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ public ResourceDataEntry(BinaryReader reader, int index) throws IOException {
offsetToData = reader.readInt(index);
size = reader.readInt(index += BinaryReader.SIZEOF_INT);
codePage = reader.readInt(index += BinaryReader.SIZEOF_INT);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectory.java
index 68ac350679..9987f52453 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectory.java
@@ -15,21 +15,18 @@
*/
package ghidra.app.util.bin.format.pe.resource;
-import ghidra.app.util.bin.BinaryReader;
-import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
-import ghidra.app.util.bin.format.pe.NTHeader;
-import ghidra.app.util.bin.format.pe.ResourceDataDirectory;
-import ghidra.program.model.data.CategoryPath;
-import ghidra.program.model.data.DataType;
-import ghidra.program.model.data.StructureDataType;
-import ghidra.util.Msg;
-import ghidra.util.exception.DuplicateNameException;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.StructConverter;
+import ghidra.app.util.bin.format.pe.NTHeader;
+import ghidra.app.util.bin.format.pe.ResourceDataDirectory;
+import ghidra.program.model.data.*;
+import ghidra.util.Msg;
+import ghidra.util.exception.DuplicateNameException;
+
/**
*
* typedef struct _IMAGE_RESOURCE_DIRECTORY {
@@ -54,7 +51,7 @@ public class ResourceDirectory implements StructConverter {
private short numberOfIdEntries;
private ArrayList entries = new ArrayList();
- public ResourceDirectory(FactoryBundledWithBinaryReader reader,
+ public ResourceDirectory(BinaryReader reader,
int index,
int resourceBase,
boolean isFirstLevel,
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryEntry.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryEntry.java
index f334081c66..44bf48a9c4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryEntry.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryEntry.java
@@ -15,19 +15,18 @@
*/
package ghidra.app.util.bin.format.pe.resource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.pe.NTHeader;
import ghidra.app.util.bin.format.pe.ResourceDataDirectory;
import ghidra.program.model.data.*;
import ghidra.util.Msg;
import ghidra.util.exception.DuplicateNameException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
/**
*
* typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
@@ -74,9 +73,8 @@ public class ResourceDirectoryEntry implements StructConverter {
* @param reader the binary reader
* @param index the index where this directory begins
*/
- public ResourceDirectoryEntry(FactoryBundledWithBinaryReader reader, int index,
- int resourceBase, boolean isNameEntry, boolean isFirstLevel, NTHeader ntHeader)
- throws IOException {
+ public ResourceDirectoryEntry(BinaryReader reader, int index, int resourceBase,
+ boolean isNameEntry, boolean isFirstLevel, NTHeader ntHeader) throws IOException {
this.isNameEntry = isNameEntry;
this.isFirstLevel = isFirstLevel;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryStringU.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryStringU.java
index e22094bb7f..082815b3e7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryStringU.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/ResourceDirectoryStringU.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.*;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -42,7 +41,7 @@ public class ResourceDirectoryStringU implements StructConverter {
* @param reader the binary reader
* @param index the index where this resource string begins
*/
- public ResourceDirectoryStringU(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ public ResourceDirectoryStringU(BinaryReader reader, int index) throws IOException {
length = reader.readShort(index);
nameString = reader.readUnicodeString(index+BinaryReader.SIZEOF_SHORT, length);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_CHILD.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_CHILD.java
index 25f5ba0266..7ab4fcc857 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_CHILD.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_CHILD.java
@@ -19,8 +19,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -44,7 +44,7 @@ public class VS_VERSION_CHILD implements StructConverter {
private ArrayList children;
- VS_VERSION_CHILD(FactoryBundledWithBinaryReader reader, long relativeOffset, String parentName,
+ VS_VERSION_CHILD(BinaryReader reader, long relativeOffset, String parentName,
HashMap valueMap) throws IOException {
this.relativeOffset = relativeOffset;
this.parentName = parentName;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_INFO.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_INFO.java
index b156585840..46392009c9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_INFO.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/resource/VS_VERSION_INFO.java
@@ -15,14 +15,14 @@
*/
package ghidra.app.util.bin.format.pe.resource;
-import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
-import ghidra.program.model.data.*;
-import ghidra.util.exception.DuplicateNameException;
-
import java.io.IOException;
import java.util.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.StructConverter;
+import ghidra.program.model.data.*;
+import ghidra.util.exception.DuplicateNameException;
+
/**
* A class to represent the VS_VERSION_INFO data structure.
*/
@@ -55,7 +55,7 @@ public class VS_VERSION_INFO implements StructConverter {
* @param index the index where the VS_VERSION_INFO begins
* @throws IOException if an I/O error occurs
*/
- public VS_VERSION_INFO(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ public VS_VERSION_INFO(BinaryReader reader, int index) throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(index);
@@ -256,7 +256,7 @@ public class VS_VERSION_INFO implements StructConverter {
return valueMap.get(key);
}
- static String shortArrayToString(FactoryBundledWithBinaryReader reader, int nElements)
+ static String shortArrayToString(BinaryReader reader, int nElements)
throws IOException {
if (nElements == 2) {
short[] arr = reader.readNextShortArray(2);
@@ -269,7 +269,7 @@ public class VS_VERSION_INFO implements StructConverter {
return null;
}
- static String intArrayToString(FactoryBundledWithBinaryReader reader, int nElements)
+ static String intArrayToString(BinaryReader reader, int nElements)
throws IOException {
if (nElements == 2) {
int[] arr = reader.readNextIntArray(2);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatArch.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatArch.java
index 3ce47cd454..71a2b9715e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatArch.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatArch.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.ubi;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.CpuSubTypes;
import ghidra.app.util.bin.format.macho.CpuTypes;
@@ -33,19 +33,7 @@ public class FatArch {
private int size;
private int align;
- public static FatArch createFatArch(FactoryBundledWithBinaryReader reader)
- throws IOException {
- FatArch fatArch = (FatArch) reader.getFactory().create(FatArch.class);
- fatArch.initFatArch(reader);
- return fatArch;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FatArch() {}
-
- private void initFatArch(FactoryBundledWithBinaryReader reader) throws IOException {
+ public FatArch(BinaryReader reader) throws IOException {
cputype = reader.readNextInt();
cpusubtype = reader.readNextInt();
offset = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatHeader.java
index 14b4de0bb7..e9662e63e6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ubi/FatHeader.java
@@ -19,10 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import generic.continues.GenericFactory;
-import ghidra.app.util.bin.ByteProvider;
-import ghidra.app.util.bin.ByteProviderWrapper;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.coff.CoffException;
import ghidra.app.util.bin.format.coff.archive.CoffArchiveHeader;
import ghidra.app.util.bin.format.coff.archive.CoffArchiveMemberHeader;
@@ -44,20 +41,9 @@ public class FatHeader {
private List architectures = new ArrayList();
private List machHeaders = new ArrayList();
- public static FatHeader createFatHeader(GenericFactory factory, ByteProvider provider)
+ public FatHeader(ByteProvider provider)
throws IOException, UbiException, MachException {
- FatHeader fatHeader = (FatHeader) factory.create(FatHeader.class);
- fatHeader.initFatHeader(factory, provider);
- return fatHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FatHeader() {}
-
- private void initFatHeader(GenericFactory factory, ByteProvider provider) throws IOException, UbiException, MachException {
- FactoryBundledWithBinaryReader reader = new FactoryBundledWithBinaryReader(factory, provider, false/*always big endian*/);
+ BinaryReader reader = new BinaryReader(provider, false/*always big endian*/);
magic = reader.readNextInt();
@@ -71,7 +57,7 @@ public class FatHeader {
}
for (int i = 0 ; i < nfat_arch ; ++i) {
- architectures.add(FatArch.createFatArch(reader));
+ architectures.add(new FatArch(reader));
}
for (FatArch fatarch : architectures) {
@@ -91,7 +77,7 @@ public class FatHeader {
wrapper = new ByteProviderWrapper(provider,
fatarch.getOffset() + camh.getPayloadOffset(), camh.getSize());
try {
- machHeaders.add(MachHeader.createMachHeader(factory, wrapper));
+ machHeaders.add(new MachHeader(wrapper));
}
catch (MachException e) {
// Could be __.SYMDEF archive member instead of a Mach-O
@@ -99,7 +85,7 @@ public class FatHeader {
}
}
else {
- machHeaders.add(MachHeader.createMachHeader(factory, wrapper));
+ machHeaders.add(new MachHeader(wrapper));
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DbgLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DbgLoader.java
index 51b2d68ebc..d6a3a64f55 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DbgLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DbgLoader.java
@@ -19,15 +19,12 @@ import java.io.File;
import java.io.IOException;
import java.util.*;
-import generic.continues.GenericFactory;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.Option;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.RandomAccessByteProvider;
import ghidra.app.util.bin.format.pe.*;
import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
import ghidra.util.Conv;
@@ -56,8 +53,7 @@ public class DbgLoader extends AbstractPeDebugLoader {
if (provider.length() < MIN_BYTE_LENGTH) {
return loadSpecs;
}
- SeparateDebugHeader debug =
- new SeparateDebugHeader(RethrowContinuesFactory.INSTANCE, provider);
+ SeparateDebugHeader debug = new SeparateDebugHeader(provider);
if (debug.getSignature() == SeparateDebugHeader.IMAGE_SEPARATE_DEBUG_SIGNATURE) {
long imageBase = Conv.intToLong(debug.getImageBase());
String machineName = debug.getMachineName();
@@ -76,14 +72,12 @@ public class DbgLoader extends AbstractPeDebugLoader {
public void load(ByteProvider provider, LoadSpec loadSpec, List