Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1907: Removing ContinuesInterceptor and associated API

Ryan Kurtz96674d4f629d
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/platform/dbgeng/DbgengX64DisassemblyInject.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/platform/dbgeng/DbgengX64DisassemblyInject.java
index 67a6bc9412..20b8299deb 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/platform/dbgeng/DbgengX64DisassemblyInject.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/platform/dbgeng/DbgengX64DisassemblyInject.java
@@ -22,7 +22,6 @@ import java.util.Set;
import java.util.concurrent.*;
import java.util.stream.Collectors;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.cmd.disassemble.DisassembleCommand;
import ghidra.app.plugin.core.debug.workflow.DisassemblyInject;
import ghidra.app.plugin.core.debug.workflow.DisassemblyInjectInfo;
@@ -107,8 +106,7 @@ public class DbgengX64DisassemblyInject implements DisassemblyInject {
}
MemoryByteProvider mbp = new MemoryByteProvider(view.getMemory(), module.getBase());
try {
- PortableExecutable pe = PortableExecutable.createPortableExecutable(
- RethrowContinuesFactory.INSTANCE, mbp, SectionLayout.MEMORY, false, false);
+ PortableExecutable pe = new PortableExecutable(mbp, SectionLayout.MEMORY, false, false);
NTHeader ntHeader = pe.getNTHeader();
if (ntHeader == null) {
return Mode.UNK;
diff --git a/Ghidra/Features/Base/.launch/Ghidra Code Coverage.launch b/Ghidra/Features/Base/.launch/Ghidra Code Coverage.launch
index 3bb1a6ceb6..607daef9f7 100644
--- a/Ghidra/Features/Base/.launch/Ghidra Code Coverage.launch
+++ b/Ghidra/Features/Base/.launch/Ghidra Code Coverage.launch
@@ -29,6 +29,6 @@
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="_Integration Test"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.GhidraRun"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="_Integration Test"/>
- <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions&#13;&#10;-Djava.system.class.loader=ghidra.GhidraClassLoader&#13;&#10;-Xshare:off&#13;&#10;-Dfile.encoding=UTF8&#13;&#10;-Duser.country=US&#13;&#10;-Duser.language=en&#13;&#10;-Dsun.java2d.pmoffscreen=false&#13;&#10;-Dsun.java2d.xrender=true&#13;&#10;-Dsun.java2d.d3d=false&#13;&#10;-Xdock:name=&quot;Ghidra&quot;&#13;&#10;-Dvisualvm.display.name=Ghidra&#13;&#10;-Dpython.console.encoding=UTF-8&#13;&#10;--add-opens=java.base/java.lang=ALL-UNNAMED&#13;&#10;--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions&#13;&#10;-Djava.system.class.loader=ghidra.GhidraClassLoader&#13;&#10;-Xshare:off&#13;&#10;-Dfile.encoding=UTF8&#13;&#10;-Duser.country=US&#13;&#10;-Duser.language=en&#13;&#10;-Dsun.java2d.pmoffscreen=false&#13;&#10;-Dsun.java2d.xrender=true&#13;&#10;-Dsun.java2d.d3d=false&#13;&#10;-Xdock:name=&quot;Ghidra&quot;&#13;&#10;-Dvisualvm.display.name=Ghidra&#13;&#10;-Dpython.console.encoding=UTF-8&#13;&#10;--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:Framework Utility}"/>
</launchConfiguration>
diff --git a/Ghidra/Features/Base/.launch/Ghidra.launch b/Ghidra/Features/Base/.launch/Ghidra.launch
index ce38e8f22f..ecf2b015ca 100644
--- a/Ghidra/Features/Base/.launch/Ghidra.launch
+++ b/Ghidra/Features/Base/.launch/Ghidra.launch
@@ -31,5 +31,5 @@
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Framework Utility"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.GhidraRun"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Framework Utility"/>
- <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions&#13;&#10;-Djava.system.class.loader=ghidra.GhidraClassLoader&#13;&#10;-Xshare:off&#13;&#10;-Dfile.encoding=UTF8&#13;&#10;-Duser.country=US&#13;&#10;-Duser.language=en&#13;&#10;-Dsun.java2d.pmoffscreen=false&#13;&#10;-Dsun.java2d.xrender=true&#13;&#10;-Dsun.java2d.d3d=false&#13;&#10;-Xdock:name=&quot;Ghidra&quot;&#13;&#10;-Dvisualvm.display.name=Ghidra&#13;&#10;-Dpython.console.encoding=UTF-8&#13;&#10;--add-opens=java.base/java.lang=ALL-UNNAMED&#13;&#10;--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions&#13;&#10;-Djava.system.class.loader=ghidra.GhidraClassLoader&#13;&#10;-Xshare:off&#13;&#10;-Dfile.encoding=UTF8&#13;&#10;-Duser.country=US&#13;&#10;-Duser.language=en&#13;&#10;-Dsun.java2d.pmoffscreen=false&#13;&#10;-Dsun.java2d.xrender=true&#13;&#10;-Dsun.java2d.d3d=false&#13;&#10;-Xdock:name=&quot;Ghidra&quot;&#13;&#10;-Dvisualvm.display.name=Ghidra&#13;&#10;-Dpython.console.encoding=UTF-8&#13;&#10;--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
</launchConfiguration>
diff --git a/Ghidra/Features/Base/ghidra_scripts/PortableExecutableRichPrintScript.java b/Ghidra/Features/Base/ghidra_scripts/PortableExecutableRichPrintScript.java
index 01e7ea26d3..94e58a2714 100644
--- a/Ghidra/Features/Base/ghidra_scripts/PortableExecutableRichPrintScript.java
+++ b/Ghidra/Features/Base/ghidra_scripts/PortableExecutableRichPrintScript.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.stream.Collectors;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.script.GhidraScript;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.MemoryByteProvider;
@@ -48,8 +47,7 @@ public class PortableExecutableRichPrintScript extends GhidraScript {
PortableExecutable pe = null;
try {
- pe = PortableExecutable.createPortableExecutable(RethrowContinuesFactory.INSTANCE,
- provider, SectionLayout.MEMORY, false, false);
+ pe = new PortableExecutable(provider, SectionLayout.MEMORY, false, false);
}
catch (Exception e) {
printerr("Unable to create PE from current program");
diff --git a/Ghidra/Features/Base/ghidra_scripts/SplitUniversalBinariesScript.java b/Ghidra/Features/Base/ghidra_scripts/SplitUniversalBinariesScript.java
index 2b001be1ae..e32b339a78 100644
--- a/Ghidra/Features/Base/ghidra_scripts/SplitUniversalBinariesScript.java
+++ b/Ghidra/Features/Base/ghidra_scripts/SplitUniversalBinariesScript.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,9 @@
//are placed in the same directory with the processor name appended.
//@category Binary
-import generic.continues.RethrowContinuesFactory;
+import java.io.*;
+import java.util.List;
+
import ghidra.app.script.GhidraScript;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.RandomAccessByteProvider;
@@ -28,9 +29,6 @@ import ghidra.app.util.bin.format.ubi.FatArch;
import ghidra.app.util.bin.format.ubi.FatHeader;
import ghidra.program.model.lang.Processor;
-import java.io.*;
-import java.util.List;
-
public class SplitUniversalBinariesScript extends GhidraScript {
@@ -40,7 +38,7 @@ public class SplitUniversalBinariesScript extends GhidraScript {
File outputDirectory = askDirectory("Select Output Directory", "GO");
ByteProvider provider = new RandomAccessByteProvider(ubiFile) ;
- FatHeader header = FatHeader.createFatHeader(RethrowContinuesFactory.INSTANCE, provider);
+ FatHeader header = new FatHeader(provider);
List<FatArch> architectures = header.getArchitectures();
for (FatArch arch : architectures) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/MachoBinaryAnalysisCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/MachoBinaryAnalysisCommand.java
index 64dcb42cff..4bd91357b4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/MachoBinaryAnalysisCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/MachoBinaryAnalysisCommand.java
@@ -17,7 +17,6 @@ package ghidra.app.cmd.formats;
import java.util.List;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.plugin.core.analysis.AnalysisWorker;
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
import ghidra.app.util.bin.ByteProvider;
@@ -94,8 +93,8 @@ public class MachoBinaryAnalysisCommand extends FlatProgramAPI
program.getAddressFactory().getDefaultAddressSpace());
try {
- MachHeader header = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE,
- provider, getAddress(program).getOffset(), isRelativeToAddress);
+ MachHeader header =
+ new MachHeader(provider, getAddress(program).getOffset(), isRelativeToAddress);
header.parse();
Address machAddress = getAddress(program);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/PortableExecutableBinaryAnalysisCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/PortableExecutableBinaryAnalysisCommand.java
index 246818e10a..230910c58f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/PortableExecutableBinaryAnalysisCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/formats/PortableExecutableBinaryAnalysisCommand.java
@@ -18,12 +18,9 @@ package ghidra.app.cmd.formats;
import java.io.IOException;
import java.util.List;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.plugin.core.analysis.AnalysisWorker;
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
-import ghidra.app.util.bin.ByteProvider;
-import ghidra.app.util.bin.MemoryByteProvider;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.mz.DOSHeader;
import ghidra.app.util.bin.format.pe.*;
import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
@@ -56,10 +53,9 @@ public class PortableExecutableBinaryAnalysisCommand extends FlatProgramAPI
ByteProvider provider = new MemoryByteProvider(memory,
program.getAddressFactory().getDefaultAddressSpace());
- FactoryBundledWithBinaryReader reader = new FactoryBundledWithBinaryReader(
- RethrowContinuesFactory.INSTANCE, provider, !program.getLanguage().isBigEndian());
+ BinaryReader reader = new BinaryReader(provider, !program.getLanguage().isBigEndian());
- DOSHeader dosHeader = DOSHeader.createDOSHeader(reader);
+ DOSHeader dosHeader = new DOSHeader(reader);
if (dosHeader.isDosSignature()) {
@@ -82,9 +78,7 @@ public class PortableExecutableBinaryAnalysisCommand extends FlatProgramAPI
ByteProvider provider = new MemoryByteProvider(currentProgram.getMemory(),
program.getAddressFactory().getDefaultAddressSpace());
- PortableExecutable pe =
- PortableExecutable.createPortableExecutable(RethrowContinuesFactory.INSTANCE, provider,
- SectionLayout.FILE);
+ PortableExecutable pe = new PortableExecutable(provider, SectionLayout.FILE);
DOSHeader dos = pe.getDOSHeader();
if (dos == null || dos.e_magic() != DOSHeader.IMAGE_DOS_SIGNATURE) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/DwarfLineNumberAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/DwarfLineNumberAnalyzer.java
index 41d86665e5..66beaa74b5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/DwarfLineNumberAnalyzer.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/DwarfLineNumberAnalyzer.java
@@ -15,7 +15,10 @@
*/
package ghidra.app.plugin.core.analysis;
-import generic.continues.RethrowContinuesFactory;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
import ghidra.app.services.*;
import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.dwarf.DwarfSectionNames;
@@ -32,10 +35,6 @@ import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
public class DwarfLineNumberAnalyzer extends AbstractAnalyzer {
private static final String NAME = "DWARF Line Number";
private static final String DESCRIPTION = "Extracts DWARF debug line number information.";
@@ -114,8 +113,7 @@ public class DwarfLineNumberAnalyzer extends AbstractAnalyzer {
}
RandomAccessByteProvider provider = new RandomAccessByteProvider(dSymFile);
try {
- MachHeader header =
- MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
+ MachHeader header = new MachHeader(provider);
header.parse();
List<Section> allSections = header.getAllSections();
for (Section section : allSections) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MachoFunctionStartsAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MachoFunctionStartsAnalyzer.java
index 1df3961c75..7b8ace962c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MachoFunctionStartsAnalyzer.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/MachoFunctionStartsAnalyzer.java
@@ -19,7 +19,6 @@ import java.io.File;
import java.io.IOException;
import java.util.*;
-import generic.continues.GenericFactory;
import ghidra.app.cmd.function.CreateFunctionCmd;
import ghidra.app.services.*;
import ghidra.app.util.PseudoDisassembler;
@@ -29,7 +28,6 @@ import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.bin.format.macho.commands.*;
import ghidra.app.util.bin.format.macho.dyld.*;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.app.util.opinion.DyldCacheLoader;
import ghidra.app.util.opinion.MachoLoader;
import ghidra.framework.options.Options;
@@ -170,8 +168,7 @@ public class MachoFunctionStartsAnalyzer extends AbstractAnalyzer {
private void analyzeMachoFunctionStarts(Program program, ByteProvider provider,
AddressSetView set, TaskMonitor monitor, MessageLog log)
throws MachException, IOException, CancelledException {
- GenericFactory factory = MessageLogContinuesFactory.create(log);
- MachHeader header = MachHeader.createMachHeader(factory, provider);
+ MachHeader header = new MachHeader(provider);
header.parse();
monitor.setIndeterminate(true);
monitor.setMessage("Analyzing function starts...");
@@ -215,8 +212,7 @@ public class MachoFunctionStartsAnalyzer extends AbstractAnalyzer {
monitor.incrementProgress(1);
// Parse Mach-O header
- MachHeader machoHeader = MachHeader.createMachHeader(
- MessageLogContinuesFactory.create(log), providerMap.get(dyldCacheHeader),
+ MachHeader machoHeader = new MachHeader(providerMap.get(dyldCacheHeader),
mappedImage.getAddress() - dyldCacheHeader.getBaseAddress(), false);
machoHeader.parse();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/FactoryBundledWithBinaryReader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/FactoryBundledWithBinaryReader.java
deleted file mode 100644
index a48090f9a5..0000000000
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/FactoryBundledWithBinaryReader.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ghidra.app.util.bin.format;
-
-import generic.continues.*;
-import ghidra.app.util.bin.*;
-
-public class FactoryBundledWithBinaryReader extends BinaryReader {
- private final GenericFactory factory;
-
- public GenericFactory getFactory() {
- return factory;
- }
-
- public FactoryBundledWithBinaryReader(GenericFactory factory,
- ByteProvider provider, boolean isLittleEndian) {
- super(provider, isLittleEndian);
- if (factory == null) {
- throw new IllegalArgumentException("factory == null not allowed");
- }
- this.factory = factory;
- }
-}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DSymSectionProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DSymSectionProvider.java
index c61e3a1f6c..aa1a52c863 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DSymSectionProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DSymSectionProvider.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.macho.*;
import ghidra.app.util.opinion.MachoLoader;
@@ -62,7 +61,7 @@ public class DSymSectionProvider implements DWARFSectionProvider {
public DSymSectionProvider(File dsymFile) throws IOException, MachException {
this.provider = new RandomAccessByteProvider(dsymFile);
- machHeader = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
+ machHeader = new MachHeader(provider);
machHeader.parse();
for (Section s : machHeader.getAllSections()) {
// strip leading "_"'s from section name to normalize
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/MachHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/MachHeader.java
index bb2939ede5..b17ca07648 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/MachHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/MachHeader.java
@@ -19,9 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import generic.continues.GenericFactory;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.macho.commands.*;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -44,7 +42,7 @@ public class MachHeader implements StructConverter {
private boolean _is32bit;
private List<LoadCommand> _commands = new ArrayList<>();
private long _commandIndex;
- private FactoryBundledWithBinaryReader _reader;
+ private BinaryReader _reader;
private long _machHeaderStartIndexInProvider;
private long _machHeaderStartIndex = 0;
private boolean _parsed = false;
@@ -65,58 +63,49 @@ public class MachHeader implements StructConverter {
}
return false;
}
+
/**
- * Assumes the MachHeader starts at index 0 in the ByteProvider.
+ * Creates a new {@link MachHeader}. Assumes the MachHeader starts at index 0 in the
+ * ByteProvider.
+ *
* @param provider the ByteProvider
* @throws IOException if an I/O error occurs while reading from the ByteProvider
* @throws MachException if an invalid MachHeader is detected
*/
- public static MachHeader createMachHeader(GenericFactory factory, ByteProvider provider)
- throws IOException, MachException {
- return createMachHeader(factory, provider, 0);
+ public MachHeader(ByteProvider provider) throws IOException, MachException {
+ this(provider, 0);
}
/**
- * Assumes the MachHeader starts at index <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
+ * Creates a new {@link MachHeader}. Assumes the MachHeader starts at index
+ * <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
+ *
* @param provider the ByteProvider
- * @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader begins.
+ * @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader
+ * begins
* @throws IOException if an I/O error occurs while reading from the ByteProvider
* @throws MachException if an invalid MachHeader is detected
*/
- public static MachHeader createMachHeader(GenericFactory factory, ByteProvider provider,
- long machHeaderStartIndexInProvider) throws IOException, MachException {
- MachHeader machHeader = (MachHeader) factory.create(MachHeader.class);
- machHeader.initMachHeader(factory, provider, machHeaderStartIndexInProvider, true);
- return machHeader;
+ public MachHeader(ByteProvider provider, long machHeaderStartIndexInProvider)
+ throws IOException, MachException {
+ this(provider, machHeaderStartIndexInProvider, true);
}
/**
- * Assumes the MachHeader starts at index <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
+ * Creatse a new {@link MachHeader}. Assumes the MachHeader starts at index
+ * <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
+ *
* @param provider the ByteProvider
- * @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader begins.
- * @param isRemainingMachoRelativeToStartIndex TRUE if the rest of the macho uses relative indexing. This is common in UBI and kernel cache files.
- * FALSE if the rest of the file uses absolute indexing from 0. This is common in DYLD cache files.
+ * @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader
+ * begins.
+ * @param isRemainingMachoRelativeToStartIndex true if the rest of the macho uses relative
+ * indexin (this is common in UBI and kernel cache files); otherwise, false if the rest of the
+ * file uses absolute indexing from 0 (this is common in DYLD cache files)
* @throws IOException if an I/O error occurs while reading from the ByteProvider
* @throws MachException if an invalid MachHeader is detected
*/
- public static MachHeader createMachHeader(GenericFactory factory, ByteProvider provider,
- long machHeaderStartIndexInProvider, boolean isRemainingMachoRelativeToStartIndex)
- throws IOException, MachException {
- MachHeader machHeader = (MachHeader) factory.create(MachHeader.class);
- machHeader.initMachHeader(factory, provider, machHeaderStartIndexInProvider,
- isRemainingMachoRelativeToStartIndex);
- return machHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public MachHeader() {
- }
-
- private void initMachHeader(GenericFactory factory, ByteProvider provider,
- long machHeaderStartIndexInProvider, boolean isRemainingMachoRelativeToStartIndex)
- throws IOException, MachException {
+ public MachHeader(ByteProvider provider, long machHeaderStartIndexInProvider,
+ boolean isRemainingMachoRelativeToStartIndex) throws IOException, MachException {
magic = readMagic(provider, machHeaderStartIndexInProvider);
if (!MachConstants.isMagic(magic)) {
@@ -128,7 +117,7 @@ public class MachHeader implements StructConverter {
}
_machHeaderStartIndexInProvider = machHeaderStartIndexInProvider;
- _reader = new FactoryBundledWithBinaryReader(factory, provider, isLittleEndian());
+ _reader = new BinaryReader(provider, isLittleEndian());
_reader.setPointerIndex(machHeaderStartIndexInProvider + 4);//skip magic number...
cpuType = _reader.readNextInt();
@@ -219,13 +208,17 @@ public class MachHeader implements StructConverter {
* Returns the start index that should be used for calculating offsets.
* This will be 0 for things such as the dyld shared cache where offsets are
* based off the beginning of the file.
+ *
+ * @return the start index that should be used for calculating offsets
*/
public long getStartIndex() {
return _machHeaderStartIndex;
}
/**
- * Returns offset of MachHeader in the ByteProvider
+ * Returns the offset of the MachHeader in the ByteProvider
+ *
+ * @return the offset of the MachHeader in the ByteProvider
*/
public long getStartIndexInProvider() {
return _machHeaderStartIndexInProvider;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/RelocationInfo.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/RelocationInfo.java
index aac0ad7936..23edcef4c1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/RelocationInfo.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/RelocationInfo.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho;
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.exception.DuplicateNameException;
@@ -72,19 +72,7 @@ public class RelocationInfo implements StructConverter {
*/
private int r_type;
- public static RelocationInfo createRelocationInfo(FactoryBundledWithBinaryReader reader)
- throws IOException {
- RelocationInfo relocationInfo =
- (RelocationInfo) reader.getFactory().create(RelocationInfo.class);
- relocationInfo.initRelocationInfo(reader);
- return relocationInfo;
- }
-
- public RelocationInfo() {
- }
-
- private void initRelocationInfo(FactoryBundledWithBinaryReader reader) throws IOException {
-
+ public RelocationInfo(BinaryReader reader) throws IOException {
int i1 = reader.readNextInt();
int i2 = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/Section.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/Section.java
index 7a2ee4efe9..3d523ff733 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/Section.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/Section.java
@@ -20,8 +20,8 @@ import java.io.InputStream;
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.macho.commands.SegmentNames;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -46,25 +46,11 @@ public class Section implements StructConverter {
private int reserved2;
private int reserved3;//only used for 64 bit
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private boolean is32bit;
private List<RelocationInfo> relocations = new ArrayList<>();
- public static Section createSection(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
- Section section = (Section) reader.getFactory().create(Section.class);
- section.initSection(reader, is32bit);
- return section;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public Section() {
- }
-
- private void initSection(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
+ public Section(BinaryReader reader, boolean is32bit) throws IOException {
this.reader = reader;
this.is32bit = is32bit;
@@ -93,7 +79,7 @@ public class Section implements StructConverter {
long index = reader.getPointerIndex();
reader.setPointerIndex(reloff);
for (int i = 0; i < nrelocs; ++i) {
- relocations.add(RelocationInfo.createRelocationInfo(reader));
+ relocations.add(new RelocationInfo(reader));
}
reader.setPointerIndex(index);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/BuildVersionCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/BuildVersionCommand.java
index fa918132d3..9cab240917 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/BuildVersionCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/BuildVersionCommand.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -42,22 +42,7 @@ public class BuildVersionCommand extends LoadCommand {
private int ntools;
private BuildToolVersion[] buildToolVersions;
- static BuildVersionCommand createBuildVersionCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
-
- BuildVersionCommand command =
- (BuildVersionCommand) reader.getFactory().create(BuildVersionCommand.class);
- command.initEntryPointCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public BuildVersionCommand() {
- }
-
- private void initEntryPointCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ BuildVersionCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
platform = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupHeader.java
index 4a1361fa34..049c86e440 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupHeader.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -41,22 +41,7 @@ public class DyldChainedFixupHeader implements StructConverter {
DyldChainedStartsInImage chainedStartsInImage;
DyldChainedImports chainedImports;
- static DyldChainedFixupHeader createDyldChainedFixupHeader(
- FactoryBundledWithBinaryReader reader) throws IOException {
- DyldChainedFixupHeader dyldChainedFixupHeader =
- (DyldChainedFixupHeader) reader.getFactory().create(DyldChainedFixupHeader.class);
- dyldChainedFixupHeader.initDyldChainedFixupHeader(reader);
- return dyldChainedFixupHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldChainedFixupHeader() {
- }
-
- private void initDyldChainedFixupHeader(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ DyldChainedFixupHeader(BinaryReader reader) throws IOException {
long ptrIndex = reader.getPointerIndex();
fixups_version = reader.readNextInt();
@@ -68,10 +53,10 @@ public class DyldChainedFixupHeader implements StructConverter {
symbols_format = reader.readNextInt();
reader.setPointerIndex(ptrIndex + starts_offset);
- chainedStartsInImage = DyldChainedStartsInImage.createDyldChainedStartsInImage(reader);
+ chainedStartsInImage = new DyldChainedStartsInImage(reader);
reader.setPointerIndex(ptrIndex + imports_offset);
- chainedImports = DyldChainedImports.createDyldChainedImports(reader, this);
+ chainedImports = new DyldChainedImports(reader, this);
reader.setPointerIndex(ptrIndex + symbols_offset);
chainedImports.initSymbols(reader, this);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupsCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupsCommand.java
index da4e8a62ef..06dc772aae 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupsCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedFixupsCommand.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.flatapi.FlatProgramAPI;
@@ -38,24 +38,13 @@ public class DyldChainedFixupsCommand extends LinkEditDataCommand {
private DyldChainedFixupHeader chainHeader;
- static LinkEditDataCommand createDyldChainedFixupsCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- DyldChainedFixupsCommand command =
- (DyldChainedFixupsCommand) reader.getFactory().create(DyldChainedFixupsCommand.class);
- command.initLinkEditDataCommand(reader);
+ DyldChainedFixupsCommand(BinaryReader reader) throws IOException {
+ super(reader);
long ptrIndex = reader.getPointerIndex();
- reader.setPointerIndex(command.getDataOffset());
- command.chainHeader = DyldChainedFixupHeader.createDyldChainedFixupHeader(reader);
+ reader.setPointerIndex(getDataOffset());
+ chainHeader = new DyldChainedFixupHeader(reader);
reader.setPointerIndex(ptrIndex);
-
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldChainedFixupsCommand() {
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImport.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImport.java
index 68441a94dd..1a34059215 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImport.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImport.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -40,25 +40,10 @@ public class DyldChainedImport implements StructConverter {
private long addend;
private String symbolName;
- static DyldChainedImport createDyldChainedImport(FactoryBundledWithBinaryReader reader,
- DyldChainedFixupHeader cfh, int imports_format) throws IOException {
- DyldChainedImport dyldChainedImport =
- (DyldChainedImport) reader.getFactory().create(DyldChainedImport.class);
- dyldChainedImport.initDyldChainedImport(reader, cfh, imports_format);
- return dyldChainedImport;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldChainedImport() {
- }
-
- private void initDyldChainedImport(FactoryBundledWithBinaryReader reader,
- DyldChainedFixupHeader cfh, int format) throws IOException {
-
- this.imports_format = format;
- switch (format) {
+ DyldChainedImport(BinaryReader reader, DyldChainedFixupHeader cfh, int imports_format)
+ throws IOException {
+ this.imports_format = imports_format;
+ switch (imports_format) {
case DYLD_CHAINED_IMPORT: {
int ival = reader.readNextInt();
lib_ordinal = ival & 0xff;
@@ -83,7 +68,7 @@ public class DyldChainedImport implements StructConverter {
break;
}
default:
- throw new IOException("Bad Chained import format: " + format);
+ throw new IOException("Bad Chained import format: " + imports_format);
}
}
@@ -142,7 +127,7 @@ public class DyldChainedImport implements StructConverter {
return symbolName;
}
- public void initString(FactoryBundledWithBinaryReader reader) throws IOException {
+ public void initString(BinaryReader reader) throws IOException {
symbolName = reader.readNextNullTerminatedAsciiString();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImports.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImports.java
index de4e1e895b..5f609bcfd1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImports.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedImports.java
@@ -18,8 +18,8 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.ArrayDataType;
import ghidra.program.model.data.DataType;
import ghidra.util.exception.DuplicateNameException;
@@ -36,23 +36,7 @@ public class DyldChainedImports implements StructConverter {
private long imports_offset;
private DyldChainedImport chainedImports[];
- static DyldChainedImports createDyldChainedImports(FactoryBundledWithBinaryReader reader,
- DyldChainedFixupHeader cfh) throws IOException {
- DyldChainedImports dyldChainedImports =
- (DyldChainedImports) reader.getFactory().create(DyldChainedImports.class);
- dyldChainedImports.initDyldChainedStartsInImage(reader, cfh);
- return dyldChainedImports;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldChainedImports() {
- }
-
- private void initDyldChainedStartsInImage(FactoryBundledWithBinaryReader reader,
- DyldChainedFixupHeader cfh) throws IOException {
-
+ DyldChainedImports(BinaryReader reader, DyldChainedFixupHeader cfh) throws IOException {
long ptrIndex = reader.getPointerIndex();
imports_offset = ptrIndex;
@@ -61,7 +45,7 @@ public class DyldChainedImports implements StructConverter {
ArrayList<DyldChainedImport> starts = new ArrayList<>();
for (int i = 0; i < imports_count; i++) {
- starts.add(DyldChainedImport.createDyldChainedImport(reader, cfh, imports_format));
+ starts.add(new DyldChainedImport(reader, cfh, imports_format));
}
chainedImports = starts.toArray(DyldChainedImport[]::new);
}
@@ -94,8 +78,8 @@ public class DyldChainedImports implements StructConverter {
return chainedImports[ordinal];
}
- public void initSymbols(FactoryBundledWithBinaryReader reader,
- DyldChainedFixupHeader dyldChainedFixupHeader) throws IOException {
+ public void initSymbols(BinaryReader reader, DyldChainedFixupHeader dyldChainedFixupHeader)
+ throws IOException {
long ptrIndex = reader.getPointerIndex();
for (DyldChainedImport dyldChainedImport : chainedImports) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInImage.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInImage.java
index 42ac1a79b7..675700de91 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInImage.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInImage.java
@@ -18,8 +18,8 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
import java.util.ArrayList;
+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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -36,22 +36,7 @@ public class DyldChainedStartsInImage implements StructConverter {
private DyldChainedStartsInSegment chainedStarts[];
- static DyldChainedStartsInImage createDyldChainedStartsInImage(
- FactoryBundledWithBinaryReader reader) throws IOException {
- DyldChainedStartsInImage dyldChainedStartsInImage =
- (DyldChainedStartsInImage) reader.getFactory().create(DyldChainedStartsInImage.class);
- dyldChainedStartsInImage.initDyldChainedStartsInImage(reader);
- return dyldChainedStartsInImage;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldChainedStartsInImage() {
- }
-
- private void initDyldChainedStartsInImage(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ DyldChainedStartsInImage(BinaryReader reader) throws IOException {
long ptrIndex = reader.getPointerIndex();
@@ -62,7 +47,7 @@ public class DyldChainedStartsInImage implements StructConverter {
for (int off : seg_info_offset) {
reader.setPointerIndex(ptrIndex + off);
- starts.add(DyldChainedStartsInSegment.createDyldChainedFixupHeader(reader));
+ starts.add(new DyldChainedStartsInSegment(reader));
}
chainedStarts = starts.toArray(DyldChainedStartsInSegment[]::new);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInSegment.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInSegment.java
index effce5f1e7..f907b4371a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInSegment.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldChainedStartsInSegment.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -39,23 +39,7 @@ public class DyldChainedStartsInSegment implements StructConverter {
private short page_starts[]; // each entry is offset in each page of first element in chain
private short chain_starts[]; // TODO: used for some 32-bit formats with multiple starts per page
- static DyldChainedStartsInSegment createDyldChainedFixupHeader(
- FactoryBundledWithBinaryReader reader) throws IOException {
- DyldChainedStartsInSegment dyldChainedFixupHeader =
- (DyldChainedStartsInSegment) reader.getFactory().create(
- DyldChainedStartsInSegment.class);
- dyldChainedFixupHeader.initDyldChainedStartsInSegment(reader);
- return dyldChainedFixupHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldChainedStartsInSegment() {
- }
-
- private void initDyldChainedStartsInSegment(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ DyldChainedStartsInSegment(BinaryReader reader) throws IOException {
size = reader.readNextInt();
page_size = reader.readNextShort();
pointer_format = reader.readNextShort();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldInfoCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldInfoCommand.java
index 9492601ade..78e48c2d81 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldInfoCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DyldInfoCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -45,21 +45,7 @@ public class DyldInfoCommand extends LoadCommand {
private int export_off;
private int export_size;
- static DyldInfoCommand createDyldInfoCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- DyldInfoCommand command =
- (DyldInfoCommand) reader.getFactory().create(DyldInfoCommand.class);
- command.initDyldInfoCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DyldInfoCommand() {
- }
-
- private void initDyldInfoCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ DyldInfoCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
rebase_off = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibrary.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibrary.java
index 866f218812..ef7a75a9ac 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibrary.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibrary.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -34,23 +34,8 @@ public class DynamicLibrary implements StructConverter {
private int current_version;
private int compatibility_version;
- public static DynamicLibrary createDynamicLibrary(FactoryBundledWithBinaryReader reader,
- LoadCommand command) throws IOException {
- DynamicLibrary dynamicLibrary =
- (DynamicLibrary) reader.getFactory().create(DynamicLibrary.class);
- dynamicLibrary.initDynamicLibrary(reader, command);
- return dynamicLibrary;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DynamicLibrary() {
- }
-
- private void initDynamicLibrary(FactoryBundledWithBinaryReader reader, LoadCommand command)
- throws IOException {
- name = LoadCommandString.createLoadCommandString(reader, command);
+ public DynamicLibrary(BinaryReader reader, LoadCommand command) throws IOException {
+ name = new LoadCommandString(reader, command);
timestamp = reader.readNextInt();
current_version = reader.readNextInt();
compatibility_version = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryCommand.java
index 5ec7aadb4d..4f2661052a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,24 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class DynamicLibraryCommand extends LoadCommand {
private DynamicLibrary dylib;
- static DynamicLibraryCommand createDynamicLibraryCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- DynamicLibraryCommand dynamicLibraryCommand =
- (DynamicLibraryCommand) reader.getFactory().create(DynamicLibraryCommand.class);
- dynamicLibraryCommand.initDynamicLibraryCommand(reader);
- return dynamicLibraryCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DynamicLibraryCommand() {
- }
-
- private void initDynamicLibraryCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ DynamicLibraryCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- dylib = DynamicLibrary.createDynamicLibrary(reader, this);
+ dylib = new DynamicLibrary(reader, this);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryModule.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryModule.java
index 03d4c2df71..ef1970c2ec 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryModule.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryModule.java
@@ -15,13 +15,14 @@
*/
package ghidra.app.util.bin.format.macho.commands;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
-import ghidra.app.util.bin.format.macho.*;
-import ghidra.program.model.data.*;
-import ghidra.util.exception.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.StructConverter;
+import ghidra.app.util.bin.format.macho.MachConstants;
+import ghidra.app.util.bin.format.macho.MachHeader;
+import ghidra.program.model.data.*;
+import ghidra.util.exception.DuplicateNameException;
public class DynamicLibraryModule implements StructConverter {
private int module_name; // the module name (index into string table)
@@ -41,20 +42,7 @@ public class DynamicLibraryModule implements StructConverter {
private boolean is32bit;
private String moduleName;
- public static DynamicLibraryModule createDynamicLibraryModule(
- FactoryBundledWithBinaryReader reader, MachHeader header)
- throws IOException {
- DynamicLibraryModule dynamicLibraryModule = (DynamicLibraryModule) reader.getFactory().create(DynamicLibraryModule.class);
- dynamicLibraryModule.initDynamicLibraryModule(reader, header);
- return dynamicLibraryModule;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DynamicLibraryModule() {}
-
- private void initDynamicLibraryModule(FactoryBundledWithBinaryReader reader, MachHeader header) throws IOException {
+ public DynamicLibraryModule(BinaryReader reader, MachHeader header) throws IOException {
this.is32bit = header.is32bit();
module_name = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryReference.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryReference.java
index 16b581a89f..4e69f28c13 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryReference.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLibraryReference.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -32,22 +32,7 @@ public class DynamicLibraryReference implements StructConverter {
private int isym;
private int flags;
- static DynamicLibraryReference createDynamicLibraryReference(
- FactoryBundledWithBinaryReader reader) throws IOException {
- DynamicLibraryReference dynamicLibraryReference =
- (DynamicLibraryReference) reader.getFactory().create(DynamicLibraryReference.class);
- dynamicLibraryReference.initDynamicLibraryReference(reader);
- return dynamicLibraryReference;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DynamicLibraryReference() {
- }
-
- private void initDynamicLibraryReference(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ DynamicLibraryReference(BinaryReader reader) throws IOException {
int value = reader.readNextInt();
if (reader.isLittleEndian()) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLinkerCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLinkerCommand.java
index 3d954ba3b1..3aa38c6729 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLinkerCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicLinkerCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,24 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class DynamicLinkerCommand extends LoadCommand {
private LoadCommandString name;
- public static DynamicLinkerCommand createDynamicLinkerCommand(
- FactoryBundledWithBinaryReader reader) throws IOException {
- DynamicLinkerCommand dynamicLinkerCommand =
- (DynamicLinkerCommand) reader.getFactory().create(DynamicLinkerCommand.class);
- dynamicLinkerCommand.initDynamicLinkerCommand(reader);
- return dynamicLinkerCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DynamicLinkerCommand() {
- }
-
- private void initDynamicLinkerCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ public DynamicLinkerCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- name = LoadCommandString.createLoadCommandString(reader, this);
+ name = new LoadCommandString(reader, this);
}
public LoadCommandString getLoadCommandString() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicSymbolTableCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicSymbolTableCommand.java
index f7264c6d04..17fd34c5fb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicSymbolTableCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/DynamicSymbolTableCommand.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.*;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.flatapi.FlatProgramAPI;
@@ -65,22 +65,7 @@ public class DynamicSymbolTableCommand extends LoadCommand {
private List<RelocationInfo> externalRelocations = new ArrayList<RelocationInfo>();
private List<RelocationInfo> localRelocations = new ArrayList<RelocationInfo>();
- static DynamicSymbolTableCommand createDynamicSymbolTableCommand(
- FactoryBundledWithBinaryReader reader, MachHeader header) throws IOException {
- DynamicSymbolTableCommand command =
- (DynamicSymbolTableCommand) reader.getFactory().create(DynamicSymbolTableCommand.class);
- command.initDynamicSymbolTableCommand(reader, header);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DynamicSymbolTableCommand() {
- }
-
- private void initDynamicSymbolTableCommand(FactoryBundledWithBinaryReader reader,
- MachHeader header) throws IOException {
+ DynamicSymbolTableCommand(BinaryReader reader, MachHeader header) throws IOException {
initLoadCommand(reader);
ilocalsym = reader.readNextInt();
@@ -107,19 +92,19 @@ public class DynamicSymbolTableCommand extends LoadCommand {
if (tocoff > 0) {
reader.setPointerIndex(header.getStartIndex() + tocoff);
for (int i = 0; i < ntoc; ++i) {
- tocList.add(TableOfContents.createTableOfContents(reader));
+ tocList.add(new TableOfContents(reader));
}
}
if (modtaboff > 0) {
reader.setPointerIndex(header.getStartIndex() + modtaboff);
for (int i = 0; i < nmodtab; ++i) {
- moduleList.add(DynamicLibraryModule.createDynamicLibraryModule(reader, header));
+ moduleList.add(new DynamicLibraryModule(reader, header));
}
}
if (extrefsymoff > 0) {
reader.setPointerIndex(header.getStartIndex() + extrefsymoff);
for (int i = 0; i < nextrefsyms; ++i) {
- referencedList.add(DynamicLibraryReference.createDynamicLibraryReference(reader));
+ referencedList.add(new DynamicLibraryReference(reader));
}
}
if (indirectsymoff > 0) {
@@ -132,13 +117,13 @@ public class DynamicSymbolTableCommand extends LoadCommand {
if (extreloff > 0) {
reader.setPointerIndex(header.getStartIndex() + extreloff);
for (int i = 0; i < nextrel; ++i) {
- externalRelocations.add(RelocationInfo.createRelocationInfo(reader));
+ externalRelocations.add(new RelocationInfo(reader));
}
}
if (locreloff > 0) {
reader.setPointerIndex(header.getStartIndex() + locreloff);
for (int i = 0; i < nlocrel; ++i) {
- localRelocations.add(RelocationInfo.createRelocationInfo(reader));
+ localRelocations.add(new RelocationInfo(reader));
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EncryptedInformationCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EncryptedInformationCommand.java
index 0fbb222f3b..de8551b9c6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EncryptedInformationCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EncryptedInformationCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -40,26 +40,10 @@ public class EncryptedInformationCommand extends LoadCommand {
private boolean is32bit;
- static EncryptedInformationCommand createEncryptedInformationCommand(
- FactoryBundledWithBinaryReader reader, boolean is32bit) throws IOException {
- EncryptedInformationCommand command =
- (EncryptedInformationCommand) reader.getFactory().create(
- EncryptedInformationCommand.class);
- command.initEncryptedInformationCommand(reader, is32bit);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public EncryptedInformationCommand() {
- }
-
- private void initEncryptedInformationCommand(FactoryBundledWithBinaryReader reader,
- boolean is32bit) throws IOException {
+ EncryptedInformationCommand(BinaryReader reader, boolean is32bit) throws IOException {
initLoadCommand(reader);
this.is32bit = is32bit;
-
+
cryptoff = reader.readNextInt();
cryptsize = reader.readNextInt();
cryptid = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EntryPointCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EntryPointCommand.java
index 8c5b4470ca..1eff7b9547 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EntryPointCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/EntryPointCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -37,22 +37,7 @@ public class EntryPointCommand extends LoadCommand {
private long entryOffset;
private long stackSize;
- static EntryPointCommand createEntryPointCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
-
- EntryPointCommand command =
- (EntryPointCommand) reader.getFactory().create(EntryPointCommand.class);
- command.initEntryPointCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public EntryPointCommand() {
- }
-
- private void initEntryPointCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ EntryPointCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
entryOffset = reader.readNextLong();
stackSize = reader.readNextLong();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FileSetEntryCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FileSetEntryCommand.java
index 02aa49405d..06a83492b1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FileSetEntryCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FileSetEntryCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -42,22 +42,7 @@ public class FileSetEntryCommand extends LoadCommand {
boolean is32bit;
- public static FileSetEntryCommand createFileSetEntryCommand(
- FactoryBundledWithBinaryReader reader, boolean is32bit) throws IOException {
- FileSetEntryCommand filesetEntryCommand =
- (FileSetEntryCommand) reader.getFactory().create(FileSetEntryCommand.class);
- filesetEntryCommand.initFileSetEntryCommand(reader, is32bit);
- return filesetEntryCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FileSetEntryCommand() {
- }
-
- private void initFileSetEntryCommand(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
+ public FileSetEntryCommand(BinaryReader reader, boolean is32bit) throws IOException {
initLoadCommand(reader);
this.is32bit = is32bit;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemoryFileCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemoryFileCommand.java
index deed5ec5ea..26b0d3d03a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemoryFileCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemoryFileCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -37,23 +37,7 @@ public class FixedVirtualMemoryFileCommand extends LoadCommand {
private LoadCommandString name;
private int header_addr;
- public static FixedVirtualMemoryFileCommand createFixedVirtualMemoryFileCommand(
- FactoryBundledWithBinaryReader reader) throws IOException {
- FixedVirtualMemoryFileCommand command =
- (FixedVirtualMemoryFileCommand) reader.getFactory().create(
- FixedVirtualMemoryFileCommand.class);
- command.initFixedVirtualMemoryFileCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FixedVirtualMemoryFileCommand() {
- }
-
- private void initFixedVirtualMemoryFileCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ public FixedVirtualMemoryFileCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemorySharedLibraryCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemorySharedLibraryCommand.java
index 45e33c2b9a..ab7e04230e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemorySharedLibraryCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FixedVirtualMemorySharedLibraryCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachException;
/**
@@ -27,24 +27,8 @@ import ghidra.app.util.bin.format.macho.MachException;
*/
public class FixedVirtualMemorySharedLibraryCommand extends ObsoleteCommand {
- static FixedVirtualMemorySharedLibraryCommand createFixedVirtualMemorySharedLibraryCommand(
- FactoryBundledWithBinaryReader reader) throws IOException, MachException {
- FixedVirtualMemorySharedLibraryCommand command =
- (FixedVirtualMemorySharedLibraryCommand) reader.getFactory().create(
- FixedVirtualMemorySharedLibraryCommand.class);
- command.initFixedVirtualMemorySharedLibraryCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FixedVirtualMemorySharedLibraryCommand() {
- }
-
- private void initFixedVirtualMemorySharedLibraryCommand(FactoryBundledWithBinaryReader reader)
- throws IOException, MachException {
- initObsoleteCommand(reader);
+ FixedVirtualMemorySharedLibraryCommand(BinaryReader reader) throws IOException, MachException {
+ super(reader);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FunctionStartsCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FunctionStartsCommand.java
index 0c2d52c1c6..87bf7475a6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FunctionStartsCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/FunctionStartsCommand.java
@@ -21,7 +21,6 @@ import java.util.List;
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.dwarf4.LEB128;
import ghidra.program.model.address.Address;
@@ -32,18 +31,8 @@ import ghidra.program.model.address.Address;
*/
public class FunctionStartsCommand extends LinkEditDataCommand {
- static FunctionStartsCommand createFunctionStartsCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- FunctionStartsCommand command =
- (FunctionStartsCommand) reader.getFactory().create(FunctionStartsCommand.class);
- command.initLinkEditDataCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FunctionStartsCommand() {
+ FunctionStartsCommand(BinaryReader reader) throws IOException {
+ super(reader);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/IdentCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/IdentCommand.java
index 44a9f072e1..a854b4c034 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/IdentCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/IdentCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachException;
/**
@@ -27,22 +27,8 @@ import ghidra.app.util.bin.format.macho.MachException;
*/
public class IdentCommand extends ObsoleteCommand {
- static IdentCommand createIdentCommand(FactoryBundledWithBinaryReader reader)
- throws IOException, MachException {
- IdentCommand identCommand = (IdentCommand) reader.getFactory().create(IdentCommand.class);
- identCommand.initIdentCommand(reader);
- return identCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public IdentCommand() {
- }
-
- private void initIdentCommand(FactoryBundledWithBinaryReader reader)
- throws IOException, MachException {
- initObsoleteCommand(reader);
+ IdentCommand(BinaryReader reader) throws IOException, MachException {
+ super(reader);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkEditDataCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkEditDataCommand.java
index 09bfbc378d..c5b739059a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkEditDataCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkEditDataCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -37,22 +37,7 @@ public class LinkEditDataCommand extends LoadCommand {
private int dataoff;
private int datasize;
- static LinkEditDataCommand createLinkEditDataCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- LinkEditDataCommand command =
- (LinkEditDataCommand) reader.getFactory().create(LinkEditDataCommand.class);
- command.initLinkEditDataCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public LinkEditDataCommand() {
- }
-
- protected void initLinkEditDataCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ LinkEditDataCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
dataoff = reader.readNextInt();
datasize = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkerOptionCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkerOptionCommand.java
index cfa0faea58..e292cf261e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkerOptionCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LinkerOptionCommand.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.flatapi.FlatProgramAPI;
@@ -40,22 +40,7 @@ public class LinkerOptionCommand extends LoadCommand {
private int count;
private List<String> linkerOptions;
- static LinkerOptionCommand createLinkerOptionCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
-
- LinkerOptionCommand command =
- (LinkerOptionCommand) reader.getFactory().create(LinkerOptionCommand.class);
- command.initLinkerOptionCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public LinkerOptionCommand() {
- }
-
- private void initLinkerOptionCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ LinkerOptionCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
count = reader.readNextInt();
linkerOptions = new ArrayList<>(count);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommand.java
index 9f73cb5a6a..bb6990be68 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommand.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.flatapi.FlatProgramAPI;
@@ -37,10 +37,7 @@ public abstract class LoadCommand implements StructConverter {
private int cmd;
private int cmdsize;
- public LoadCommand() {
- }
-
- protected void initLoadCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ protected void initLoadCommand(BinaryReader reader) throws IOException {
startIndex = reader.getPointerIndex();
cmd = reader.readNextInt();
cmdsize = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandString.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandString.java
index 62fe5bbc4f..80ed7f5f63 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandString.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandString.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -32,23 +32,7 @@ public class LoadCommandString implements StructConverter {
private int offset;
private String string;
- static LoadCommandString createLoadCommandString(FactoryBundledWithBinaryReader reader,
- LoadCommand command) throws IOException {
- LoadCommandString loadCommandString =
- (LoadCommandString) reader.getFactory().create(LoadCommandString.class);
- loadCommandString.initLoadCommandString(reader, command);
- return loadCommandString;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY
- * METHODS INSTEAD.
- */
- public LoadCommandString() {
- }
-
- private void initLoadCommandString(FactoryBundledWithBinaryReader reader, LoadCommand command)
- throws IOException {
+ LoadCommandString(BinaryReader reader, LoadCommand command) throws IOException {
offset = reader.readNextInt();
string = reader.readAsciiString(command.getStartIndex() + offset);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandTypes.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandTypes.java
index 129db8aed2..bca6384ef6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandTypes.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/LoadCommandTypes.java
@@ -19,7 +19,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
import java.lang.reflect.Field;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachException;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.bin.format.macho.threadcommand.ThreadCommand;
@@ -30,145 +30,143 @@ import ghidra.util.Msg;
*/
public final class LoadCommandTypes {
- public static LoadCommand getLoadCommand(FactoryBundledWithBinaryReader reader,
- MachHeader header) throws IOException, MachException {
+ public static LoadCommand getLoadCommand(BinaryReader reader, MachHeader header)
+ throws IOException, MachException {
int type = reader.peekNextInt();
switch (type) {
case LC_SEGMENT: {
- return SegmentCommand.createSegmentCommand(reader, header.is32bit());
+ return new SegmentCommand(reader, header.is32bit());
}
case LC_SYMTAB: {
- return SymbolTableCommand.createSymbolTableCommand(reader, header);
+ return new SymbolTableCommand(reader, header);
}
case LC_SYMSEG: {
- return SymbolCommand.createSymbolCommand(reader);
+ return new SymbolCommand(reader);
}
case LC_THREAD:
case LC_UNIXTHREAD: {
- return ThreadCommand.createThreadCommand(reader, header);
+ return new ThreadCommand(reader, header);
}
case LC_LOADFVMLIB:
case LC_IDFVMLIB: {
- return FixedVirtualMemorySharedLibraryCommand
- .createFixedVirtualMemorySharedLibraryCommand(reader);
+ return new FixedVirtualMemorySharedLibraryCommand(reader);
}
case LC_IDENT: {
- return IdentCommand.createIdentCommand(reader);
+ return new IdentCommand(reader);
}
case LC_FVMFILE: {
- return FixedVirtualMemoryFileCommand.createFixedVirtualMemoryFileCommand(reader);
+ return new FixedVirtualMemoryFileCommand(reader);
}
case LC_PREPAGE: {
- return UnsupportedLoadCommand.createUnsupportedLoadCommand(reader, type);
+ return new UnsupportedLoadCommand(reader, type);
}
case LC_DYSYMTAB: {
- return DynamicSymbolTableCommand.createDynamicSymbolTableCommand(reader, header);
+ return new DynamicSymbolTableCommand(reader, header);
}
case LC_LOAD_DYLIB:
case LC_ID_DYLIB:
case LC_LOAD_UPWARD_DYLIB:
case LC_DYLD_ENVIRONMENT: {
- return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
+ return new DynamicLibraryCommand(reader);
}
case LC_LOAD_DYLINKER:
case LC_ID_DYLINKER: {
- return DynamicLinkerCommand.createDynamicLinkerCommand(reader);
+ return new DynamicLinkerCommand(reader);
}
case LC_PREBOUND_DYLIB: {
- return PreboundDynamicLibraryCommand.createPreboundDynamicLibraryCommand(reader);
+ return new PreboundDynamicLibraryCommand(reader);
}
case LC_ROUTINES: {
- return RoutinesCommand.createRoutinesCommand(reader, header.is32bit());
+ return new RoutinesCommand(reader, header.is32bit());
}
case LC_SUB_FRAMEWORK: {
- return SubFrameworkCommand.createSubFrameworkCommand(reader);
+ return new SubFrameworkCommand(reader);
}
case LC_SUB_UMBRELLA: {
- return SubUmbrellaCommand.createSubUmbrellaCommand(reader);
+ return new SubUmbrellaCommand(reader);
}
case LC_SUB_CLIENT: {
- return SubClientCommand.createSubClientCommand(reader);
+ return new SubClientCommand(reader);
}
case LC_SUB_LIBRARY: {
- return SubLibraryCommand.createSubLibraryCommand(reader);
+ return new SubLibraryCommand(reader);
}
case LC_TWOLEVEL_HINTS: {
- return TwoLevelHintsCommand.createTwoLevelHintsCommand(reader);
+ return new TwoLevelHintsCommand(reader);
}
case LC_PREBIND_CKSUM: {
- return PrebindChecksumCommand.createPrebindChecksumCommand(reader);
+ return new PrebindChecksumCommand(reader);
}
case LC_LOAD_WEAK_DYLIB: {
- return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
+ return new DynamicLibraryCommand(reader);
}
case LC_SEGMENT_64: {
- return SegmentCommand.createSegmentCommand(reader, header.is32bit());
+ return new SegmentCommand(reader, header.is32bit());
}
case LC_ROUTINES_64: {
- return RoutinesCommand.createRoutinesCommand(reader, header.is32bit());
+ return new RoutinesCommand(reader, header.is32bit());
}
case LC_UUID: {
- return UuidCommand.createUuidCommand(reader);
+ return new UuidCommand(reader);
}
case LC_RPATH: {
- return RunPathCommand.createRunPathCommand(reader);
+ return new RunPathCommand(reader);
}
case LC_CODE_SIGNATURE:
case LC_SEGMENT_SPLIT_INFO:
case LC_DATA_IN_CODE:
case LC_OPTIMIZATION_HINT:
case LC_DYLIB_CODE_SIGN_DRS: {
- return LinkEditDataCommand.createLinkEditDataCommand(reader);
+ return new LinkEditDataCommand(reader);
}
case LC_REEXPORT_DYLIB: {
- return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
+ return new DynamicLibraryCommand(reader);
}
case LC_ENCRYPTION_INFO:
case LC_ENCRYPTION_INFO_64: {
- return EncryptedInformationCommand.createEncryptedInformationCommand(reader,
- header.is32bit());
+ return new EncryptedInformationCommand(reader, header.is32bit());
}
case LC_DYLD_INFO:
case LC_DYLD_INFO_ONLY: {
- return DyldInfoCommand.createDyldInfoCommand(reader);
+ return new DyldInfoCommand(reader);
}
case LC_VERSION_MIN_MACOSX:
case LC_VERSION_MIN_IPHONEOS:
case LC_VERSION_MIN_TVOS:
case LC_VERSION_MIN_WATCHOS: {
- return VersionMinCommand.createVersionMinCommand(reader);
+ return new VersionMinCommand(reader);
}
case LC_FUNCTION_STARTS: {
- return FunctionStartsCommand.createFunctionStartsCommand(reader);
+ return new FunctionStartsCommand(reader);
}
case LC_MAIN: {
- return EntryPointCommand.createEntryPointCommand(reader);
+ return new EntryPointCommand(reader);
}
case LC_SOURCE_VERSION: {
- return SourceVersionCommand.createSourceVersionCommand(reader);
+ return new SourceVersionCommand(reader);
}
case LC_LAZY_LOAD_DYLIB: {
- return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
+ return new DynamicLibraryCommand(reader);
}
case LC_BUILD_VERSION: {
- return BuildVersionCommand.createBuildVersionCommand(reader);
+ return new BuildVersionCommand(reader);
}
case LC_LINKER_OPTIONS: {
- return LinkerOptionCommand.createLinkerOptionCommand(reader);
+ return new LinkerOptionCommand(reader);
}
case LC_DYLD_EXPORTS_TRIE:
- return LinkEditDataCommand.createLinkEditDataCommand(reader);
+ return new LinkEditDataCommand(reader);
case LC_DYLD_CHAINED_FIXUPS:
- return DyldChainedFixupsCommand.createDyldChainedFixupsCommand(reader);
+ return new DyldChainedFixupsCommand(reader);
case LC_FILESET_ENTRY:
- return FileSetEntryCommand.createFileSetEntryCommand(reader, header.is32bit());
+ return new FileSetEntryCommand(reader, header.is32bit());
default: {
Msg.warn(header, "Unsupported load command " + Integer.toHexString(type));
- return UnsupportedLoadCommand.createUnsupportedLoadCommand(reader, type);
+ return new UnsupportedLoadCommand(reader, type);
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/NList.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/NList.java
index bdcbba9c0a..a75fe0dbae 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/NList.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/NList.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.AssertException;
@@ -39,21 +39,7 @@ public class NList implements StructConverter {
private String string;
private boolean is32bit;
- public static NList createNList(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
- NList nList = (NList) reader.getFactory().create(NList.class);
- nList.initNList(reader, is32bit);
- return nList;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public NList() {
- }
-
- private void initNList(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
+ public NList(BinaryReader reader, boolean is32bit) throws IOException {
this.is32bit = is32bit;
n_strx = reader.readNextInt();
@@ -78,10 +64,10 @@ public class NList implements StructConverter {
* scattered. Initializing the strings linearly from the string table is much
* faster.
*
- * @param reader
+ * @param reader The BinaryReader
* @param stringTableOffset offset of the string table
*/
- public void initString(FactoryBundledWithBinaryReader reader, long stringTableOffset) {
+ public void initString(BinaryReader reader, long stringTableOffset) {
try {
string = reader.readAsciiString(stringTableOffset + n_strx);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/ObsoleteCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/ObsoleteCommand.java
index 42cf00752a..1cb5df8fea 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/ObsoleteCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/ObsoleteCommand.java
@@ -15,26 +15,21 @@
*/
package ghidra.app.util.bin.format.macho.commands;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
+
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.*;
-import ghidra.app.util.importer.*;
-import ghidra.program.flatapi.*;
-import ghidra.program.model.address.*;
+import ghidra.app.util.importer.MessageLog;
+import ghidra.program.flatapi.FlatProgramAPI;
+import ghidra.program.model.address.Address;
import ghidra.program.model.data.*;
-import ghidra.program.model.listing.*;
-import ghidra.util.exception.*;
-import ghidra.util.task.*;
-
-import java.io.*;
+import ghidra.program.model.listing.ProgramModule;
+import ghidra.util.exception.DuplicateNameException;
+import ghidra.util.task.TaskMonitor;
public abstract class ObsoleteCommand extends LoadCommand {
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ObsoleteCommand() {}
-
- protected void initObsoleteCommand(FactoryBundledWithBinaryReader reader) throws IOException, MachException {
+ public ObsoleteCommand(BinaryReader reader) throws IOException, MachException {
initLoadCommand(reader);
throw new ObsoleteException();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PrebindChecksumCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PrebindChecksumCommand.java
index 71b3ec2dd9..ba5e669409 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PrebindChecksumCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PrebindChecksumCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,22 +36,7 @@ import ghidra.util.task.TaskMonitor;
public class PrebindChecksumCommand extends LoadCommand {
private int cksum;
- static PrebindChecksumCommand createPrebindChecksumCommand(
- FactoryBundledWithBinaryReader reader) throws IOException {
- PrebindChecksumCommand checksumCommand =
- (PrebindChecksumCommand) reader.getFactory().create(PrebindChecksumCommand.class);
- checksumCommand.initPrebindChecksumCommand(reader);
- return checksumCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public PrebindChecksumCommand() {
- }
-
- private void initPrebindChecksumCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ PrebindChecksumCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
cksum = reader.readNextInt();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PreboundDynamicLibraryCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PreboundDynamicLibraryCommand.java
index 4fed1f00fd..dce809ed3b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PreboundDynamicLibraryCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/PreboundDynamicLibraryCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -38,27 +38,11 @@ public class PreboundDynamicLibraryCommand extends LoadCommand {
private int nmodules;
private LoadCommandString linkedModules;
- static PreboundDynamicLibraryCommand createPreboundDynamicLibraryCommand(
- FactoryBundledWithBinaryReader reader) throws IOException {
- PreboundDynamicLibraryCommand command =
- (PreboundDynamicLibraryCommand) reader.getFactory().create(
- PreboundDynamicLibraryCommand.class);
- command.initPreboundDynamicLibraryCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public PreboundDynamicLibraryCommand() {
- }
-
- private void initPreboundDynamicLibraryCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ PreboundDynamicLibraryCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- name = LoadCommandString.createLoadCommandString(reader, this);
+ name = new LoadCommandString(reader, this);
nmodules = reader.readNextInt();
- linkedModules = LoadCommandString.createLoadCommandString(reader, this);
+ linkedModules = new LoadCommandString(reader, this);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RoutinesCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RoutinesCommand.java
index 85f017250d..19051da5d7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RoutinesCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RoutinesCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -45,20 +45,7 @@ public class RoutinesCommand extends LoadCommand {
private boolean is32bit;
- static RoutinesCommand createRoutinesCommand(FactoryBundledWithBinaryReader reader,
- boolean is32bit) throws IOException {
- RoutinesCommand command = (RoutinesCommand) reader.getFactory().create(RoutinesCommand.class);
- command.initRoutinesCommand(reader, is32bit);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public RoutinesCommand() {}
-
- private void initRoutinesCommand(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
+ RoutinesCommand(BinaryReader reader, boolean is32bit) throws IOException {
initLoadCommand(reader);
this.is32bit = is32bit;
if (is32bit) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RunPathCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RunPathCommand.java
index ac8036e764..d2594913a9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RunPathCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/RunPathCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,22 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class RunPathCommand extends LoadCommand {
private LoadCommandString path;
- static RunPathCommand createRunPathCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- RunPathCommand command = (RunPathCommand) reader.getFactory().create(RunPathCommand.class);
- command.initRunPathCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public RunPathCommand() {
- }
-
- private void initRunPathCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ RunPathCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- path = LoadCommandString.createLoadCommandString(reader, this);
+ path = new LoadCommandString(reader, this);
}
public LoadCommandString getPath() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SegmentCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SegmentCommand.java
index 7a775a1b7a..441e3cf2cb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SegmentCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SegmentCommand.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.*;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.flatapi.FlatProgramAPI;
@@ -50,22 +50,7 @@ public class SegmentCommand extends LoadCommand {
private boolean is32bit;
private List<Section> sections = new ArrayList<Section>();
- public static SegmentCommand createSegmentCommand(FactoryBundledWithBinaryReader reader,
- boolean is32bit) throws IOException {
- SegmentCommand segmentCommand =
- (SegmentCommand) reader.getFactory().create(SegmentCommand.class);
- segmentCommand.initSegmentCommand(reader, is32bit);
- return segmentCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SegmentCommand() {
- }
-
- private void initSegmentCommand(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
+ public SegmentCommand(BinaryReader reader, boolean is32bit) throws IOException {
initLoadCommand(reader);
this.is32bit = is32bit;
@@ -88,7 +73,7 @@ public class SegmentCommand extends LoadCommand {
flags = reader.readNextInt();
for (int i = 0; i < nsects; ++i) {
- sections.add(Section.createSection(reader, is32bit));
+ sections.add(new Section(reader, is32bit));
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SourceVersionCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SourceVersionCommand.java
index 3ccf22e007..617e6dd28f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SourceVersionCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SourceVersionCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,22 +36,7 @@ import ghidra.util.task.TaskMonitor;
public class SourceVersionCommand extends LoadCommand {
private long version;
- static SourceVersionCommand createSourceVersionCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
-
- SourceVersionCommand command =
- (SourceVersionCommand) reader.getFactory().create(SourceVersionCommand.class);
- command.initEntryPointCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SourceVersionCommand() {
- }
-
- private void initEntryPointCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ SourceVersionCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
version = reader.readNextLong();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubClientCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubClientCommand.java
index 09703fbcfa..9ff47589f4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubClientCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubClientCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,23 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class SubClientCommand extends LoadCommand {
private LoadCommandString client;
- static SubClientCommand createSubClientCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- SubClientCommand clientCommand =
- (SubClientCommand) reader.getFactory().create(SubClientCommand.class);
- clientCommand.initSubClientCommand(reader);
- return clientCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SubClientCommand() {
- }
-
- private void initSubClientCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ SubClientCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- client = LoadCommandString.createLoadCommandString(reader, this);
+ client = new LoadCommandString(reader, this);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubFrameworkCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubFrameworkCommand.java
index 0538226b28..f3fd5919cb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubFrameworkCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubFrameworkCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,23 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class SubFrameworkCommand extends LoadCommand {
private LoadCommandString umbrella;
- static SubFrameworkCommand createSubFrameworkCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- SubFrameworkCommand command =
- (SubFrameworkCommand) reader.getFactory().create(SubFrameworkCommand.class);
- command.initSubFrameworkCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SubFrameworkCommand() {
- }
-
- private void initSubFrameworkCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ SubFrameworkCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- umbrella = LoadCommandString.createLoadCommandString(reader, this);
+ umbrella = new LoadCommandString(reader, this);
}
public LoadCommandString getUmbrellaFrameworkName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubLibraryCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubLibraryCommand.java
index 52e14e4d21..adb3c0cfbc 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubLibraryCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubLibraryCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,23 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class SubLibraryCommand extends LoadCommand {
private LoadCommandString sub_library;
- static SubLibraryCommand createSubLibraryCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- SubLibraryCommand command =
- (SubLibraryCommand) reader.getFactory().create(SubLibraryCommand.class);
- command.initSubLibraryCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SubLibraryCommand() {
- }
-
- private void initSubLibraryCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ SubLibraryCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- sub_library = LoadCommandString.createLoadCommandString(reader, this);
+ sub_library = new LoadCommandString(reader, this);
}
public LoadCommandString getSubLibraryName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubUmbrellaCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubUmbrellaCommand.java
index 312a8f238f..3f96b3f4c3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubUmbrellaCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SubUmbrellaCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,23 +36,9 @@ import ghidra.util.task.TaskMonitor;
public class SubUmbrellaCommand extends LoadCommand {
private LoadCommandString sub_umbrella;
- static SubUmbrellaCommand createSubUmbrellaCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- SubUmbrellaCommand command =
- (SubUmbrellaCommand) reader.getFactory().create(SubUmbrellaCommand.class);
- command.initSubUmbrellaCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SubUmbrellaCommand() {
- }
-
- private void initSubUmbrellaCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ SubUmbrellaCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
- sub_umbrella = LoadCommandString.createLoadCommandString(reader, this);
+ sub_umbrella = new LoadCommandString(reader, this);
}
public LoadCommandString getSubUmbrellaFrameworkName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolCommand.java
index ed0c948ae4..582f221d9f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachException;
/**
@@ -29,23 +29,10 @@ public class SymbolCommand extends ObsoleteCommand {
private int offset;
private int size;
- static SymbolCommand createSymbolCommand(
- FactoryBundledWithBinaryReader reader) throws IOException,
- MachException {
- SymbolCommand symbolCommand = (SymbolCommand) reader.getFactory().create(SymbolCommand.class);
- symbolCommand.initSymbolCommand(reader);
- return symbolCommand;
+ SymbolCommand(BinaryReader reader) throws IOException, MachException {
+ super(reader);
}
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SymbolCommand() {}
-
- private void initSymbolCommand(FactoryBundledWithBinaryReader reader) throws IOException, MachException {
- initObsoleteCommand(reader);
- }
-
public int getOffset() {
return offset;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolTableCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolTableCommand.java
index 95a7dd8222..f6fe83c37b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolTableCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/SymbolTableCommand.java
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -48,22 +48,7 @@ public class SymbolTableCommand extends LoadCommand {
private List<NList> symbols = new ArrayList<NList>();
- public static SymbolTableCommand createSymbolTableCommand(FactoryBundledWithBinaryReader reader,
- MachHeader header) throws IOException {
- SymbolTableCommand symbolTableCommand =
- (SymbolTableCommand) reader.getFactory().create(SymbolTableCommand.class);
- symbolTableCommand.initSymbolTableCommand(reader, header);
- return symbolTableCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public SymbolTableCommand() {
- }
-
- private void initSymbolTableCommand(FactoryBundledWithBinaryReader reader, MachHeader header)
- throws IOException {
+ public SymbolTableCommand(BinaryReader reader, MachHeader header) throws IOException {
initLoadCommand(reader);
symoff = reader.readNextInt();
@@ -81,7 +66,7 @@ public class SymbolTableCommand extends LoadCommand {
reader.setPointerIndex(startIndex + symoff);
for (int i = 0; i < nsyms; ++i) {
- nlistList.add(NList.createNList(reader, is32bit));
+ nlistList.add(new NList(reader, is32bit));
}
// sort the entries by the index in the string table, so don't jump around reading
List<NList> sortedList =
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TableOfContents.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TableOfContents.java
index 7af536de66..210121562c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TableOfContents.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TableOfContents.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -32,21 +32,7 @@ public class TableOfContents implements StructConverter {
private int symbol_index;
private int module_index;
- static TableOfContents createTableOfContents(FactoryBundledWithBinaryReader reader)
- throws IOException {
- TableOfContents tableOfContents =
- (TableOfContents) reader.getFactory().create(TableOfContents.class);
- tableOfContents.initTableOfContents(reader);
- return tableOfContents;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public TableOfContents() {
- }
-
- private void initTableOfContents(FactoryBundledWithBinaryReader reader) throws IOException {
+ TableOfContents(BinaryReader reader) throws IOException {
symbol_index = reader.readNextInt();
module_index = reader.readNextInt();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHint.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHint.java
index e45d872a70..67376b19c7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHint.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHint.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
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.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -34,20 +34,7 @@ public class TwoLevelHint implements StructConverter {
private int isub_image;
private int itoc;
- static TwoLevelHint createTwoLevelHint(FactoryBundledWithBinaryReader reader)
- throws IOException {
- TwoLevelHint hint = (TwoLevelHint) reader.getFactory().create(TwoLevelHint.class);
- hint.initTwoLevelHint(reader);
- return hint;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public TwoLevelHint() {
- }
-
- private void initTwoLevelHint(FactoryBundledWithBinaryReader reader) throws IOException {
+ TwoLevelHint(BinaryReader reader) throws IOException {
int value = reader.readNextInt();
isub_image = value & 0xff;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHintsCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHintsCommand.java
index e44f6302e5..2eddd99937 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHintsCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/TwoLevelHintsCommand.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -41,22 +41,7 @@ public class TwoLevelHintsCommand extends LoadCommand {
private int nhints;
private List<TwoLevelHint> hints = new ArrayList<TwoLevelHint>();
- static TwoLevelHintsCommand createTwoLevelHintsCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- TwoLevelHintsCommand command =
- (TwoLevelHintsCommand) reader.getFactory().create(TwoLevelHintsCommand.class);
- command.initTwoLevelHintsCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public TwoLevelHintsCommand() {
- }
-
- private void initTwoLevelHintsCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
+ TwoLevelHintsCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
offset = reader.readNextInt();
nhints = reader.readNextInt();
@@ -64,7 +49,7 @@ public class TwoLevelHintsCommand extends LoadCommand {
long index = reader.getPointerIndex();
reader.setPointerIndex(offset);
for (int i = 0; i < nhints; ++i) {
- hints.add(TwoLevelHint.createTwoLevelHint(reader));
+ hints.add(new TwoLevelHint(reader));
}
reader.setPointerIndex(index);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UnsupportedLoadCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UnsupportedLoadCommand.java
index 78801d41d8..daad2680f8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UnsupportedLoadCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UnsupportedLoadCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -31,22 +31,7 @@ import ghidra.util.task.TaskMonitor;
public class UnsupportedLoadCommand extends LoadCommand {
private int type;
- static UnsupportedLoadCommand createUnsupportedLoadCommand(
- FactoryBundledWithBinaryReader reader, int type) throws IOException {
- UnsupportedLoadCommand command =
- (UnsupportedLoadCommand) reader.getFactory().create(UnsupportedLoadCommand.class);
- command.initUnsupportedLoadCommand(reader, type);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public UnsupportedLoadCommand() {
- }
-
- private void initUnsupportedLoadCommand(FactoryBundledWithBinaryReader reader, int type)
- throws IOException {
+ UnsupportedLoadCommand(BinaryReader reader, int type) throws IOException {
initLoadCommand(reader);
this.type = type;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UuidCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UuidCommand.java
index fd56d572ba..97b559393c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UuidCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/UuidCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -36,19 +36,7 @@ import ghidra.util.task.TaskMonitor;
public class UuidCommand extends LoadCommand {
private byte[] uuid;
- static UuidCommand createUuidCommand(FactoryBundledWithBinaryReader reader) throws IOException {
- UuidCommand command = (UuidCommand) reader.getFactory().create(UuidCommand.class);
- command.initUuidCommand(reader);
- return command;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public UuidCommand() {
- }
-
- private void initUuidCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ UuidCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
uuid = reader.readNextByteArray(16);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/VersionMinCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/VersionMinCommand.java
index 6f1a4b7cbc..c309b69e1a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/VersionMinCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/commands/VersionMinCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.importer.MessageLog;
@@ -38,21 +38,7 @@ public class VersionMinCommand extends LoadCommand {
private int version;
private int sdk;
- static VersionMinCommand createVersionMinCommand(FactoryBundledWithBinaryReader reader)
- throws IOException {
- VersionMinCommand versionMinCommand =
- (VersionMinCommand) reader.getFactory().create(VersionMinCommand.class);
- versionMinCommand.initVersionMinCommand(reader);
- return versionMinCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public VersionMinCommand() {
- }
-
- private void initVersionMinCommand(FactoryBundledWithBinaryReader reader) throws IOException {
+ VersionMinCommand(BinaryReader reader) throws IOException {
initLoadCommand(reader);
version = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldCacheLocalSymbolsInfo.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldCacheLocalSymbolsInfo.java
index 3226d9cb4b..391828123f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldCacheLocalSymbolsInfo.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/dyld/DyldCacheLocalSymbolsInfo.java
@@ -20,10 +20,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
-import generic.continues.RethrowContinuesFactory;
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.macho.CpuTypes;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.app.util.bin.format.macho.commands.NList;
@@ -146,15 +144,15 @@ public class DyldCacheLocalSymbolsInfo implements StructConverter {
}
private void parseNList(MessageLog log, TaskMonitor monitor) throws CancelledException {
- FactoryBundledWithBinaryReader nListReader = new FactoryBundledWithBinaryReader(
- RethrowContinuesFactory.INSTANCE, reader.getByteProvider(), reader.isLittleEndian());
+ BinaryReader nListReader =
+ new BinaryReader(reader.getByteProvider(), reader.isLittleEndian());
monitor.setMessage("Parsing DYLD nlist symbol table...");
monitor.initialize(nlistCount * 2);
nListReader.setPointerIndex(startIndex + nlistOffset);
try {
for (int i = 0; i < nlistCount; ++i) {
- nlistList.add(NList.createNList(nListReader, is32bit));
+ nlistList.add(new NList(nListReader, is32bit));
monitor.checkCanceled();
monitor.incrementProgress(1);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadCommand.java
index 71d70b80e8..7d9a27dba7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadCommand.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.threadcommand;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.*;
import ghidra.app.util.bin.format.macho.commands.LoadCommand;
import ghidra.app.util.importer.MessageLog;
@@ -38,54 +38,39 @@ public class ThreadCommand extends LoadCommand {
private ThreadStateHeader threadStateHeader;
private ThreadState threadState;
- public static ThreadCommand createThreadCommand(FactoryBundledWithBinaryReader reader,
- MachHeader header) throws IOException {
- ThreadCommand threadCommand =
- (ThreadCommand) reader.getFactory().create(ThreadCommand.class);
- threadCommand.initThreadCommand(reader, header);
- return threadCommand;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadCommand() {
- }
-
- private void initThreadCommand(FactoryBundledWithBinaryReader reader, MachHeader header)
- throws IOException {
+ public ThreadCommand(BinaryReader reader, MachHeader header) throws IOException {
initLoadCommand(reader);
- threadStateHeader = ThreadStateHeader.createThreadStateHeader(reader);
+ threadStateHeader = new ThreadStateHeader(reader);
if (header.getCpuType() == CpuTypes.CPU_TYPE_X86) {
if (threadStateHeader.getFlavor() == ThreadStateX86.x86_THREAD_STATE32) {
- threadState = ThreadStateX86_32.createThreadStateX86_32(reader);
+ threadState = new ThreadStateX86_32(reader);
}
}
else if (header.getCpuType() == CpuTypes.CPU_TYPE_X86_64) {
if (threadStateHeader.getFlavor() == ThreadStateX86.x86_THREAD_STATE64) {
- threadState = ThreadStateX86_64.createThreadStateX86_64(reader);
+ threadState = new ThreadStateX86_64(reader);
}
}
else if (header.getCpuType() == CpuTypes.CPU_TYPE_POWERPC) {
if (threadStateHeader.getFlavor() == ThreadStatePPC.PPC_THREAD_STATE) {
- threadState = ThreadStatePPC.createThreadStatePPC(reader, header.is32bit());
+ threadState = new ThreadStatePPC(reader, header.is32bit());
}
}
else if (header.getCpuType() == CpuTypes.CPU_TYPE_POWERPC64) {
if (threadStateHeader.getFlavor() == ThreadStatePPC.PPC_THREAD_STATE64) {
- threadState = ThreadStatePPC.createThreadStatePPC(reader, header.is32bit());
+ threadState = new ThreadStatePPC(reader, header.is32bit());
}
}
else if (header.getCpuType() == CpuTypes.CPU_TYPE_ARM) {
if (threadStateHeader.getFlavor() == ThreadStateARM.ARM_THREAD_STATE) {
- threadState = ThreadStateARM.createThreadStateARM(reader);
+ threadState = new ThreadStateARM(reader);
}
}
else if (header.getCpuType() == CpuTypes.CPU_TYPE_ARM_64) {
if (threadStateHeader.getFlavor() == ThreadStateARM_64.ARM64_THREAD_STATE) {
- threadState = ThreadStateARM_64.createThreadStateARM_64(reader);
+ threadState = new ThreadStateARM_64(reader);
}
}
else {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM.java
index d2dd130c0f..4f2a84c150 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.threadcommand;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.Conv;
@@ -53,21 +53,7 @@ public class ThreadStateARM extends ThreadState {
public int pc;
public int cpsr;
- static ThreadStateARM createThreadStateARM(FactoryBundledWithBinaryReader reader)
- throws IOException {
- ThreadStateARM threadStateARM =
- (ThreadStateARM) reader.getFactory().create(ThreadStateARM.class);
- threadStateARM.initThreadStateARM(reader);
- return threadStateARM;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadStateARM() {
- }
-
- private void initThreadStateARM(FactoryBundledWithBinaryReader reader) throws IOException {
+ ThreadStateARM(BinaryReader reader) throws IOException {
r0 = reader.readNextInt();
r1 = reader.readNextInt();
r2 = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM_64.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM_64.java
index 3aeee583dd..2f46e8aa2e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM_64.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateARM_64.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.threadcommand;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -67,21 +67,7 @@ public class ThreadStateARM_64 extends ThreadState {
public int cpsr;
public int pad;
- static ThreadStateARM_64 createThreadStateARM_64(FactoryBundledWithBinaryReader reader)
- throws IOException {
- ThreadStateARM_64 threadStateARM_64 =
- (ThreadStateARM_64) reader.getFactory().create(ThreadStateARM_64.class);
- threadStateARM_64.initThreadStateARM_64(reader);
- return threadStateARM_64;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadStateARM_64() {
- }
-
- private void initThreadStateARM_64(FactoryBundledWithBinaryReader reader) throws IOException {
+ ThreadStateARM_64(BinaryReader reader) throws IOException {
x0 = reader.readNextLong();
x1 = reader.readNextLong();
x2 = reader.readNextLong();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateHeader.java
index 01e27eb392..9a7541b154 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateHeader.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.threadcommand;
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.DataType;
import ghidra.program.model.data.StructureDataType;
import ghidra.util.exception.DuplicateNameException;
@@ -27,21 +27,7 @@ public class ThreadStateHeader implements StructConverter {
private int flavor;
private int count;
- static ThreadStateHeader createThreadStateHeader(FactoryBundledWithBinaryReader reader)
- throws IOException {
- ThreadStateHeader threadStateHeader =
- (ThreadStateHeader) reader.getFactory().create(ThreadStateHeader.class);
- threadStateHeader.initThreadStateHeader(reader);
- return threadStateHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadStateHeader() {
- }
-
- private void initThreadStateHeader(FactoryBundledWithBinaryReader reader) throws IOException {
+ ThreadStateHeader(BinaryReader reader) throws IOException {
flavor = reader.readNextInt();
count = reader.readNextInt();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStatePPC.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStatePPC.java
index 16da258ddc..7403141831 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStatePPC.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStatePPC.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.threadcommand;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -80,22 +80,7 @@ public class ThreadStatePPC extends ThreadState {
/** Vector Save Register */
public long vrsave;
- static ThreadStatePPC createThreadStatePPC(FactoryBundledWithBinaryReader reader,
- boolean is32bit) throws IOException {
- ThreadStatePPC threadStatePPC =
- (ThreadStatePPC) reader.getFactory().create(ThreadStatePPC.class);
- threadStatePPC.initThreadStatePPC(reader, is32bit);
- return threadStatePPC;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadStatePPC() {
- }
-
- private void initThreadStatePPC(FactoryBundledWithBinaryReader reader, boolean is32bit)
- throws IOException {
+ ThreadStatePPC(BinaryReader reader, boolean is32bit) throws IOException {
srr0 = read(reader, is32bit);
srr1 = read(reader, is32bit);
r0 = read(reader, is32bit);
@@ -138,7 +123,7 @@ public class ThreadStatePPC extends ThreadState {
vrsave = read(reader, is32bit);
}
- private long read(FactoryBundledWithBinaryReader reader, boolean is32bit) throws IOException {
+ private long read(BinaryReader reader, boolean is32bit) throws IOException {
if (is32bit) {
return reader.readNextUnsignedInt();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_32.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_32.java
index cdfbc23ffe..dcf18498b2 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_32.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_32.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.threadcommand;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.Conv;
@@ -46,21 +46,7 @@ public class ThreadStateX86_32 extends ThreadStateX86 {
public int fs;
public int gs;
- static ThreadStateX86_32 createThreadStateX86_32(FactoryBundledWithBinaryReader reader)
- throws IOException {
- ThreadStateX86_32 threadStateX86_32 =
- (ThreadStateX86_32) reader.getFactory().create(ThreadStateX86_32.class);
- threadStateX86_32.initThreadStateX86_32(reader);
- return threadStateX86_32;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadStateX86_32() {
- }
-
- private void initThreadStateX86_32(FactoryBundledWithBinaryReader reader) throws IOException {
+ ThreadStateX86_32(BinaryReader reader) throws IOException {
eax = reader.readNextInt();
ebx = reader.readNextInt();
ecx = reader.readNextInt();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_64.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_64.java
index 7ff431b1e9..e3436681be 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_64.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/macho/threadcommand/ThreadStateX86_64.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.threadcommand;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.MachConstants;
import ghidra.program.model.data.*;
import ghidra.util.exception.DuplicateNameException;
@@ -50,21 +50,7 @@ public class ThreadStateX86_64 extends ThreadStateX86 {
public long fs;
public long gs;
- static ThreadStateX86_64 createThreadStateX86_64(FactoryBundledWithBinaryReader reader)
- throws IOException {
- ThreadStateX86_64 threadStateX86_64 =
- (ThreadStateX86_64) reader.getFactory().create(ThreadStateX86_64.class);
- threadStateX86_64.initThreadStateX86_64(reader);
- return threadStateX86_64;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ThreadStateX86_64() {
- }
-
- private void initThreadStateX86_64(FactoryBundledWithBinaryReader reader) throws IOException {
+ ThreadStateX86_64(BinaryReader reader) throws IOException {
rax = reader.readNextLong();
rbx = reader.readNextLong();
rcx = reader.readNextLong();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/DOSHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/DOSHeader.java
index 970c96df7d..f4cabc88ed 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/DOSHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/DOSHeader.java
@@ -18,8 +18,8 @@ package ghidra.app.util.bin.format.mz;
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.ne.InvalidWindowsHeaderException;
import ghidra.app.util.bin.format.ne.WindowsHeader;
@@ -89,27 +89,14 @@ public class DOSHeader implements StructConverter, Writeable {
private byte [] stubBytes;
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
/**
* Constructs a new DOS header.
* @param reader the binary reader
*/
- public static DOSHeader createDOSHeader(
- FactoryBundledWithBinaryReader reader) throws IOException {
- DOSHeader dosHeader = (DOSHeader) reader.getFactory().create(DOSHeader.class);
- dosHeader.initDOSHeader(reader);
- return dosHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DOSHeader() {}
-
- private void initDOSHeader(FactoryBundledWithBinaryReader reader) throws IOException {
+ public DOSHeader(BinaryReader reader) throws IOException {
this.reader = reader;
-
parse();
}
@@ -283,7 +270,7 @@ public class DOSHeader implements StructConverter, Writeable {
if (e_lfanew >= 0 && e_lfanew <= 0x1000000) {
try {
NTHeader ntHeader =
- NTHeader.createNTHeader(reader, e_lfanew, SectionLayout.FILE, false, false);
+ new NTHeader(reader, e_lfanew, SectionLayout.FILE, false, false);
if (ntHeader != null && ntHeader.getOptionalHeader() != null) {
return true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/OldStyleExecutable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/OldStyleExecutable.java
index 7fa2e46308..c1ba05d63f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/OldStyleExecutable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/mz/OldStyleExecutable.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.mz;
-import generic.continues.*;
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
+import java.io.IOException;
-import java.io.*;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.app.util.bin.ByteProvider;
/**
* A class to manage loading Old-style (MZ) Executables.
@@ -28,7 +26,7 @@ import java.io.*;
*
*/
public class OldStyleExecutable {
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private DOSHeader dosHeader;
/**
@@ -36,16 +34,16 @@ public class OldStyleExecutable {
* @param bp the byte provider
* @throws IOException if an I/O error occurs
*/
- public OldStyleExecutable(GenericFactory factory, ByteProvider bp) throws IOException {
- reader = new FactoryBundledWithBinaryReader(factory, bp, true);
- dosHeader = DOSHeader.createDOSHeader(reader);
+ public OldStyleExecutable(ByteProvider bp) throws IOException {
+ reader = new BinaryReader(bp, true);
+ dosHeader = new DOSHeader(reader);
}
/**
* Returns the underlying binary reader.
* @return the underlying binary reader
*/
- public FactoryBundledWithBinaryReader getBinaryReader() {
+ public BinaryReader getBinaryReader() {
return reader;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryPoint.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryPoint.java
index 55d4f6aeca..b5a2f8de65 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryPoint.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryPoint.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.
@@ -18,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.*;
+import ghidra.app.util.bin.BinaryReader;
/**
* A class to represent a new-executable entry point.
@@ -43,7 +42,7 @@ public class EntryPoint {
* @param reader the binary reader
* @param etb the entry table bundle
*/
- EntryPoint(FactoryBundledWithBinaryReader reader, EntryTableBundle etb) throws IOException {
+ EntryPoint(BinaryReader reader, EntryTableBundle etb) throws IOException {
this.etb = etb;
flagword = reader.readNextByte();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTable.java
index 287c354cbd..11de9e6d90 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTable.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.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class to represent a new-executable entry table.
*
@@ -36,7 +35,7 @@ public class EntryTable {
* @param index the index where the entry table begins
* @param byteCount the length in bytes of the entry table
*/
- EntryTable(FactoryBundledWithBinaryReader reader, short index, short byteCount) throws IOException {
+ EntryTable(BinaryReader reader, short index, short byteCount) throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(Conv.shortToInt(index));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTableBundle.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTableBundle.java
index 01c2f4a460..a7928bdfc3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTableBundle.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/EntryTableBundle.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.
@@ -18,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.*;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.util.Conv;
/**
@@ -49,7 +48,7 @@ public class EntryTableBundle {
* Constructs a new entry table bundle.
* @param reader the binary reader
*/
- EntryTableBundle(FactoryBundledWithBinaryReader reader) throws IOException {
+ EntryTableBundle(BinaryReader reader) throws IOException {
count = reader.readNextByte();
if (count == 0) return; //do not read anymore data...
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ImportedNameTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ImportedNameTable.java
index 165619a109..1b7d9d7959 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ImportedNameTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ImportedNameTable.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.
@@ -18,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.*;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.util.Conv;
/**
@@ -27,7 +26,7 @@ import ghidra.util.Conv;
*
*/
public class ImportedNameTable {
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private short index;
/**
@@ -35,7 +34,7 @@ public class ImportedNameTable {
* @param reader the binary reader
* @param index the index where the table begins
*/
- ImportedNameTable(FactoryBundledWithBinaryReader reader, short index) {
+ ImportedNameTable(BinaryReader reader, short index) {
this.reader = reader;
this.index = index;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/InformationBlock.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/InformationBlock.java
index 7711eea5f5..b074f92799 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/InformationBlock.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/InformationBlock.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.util.Conv;
/**
@@ -195,7 +195,7 @@ public class InformationBlock {
private short ne_swaparea; // Minimum code swap area size
private short ne_expver; // Expected windows version number
- InformationBlock(FactoryBundledWithBinaryReader reader, short index)
+ InformationBlock(BinaryReader reader, short index)
throws InvalidWindowsHeaderException, IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(Conv.shortToInt(index));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringOrdinalSet.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringOrdinalSet.java
index 00d4c788d0..7dcdfc66cb 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringOrdinalSet.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringOrdinalSet.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.
@@ -18,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.*;
+import ghidra.app.util.bin.BinaryReader;
/**
* A class to hold a length/string/ordinal set.
@@ -30,7 +29,7 @@ public class LengthStringOrdinalSet extends LengthStringSet {
* Constructs a new length/string/ordinal set.
* @param reader the binary reader
*/
- LengthStringOrdinalSet(FactoryBundledWithBinaryReader reader) throws IOException {
+ LengthStringOrdinalSet(BinaryReader reader) throws IOException {
super(reader);
if (getLength() == 0) return;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringSet.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringSet.java
index f2485557b1..c2ff43e426 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringSet.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/LengthStringSet.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.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class to store a length/string set,
* where the string is not null-terminated
@@ -38,7 +37,7 @@ public class LengthStringSet {
* Constructs a new length/string set.
* @param reader the binary reader
*/
- LengthStringSet(FactoryBundledWithBinaryReader reader) throws IOException {
+ LengthStringSet(BinaryReader reader) throws IOException {
index = reader.getPointerIndex();
length = reader.readNextByte();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ModuleReferenceTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ModuleReferenceTable.java
index 31cfd49f14..1ca55925f3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ModuleReferenceTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ModuleReferenceTable.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.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class to represent the new-executable module reference table.
*
@@ -38,7 +37,8 @@ public class ModuleReferenceTable {
* @param count the count of modules referenced
* @param imp the imported name table
*/
- ModuleReferenceTable(FactoryBundledWithBinaryReader reader, short index, short count, ImportedNameTable imp) throws IOException {
+ ModuleReferenceTable(BinaryReader reader, short index, short count, ImportedNameTable imp)
+ throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(Conv.shortToInt(index));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NewExecutable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NewExecutable.java
index e95d196494..e2901d88a3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NewExecutable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NewExecutable.java
@@ -17,9 +17,8 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-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.mz.DOSHeader;
import ghidra.program.model.address.SegmentedAddress;
@@ -29,7 +28,7 @@ import ghidra.program.model.address.SegmentedAddress;
*
*/
public class NewExecutable {
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private DOSHeader dosHeader;
private WindowsHeader winHeader;
@@ -40,10 +39,9 @@ public class NewExecutable {
* @param baseAddr the image base of the executable
* @throws IOException if an I/O error occurs.
*/
- public NewExecutable(GenericFactory factory, ByteProvider bp, SegmentedAddress baseAddr)
- throws IOException {
- reader = new FactoryBundledWithBinaryReader(factory, bp, true);
- dosHeader = DOSHeader.createDOSHeader(reader);
+ public NewExecutable(ByteProvider bp, SegmentedAddress baseAddr) throws IOException {
+ reader = new BinaryReader(bp, true);
+ dosHeader = new DOSHeader(reader);
if (dosHeader.isDosSignature()) {
try {
@@ -57,7 +55,7 @@ public class NewExecutable {
* Returns the underlying binary reader.
* @return the underlying binary reader
*/
- public FactoryBundledWithBinaryReader getBinaryReader() {
+ public BinaryReader getBinaryReader() {
return reader;
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NonResidentNameTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NonResidentNameTable.java
index c55309051e..baf8633165 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NonResidentNameTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/NonResidentNameTable.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.ne;
-import ghidra.app.util.bin.format.*;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+
/**
* A class to represent the new-executable non-resident name table.
*
@@ -36,7 +35,7 @@ public class NonResidentNameTable {
* @param index the index where the non-resident name table begins
* @param byteCount the number of bytes in the non-resident name table
*/
- NonResidentNameTable(FactoryBundledWithBinaryReader reader, int index, short byteCount) throws IOException {
+ NonResidentNameTable(BinaryReader reader, int index, short byteCount) throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(index);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResidentNameTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResidentNameTable.java
index 5d2d36bf3f..a4a639df8c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResidentNameTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResidentNameTable.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.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class to represent the new-executable resident name table.
*
@@ -29,7 +28,7 @@ import java.util.ArrayList;
public class ResidentNameTable {
private LengthStringOrdinalSet [] names;
- ResidentNameTable(FactoryBundledWithBinaryReader reader, short index) throws IOException {
+ ResidentNameTable(BinaryReader reader, short index) throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(Conv.shortToInt(index));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Resource.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Resource.java
index 91eda63926..4405e69f57 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Resource.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Resource.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.util.Conv;
/**
@@ -33,7 +33,7 @@ public class Resource {
/**The resource is preloaded.*/
public final static short FLAG_PRELOAD = 0x0040;
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private ResourceTable rt;
private short fileOffset; //this value must be shifted
private short fileLength; //this value must be shifted
@@ -42,7 +42,7 @@ public class Resource {
private short handle; //reserved
private short usage; //reserved
- Resource(FactoryBundledWithBinaryReader reader, ResourceTable rt) throws IOException {
+ Resource(BinaryReader reader, ResourceTable rt) throws IOException {
this.reader = reader;
this.rt = rt;
fileOffset = reader.readNextShort();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceName.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceName.java
index a24d20743d..0f0d59b906 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceName.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceName.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,10 @@
*/
package ghidra.app.util.bin.format.ne;
-import ghidra.app.util.bin.format.*;
-
import java.io.IOException;
+import ghidra.app.util.bin.BinaryReader;
+
/**
* A class for storing new-executable resource names.
*
@@ -33,7 +32,7 @@ public class ResourceName {
* Constructs a resource name.
* @param reader the binary reader
*/
- ResourceName(FactoryBundledWithBinaryReader reader) throws IOException {
+ ResourceName(BinaryReader reader) throws IOException {
index = reader.getPointerIndex();
lns = new LengthStringSet(reader);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceStringTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceStringTable.java
index a616e97600..710cc446d1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceStringTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceStringTable.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.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class for storing new-executable resource string tables.
* Strings are not stored as individual resources, rather
@@ -38,7 +37,7 @@ public class ResourceStringTable extends Resource {
* @param reader the binary reade
* @param rt the resource table where this resource string table is defined
*/
- ResourceStringTable(FactoryBundledWithBinaryReader reader, ResourceTable rt) throws IOException {
+ ResourceStringTable(BinaryReader reader, ResourceTable rt) throws IOException {
super(reader, rt);
byte [] bytes = getBytes();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceTable.java
index 74794978b4..15e7728350 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceTable.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.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class for storing the new-executable resource table.
* A resource table contains all of the supported types
@@ -41,7 +40,7 @@ public class ResourceTable {
* @param index the byte index where the Resource Table begins,
* (this is relative to the beginning of the file
*/
- ResourceTable(FactoryBundledWithBinaryReader reader, short index) throws IOException {
+ ResourceTable(BinaryReader reader, short index) throws IOException {
this.index = index;
long oldIndex = reader.getPointerIndex();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceType.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceType.java
index e73ef7fcb2..011da7e9f6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceType.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/ResourceType.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
import java.util.ArrayList;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.util.Conv;
/**
@@ -69,7 +69,7 @@ public class ResourceType {
* @param reader the binary reader
* @param rt the resource table
*/
- ResourceType(FactoryBundledWithBinaryReader reader, ResourceTable rt) throws IOException {
+ ResourceType(BinaryReader reader, ResourceTable rt) throws IOException {
typeID = reader.readNextShort();
if (typeID == 0) {
return; //not a valid resource type...
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Segment.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Segment.java
index b75d4c252f..48034d3ade 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Segment.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/Segment.java
@@ -15,12 +15,12 @@
*/
package ghidra.app.util.bin.format.ne;
-import ghidra.app.util.bin.format.*;
-import ghidra.util.Conv;
-
import java.io.IOException;
import java.util.ArrayList;
+import ghidra.app.util.bin.BinaryReader;
+import ghidra.util.Conv;
+
/**
* A class to represent a new-executable segment.
*
@@ -50,7 +50,7 @@ public class Segment {
/**segment is 32 bit */
private final static short FLAG_32BIT = (short) 0x2000;
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private int segmentID;
private short offset; //byte offset to content, relative to BOF (zero means no file data)
private short length; //length of segment in file (zero means 64k)
@@ -60,7 +60,7 @@ public class Segment {
private short nRelocations; //number of relocations
private SegmentRelocation [] relocations; //relocation records
- Segment(FactoryBundledWithBinaryReader reader, short segmentAlignment, int segmentID) throws IOException {
+ Segment(BinaryReader reader, short segmentAlignment, int segmentID) throws IOException {
this.reader = reader;
this.segmentID = segmentID;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentRelocation.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentRelocation.java
index c13fb32d53..b7049ed9a9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentRelocation.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentRelocation.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,10 @@
*/
package ghidra.app.util.bin.format.ne;
-import ghidra.app.util.bin.format.*;
-
import java.io.IOException;
+import ghidra.app.util.bin.BinaryReader;
+
/**
* A class to represent a new-executable segment relocation.
*
@@ -102,7 +101,7 @@ public class SegmentRelocation {
* Constucts a new segment relocation.
* @param reader the binary reader
*/
- SegmentRelocation(FactoryBundledWithBinaryReader reader, int segment) throws IOException {
+ SegmentRelocation(BinaryReader reader, int segment) throws IOException {
this.segment = segment;
type = reader.readNextByte();
flagbyte = reader.readNextByte();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentTable.java
index 41ad4b8822..925a3669a8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/SegmentTable.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.program.model.address.SegmentedAddress;
import ghidra.program.model.address.SegmentedAddressSpace;
import ghidra.util.Conv;
@@ -29,8 +29,8 @@ import ghidra.util.Conv;
public class SegmentTable {
private Segment [] segments;
- SegmentTable(FactoryBundledWithBinaryReader reader, SegmentedAddress baseAddr, short index,
- short segmentCount, short shiftAlignCount) throws IOException {
+ SegmentTable(BinaryReader reader, SegmentedAddress baseAddr, short index, short segmentCount,
+ short shiftAlignCount) throws IOException {
long oldIndex = reader.getPointerIndex();
reader.setPointerIndex(Conv.shortToInt(index));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/WindowsHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/WindowsHeader.java
index 825de14d0f..7411b4cf72 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/WindowsHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/ne/WindowsHeader.java
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.ne;
import java.io.IOException;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.program.model.address.SegmentedAddress;
/**
@@ -48,7 +48,7 @@ public class WindowsHeader {
* the specified index do not constitute a valid windows header.
* @throws IOException for problems reading the header bytes
*/
- public WindowsHeader(FactoryBundledWithBinaryReader reader, SegmentedAddress baseAddr,
+ public WindowsHeader(BinaryReader reader, SegmentedAddress baseAddr,
short index) throws InvalidWindowsHeaderException, IOException {
this.infoBlock = new InformationBlock(reader, index);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ArchitectureDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ArchitectureDataDirectory.java
index 062064f759..c21e53880b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ArchitectureDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ArchitectureDataDirectory.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.data.*;
@@ -32,22 +32,9 @@ public class ArchitectureDataDirectory extends DataDirectory {
private String copyright;
- static ArchitectureDataDirectory createArchitectureDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- ArchitectureDataDirectory architectureDataDirectory = (ArchitectureDataDirectory) reader.getFactory().create(ArchitectureDataDirectory.class);
- architectureDataDirectory.initArchitectureDataDirectory(ntHeader, reader);
- return architectureDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ArchitectureDataDirectory() {}
-
- private void initArchitectureDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ ArchitectureDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+ }
@Override
public String getDirectoryName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocation.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocation.java
index c41d5e6514..6eb0406eef 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocation.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocation.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.DataConverter;
import ghidra.util.exception.DuplicateNameException;
@@ -85,33 +84,20 @@ public class BaseRelocation implements StructConverter, ByteArrayConverter {
private int sizeOfBlock;
private List<TypeOffset> typeOffsetList = new ArrayList<TypeOffset>();
- static BaseRelocation createBaseRelocation(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- BaseRelocation baseRelocation = (BaseRelocation) reader.getFactory().create(BaseRelocation.class);
- baseRelocation.initBaseRelocation(reader, index);
- return baseRelocation;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public BaseRelocation() {}
-
- private void initBaseRelocation(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- virtualAddress = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- sizeOfBlock = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- if (virtualAddress < 0) return;
- if (sizeOfBlock < 0 || sizeOfBlock > NTHeader.MAX_SANE_COUNT) return;
+ BaseRelocation(BinaryReader reader, int index) throws IOException {
+ virtualAddress = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
+ sizeOfBlock = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
+ if (virtualAddress < 0) return;
+ if (sizeOfBlock < 0 || sizeOfBlock > NTHeader.MAX_SANE_COUNT) return;
- int len = (sizeOfBlock-IMAGE_SIZEOF_BASE_RELOCATION)/BinaryReader.SIZEOF_SHORT;
+ int len = (sizeOfBlock-IMAGE_SIZEOF_BASE_RELOCATION)/BinaryReader.SIZEOF_SHORT;
- for (int i = 0 ; i < len ; ++i) {
- short typeOffset = reader.readShort(index);
- index += BinaryReader.SIZEOF_SHORT;
+ for (int i = 0 ; i < len ; ++i) {
+ short typeOffset = reader.readShort(index);
+ index += BinaryReader.SIZEOF_SHORT;
- typeOffsetList.add(new TypeOffset(typeOffset));
- }
+ typeOffsetList.add(new TypeOffset(typeOffset));
+ }
}
BaseRelocation(int virtualAddress) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocationDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocationDataDirectory.java
index 7dd016f687..baeb22e7e6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocationDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BaseRelocationDataDirectory.java
@@ -19,8 +19,8 @@ import java.io.IOException;
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.data.*;
@@ -38,23 +38,11 @@ public class BaseRelocationDataDirectory extends DataDirectory implements ByteAr
private BaseRelocation [] relocs;
- static BaseRelocationDataDirectory createBaseRelocationDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- BaseRelocationDataDirectory baseRelocationDataDirectory = (BaseRelocationDataDirectory) reader.getFactory().create(BaseRelocationDataDirectory.class);
- baseRelocationDataDirectory.initBaseRelocationDataDirectory(ntHeader, reader);
- return baseRelocationDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public BaseRelocationDataDirectory() {}
-
- private void initBaseRelocationDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ BaseRelocationDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- if (relocs == null) relocs = new BaseRelocation[0];
- }
+ if (relocs == null)
+ relocs = new BaseRelocation[0];
+ }
@Override
public String getDirectoryName() {
@@ -107,7 +95,7 @@ public class BaseRelocationDataDirectory extends DataDirectory implements ByteAr
while (true) {
if (addr >= stop) break;
- BaseRelocation br = BaseRelocation.createBaseRelocation(reader, addr);
+ BaseRelocation br = new BaseRelocation(reader, addr);
// Sanity check to make sure the data looks OK.
if (br.getVirtualAddress() == 0)
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDataDirectory.java
index bdfa8838ca..a2c026fc53 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDataDirectory.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.*;
-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;
@@ -40,20 +40,7 @@ public class BoundImportDataDirectory extends DataDirectory {
private BoundImportDescriptor [] descriptors;
private LinkedHashMap<String,Short> nameHash;
- static BoundImportDataDirectory createBoundImportDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- BoundImportDataDirectory boundImportDataDirectory = (BoundImportDataDirectory) reader.getFactory().create(BoundImportDataDirectory.class);
- boundImportDataDirectory.initBoundImportDataDirectory(ntHeader, reader);
- return boundImportDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public BoundImportDataDirectory() {}
-
- private void initBoundImportDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ BoundImportDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
if (descriptors == null) descriptors = new BoundImportDescriptor[0];
@@ -134,7 +121,7 @@ public class BoundImportDataDirectory extends DataDirectory {
Msg.error(this, "Invalid file index "+ptr);
break;
}
- BoundImportDescriptor bid = BoundImportDescriptor.createBoundImportDescriptor(reader, ptr, rva);
+ BoundImportDescriptor bid = new BoundImportDescriptor(reader, ptr, rva);
if (bid.getTimeDateStamp() == 0) break;
if (bid.getNumberOfModuleForwarderRefs() < 0) break;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDescriptor.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDescriptor.java
index 30b389662e..b9b7a76543 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDescriptor.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportDescriptor.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.*;
import ghidra.util.exception.DuplicateNameException;
@@ -56,36 +55,30 @@ public class BoundImportDescriptor implements StructConverter, ByteArrayConverte
private List<BoundImportForwarderRef> forwarders = new ArrayList<BoundImportForwarderRef>();
- static BoundImportDescriptor createBoundImportDescriptor(
- FactoryBundledWithBinaryReader reader, int readerIndex,
- int biddIndex) throws IOException {
- BoundImportDescriptor boundImportDescriptor = (BoundImportDescriptor) reader.getFactory().create(BoundImportDescriptor.class);
- boundImportDescriptor.initBoundImportDescriptor(reader, readerIndex, biddIndex);
- return boundImportDescriptor;
- }
+ BoundImportDescriptor(BinaryReader reader, int readerIndex, int biddIndex) throws IOException {
+ timeDateStamp = reader.readInt(readerIndex);
+ readerIndex += BinaryReader.SIZEOF_INT;
+ offsetModuleName = reader.readShort(readerIndex);
+ readerIndex += BinaryReader.SIZEOF_SHORT;
+ numberOfModuleForwarderRefs = reader.readShort(readerIndex);
+ readerIndex += BinaryReader.SIZEOF_SHORT;
+ if (offsetModuleName < 0) {
+ Msg.error(this, "Invalid offsetModuleName " + offsetModuleName);
+ return;
+ }
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public BoundImportDescriptor() {}
-
- private void initBoundImportDescriptor(FactoryBundledWithBinaryReader reader, int readerIndex, int biddIndex) throws IOException {
- timeDateStamp = reader.readInt (readerIndex); readerIndex += BinaryReader.SIZEOF_INT;
- offsetModuleName = reader.readShort(readerIndex); readerIndex += BinaryReader.SIZEOF_SHORT;
- numberOfModuleForwarderRefs = reader.readShort(readerIndex); readerIndex += BinaryReader.SIZEOF_SHORT;
- if (offsetModuleName < 0) {
- Msg.error(this, "Invalid offsetModuleName "+offsetModuleName);
- return;
- }
-
- moduleName = reader.readAsciiString(biddIndex + offsetModuleName);
-
- for (int i = 0 ; i < numberOfModuleForwarderRefs ; ++i) {
- forwarders.add(BoundImportForwarderRef.createBoundImportForwarderRef(reader, readerIndex, biddIndex));
- readerIndex += BoundImportForwarderRef.IMAGE_SIZEOF_BOUND_IMPORT_FORWARDER_REF;
- }
+ moduleName = reader.readAsciiString(biddIndex + offsetModuleName);
+
+ for (int i = 0; i < numberOfModuleForwarderRefs; ++i) {
+ forwarders.add(new BoundImportForwarderRef(reader, readerIndex, biddIndex));
+ readerIndex += BoundImportForwarderRef.IMAGE_SIZEOF_BOUND_IMPORT_FORWARDER_REF;
+ }
}
+ BoundImportDescriptor() {
+
+ }
+
public BoundImportDescriptor(String name, int timeDateStamp) {
this.moduleName = name;
this.timeDateStamp = timeDateStamp;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportForwarderRef.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportForwarderRef.java
index 242b2974d9..4d1909cd17 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportForwarderRef.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/BoundImportForwarderRef.java
@@ -18,7 +18,6 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.DataConverter;
import ghidra.util.Msg;
@@ -58,20 +57,8 @@ public class BoundImportForwarderRef implements StructConverter, ByteArrayConver
* @param readerIndex the index into the binary reader
* @param biddIndex the index where the bound import data directory begins
*/
- static BoundImportForwarderRef createBoundImportForwarderRef(
- FactoryBundledWithBinaryReader reader, int readerIndex,
- int biddIndex) throws IOException {
- BoundImportForwarderRef boundImportForwarderRef = (BoundImportForwarderRef) reader.getFactory().create(BoundImportForwarderRef.class);
- boundImportForwarderRef.initBoundImportForwarderRef(reader, readerIndex, biddIndex);
- return boundImportForwarderRef;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public BoundImportForwarderRef() {}
-
- private void initBoundImportForwarderRef(FactoryBundledWithBinaryReader reader, int readerIndex, int biddIndex) throws IOException {
+ BoundImportForwarderRef(BinaryReader reader, int readerIndex, int biddIndex)
+ throws IOException {
timeDateStamp = reader.readInt (readerIndex); readerIndex += BinaryReader.SIZEOF_INT;
offsetModuleName = reader.readShort(readerIndex); readerIndex += BinaryReader.SIZEOF_SHORT;
reserved = reader.readShort(readerIndex); readerIndex += BinaryReader.SIZEOF_SHORT;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/COMDescriptorDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/COMDescriptorDataDirectory.java
index 03bd95146d..16513fb216 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/COMDescriptorDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/COMDescriptorDataDirectory.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.data.*;
@@ -35,23 +35,7 @@ public class COMDescriptorDataDirectory extends DataDirectory {
private ImageCor20Header header;
- static COMDescriptorDataDirectory createCOMDescriptorDataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
- COMDescriptorDataDirectory comDescriptorDataDirectory =
- (COMDescriptorDataDirectory) reader.getFactory().create(
- COMDescriptorDataDirectory.class);
- comDescriptorDataDirectory.initCOMDescriptorDataDirectory(ntHeader, reader);
- return comDescriptorDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public COMDescriptorDataDirectory() {
- }
-
- private void initCOMDescriptorDataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
+ COMDescriptorDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
this.ntHeader = ntHeader;
processDataDirectory(ntHeader, reader);
}
@@ -72,7 +56,7 @@ public class COMDescriptorDataDirectory extends DataDirectory {
return false;
}
- header = ImageCor20Header.createImageCor20Header(reader, ptr, ntHeader);
+ header = new ImageCor20Header(reader, ptr, ntHeader);
boolean ret = false;
if (ntHeader.shouldParseCliHeaders()) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java
index d4a84cf431..b14c5ba46b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DataDirectory.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.importer.MessageLog;
import ghidra.program.model.address.Address;
import ghidra.program.model.data.DataType;
@@ -54,12 +54,12 @@ public abstract class DataDirectory implements StructConverter, PeMarkupable {
public final static byte IMAGE_SIZEOF_IMAGE_DIRECTORY_ENTRY = 8;
protected NTHeader ntHeader;
- protected FactoryBundledWithBinaryReader reader;
+ protected BinaryReader reader;
protected int virtualAddress;
protected int size;
protected boolean hasParsed = false;
- protected void processDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
+ protected void processDataDirectory(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/DebugDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DebugDataDirectory.java
index 27569734f1..2232f3d54d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DebugDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DebugDataDirectory.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import java.io.RandomAccessFile;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.pdb.PdbInfoCodeView;
import ghidra.app.util.bin.format.pdb.PdbInfoDotNet;
import ghidra.app.util.bin.format.pe.debug.*;
@@ -41,22 +41,9 @@ public class DebugDataDirectory extends DataDirectory {
private DebugDirectoryParser parser;
- static DebugDataDirectory createDebugDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- DebugDataDirectory debugDataDirectory = (DebugDataDirectory) reader.getFactory().create(DebugDataDirectory.class);
- debugDataDirectory.initDebugDataDirectory(ntHeader, reader);
- return debugDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DebugDataDirectory() {}
-
- private void initDebugDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ DebugDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+ }
@Override
public String getDirectoryName() {
@@ -70,7 +57,7 @@ public class DebugDataDirectory extends DataDirectory {
return false;
}
- parser = DebugDirectoryParser.createDebugDirectoryParser(reader, ptr, size, ntHeader);
+ parser = new DebugDirectoryParser(reader, ptr, size, ntHeader);
return true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DefaultDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DefaultDataDirectory.java
index 6260880e67..8945739bf3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DefaultDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DefaultDataDirectory.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.data.*;
import ghidra.program.model.listing.Program;
@@ -26,22 +26,9 @@ import ghidra.util.task.TaskMonitor;
public class DefaultDataDirectory extends DataDirectory {
- static DefaultDataDirectory createDefaultDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- DefaultDataDirectory defaultDataDirectory = (DefaultDataDirectory) reader.getFactory().create(DefaultDataDirectory.class);
- defaultDataDirectory.initDefaultDataDirectory(ntHeader, reader);
- return defaultDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DefaultDataDirectory() {}
-
- private void initDefaultDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ DefaultDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+ }
@Override
public String getDirectoryName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDataDirectory.java
index 376604e513..4de3d84d3f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDataDirectory.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import java.util.*;
-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;
@@ -41,24 +41,12 @@ public class DelayImportDataDirectory extends DataDirectory {
private DelayImportDescriptor [] descriptors;
- static DelayImportDataDirectory createDelayImportDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- DelayImportDataDirectory delayImportDataDirectory = (DelayImportDataDirectory) reader.getFactory().create(DelayImportDataDirectory.class);
- delayImportDataDirectory.initDelayImportDataDirectory(ntHeader, reader);
- return delayImportDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DelayImportDataDirectory() {}
-
- private void initDelayImportDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ DelayImportDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- if (descriptors == null) descriptors = new DelayImportDescriptor[0];
- }
+ if (descriptors == null)
+ descriptors = new DelayImportDescriptor[0];
+ }
/**
* Returns the array of delay import descriptors defined in this delay import data directory.
@@ -82,7 +70,7 @@ public class DelayImportDataDirectory extends DataDirectory {
List<DelayImportDescriptor> list = new ArrayList<DelayImportDescriptor>();
while (true) {
- DelayImportDescriptor did = DelayImportDescriptor.createDelayImportDescriptor(ntHeader, reader, ptr);
+ DelayImportDescriptor did = new DelayImportDescriptor(ntHeader, reader, ptr);
if (!did.isValid() || did.getPointerToDLLName() == 0) break;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDescriptor.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDescriptor.java
index 66c2172ed4..ae65465baa 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDescriptor.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/DelayImportDescriptor.java
@@ -20,7 +20,6 @@ import java.util.*;
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.program.model.symbol.SymbolUtilities;
import ghidra.util.Conv;
@@ -70,27 +69,11 @@ public class DelayImportDescriptor implements StructConverter {
private boolean isValid;
- static DelayImportDescriptor createDelayImportDescriptor(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader, int index) throws IOException {
- DelayImportDescriptor delayImportDescriptor =
- (DelayImportDescriptor) reader.getFactory().create(DelayImportDescriptor.class);
- delayImportDescriptor.initDelayImportDescriptor(ntHeader, reader, index);
- return delayImportDescriptor;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public DelayImportDescriptor() {
- }
-
- private void initDelayImportDescriptor(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader, int index) throws IOException {
-
- if (!ntHeader.checkPointer(index)) {
+ DelayImportDescriptor(NTHeader ntHeader, BinaryReader reader, int index) throws IOException {
+ if (!ntHeader.checkPointer(index)) {
Msg.error(this, "Invalid file index for " + Integer.toHexString(index));
return;
- }
+ }
readFields(reader, index);
readName(ntHeader, reader);
@@ -114,7 +97,7 @@ public class DelayImportDescriptor implements StructConverter {
isValid = true;
}
- private List<ThunkData> readThunks(NTHeader ntHeader, FactoryBundledWithBinaryReader reader,
+ private List<ThunkData> readThunks(NTHeader ntHeader, BinaryReader reader,
long ptr, boolean isName) throws IOException {
List<ThunkData> thunkList = new ArrayList<ThunkData>();
if (ptr == 0) {
@@ -137,8 +120,7 @@ public class DelayImportDescriptor implements StructConverter {
return null;
}
ThunkData thunk =
- ThunkData.createThunkData(reader, (int) thunkPtr,
- ntHeader.getOptionalHeader().is64bit());
+ new ThunkData(reader, (int) thunkPtr, ntHeader.getOptionalHeader().is64bit());
thunkList.add(thunk);
if (thunk.getAddressOfData() == 0)
break;
@@ -165,7 +147,7 @@ public class DelayImportDescriptor implements StructConverter {
Msg.error(this, "Invalid import pointer for "+thunk.getAddressOfData());
return thunkList;
}
- ImportByName ibn = ImportByName.createImportByName(reader, (int) ibnPtr);
+ ImportByName ibn = new ImportByName(reader, (int) ibnPtr);
importByNameMap.put(thunk, ibn);
funcName = ibn.getName();
thunk.setImportByName(ibn);
@@ -178,8 +160,7 @@ public class DelayImportDescriptor implements StructConverter {
return thunkList;
}
- private void readName(NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
+ private void readName(NTHeader ntHeader, BinaryReader reader) throws IOException {
if (szName == 0) {
return;
}
@@ -192,7 +173,7 @@ public class DelayImportDescriptor implements StructConverter {
dllName = reader.readAsciiString((int) namePtr);
}
- private void readFields(FactoryBundledWithBinaryReader reader, int index) throws IOException {
+ private void readFields(BinaryReader reader, int index) throws IOException {
grAttrs = reader.readInt(index);
index += BinaryReader.SIZEOF_INT;
szName = reader.readInt(index) & Conv.INT_MASK;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExceptionDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExceptionDataDirectory.java
index 62b638e31f..ab7579243a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExceptionDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExceptionDataDirectory.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.data.*;
@@ -29,22 +29,9 @@ import ghidra.util.task.TaskMonitor;
public class ExceptionDataDirectory extends DataDirectory {
private final static String NAME = "IMAGE_DIRECTORY_ENTRY_EXCEPTION";
- static ExceptionDataDirectory createExceptionDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- ExceptionDataDirectory exceptionDataDirectory = (ExceptionDataDirectory) reader.getFactory().create(ExceptionDataDirectory.class);
- exceptionDataDirectory.initExceptionDataDirectory(ntHeader, reader);
- return exceptionDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ExceptionDataDirectory() {}
-
- private void initExceptionDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ ExceptionDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+ }
@Override
public String getDirectoryName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExportDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExportDataDirectory.java
index 3ddd1ef447..c05274d040 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExportDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ExportDataDirectory.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-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;
@@ -79,22 +79,7 @@ public class ExportDataDirectory extends DataDirectory {
private String exportName;
- static ExportDataDirectory createExportDataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
- ExportDataDirectory exportDataDirectory =
- (ExportDataDirectory) reader.getFactory().create(ExportDataDirectory.class);
- exportDataDirectory.initExportDataDirectory(ntHeader, reader);
- return exportDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ExportDataDirectory() {
- }
-
- private void initExportDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
+ ExportDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
if (exports == null) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.java
index a3e5dac1d1..5142634a2e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/FileHeader.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.StructConverter;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.pe.ImageRuntimeFunctionEntries._IMAGE_RUNTIME_FUNCTION_ENTRY;
import ghidra.app.util.bin.format.pe.debug.DebugCOFFSymbol;
import ghidra.app.util.bin.format.pe.debug.DebugCOFFSymbolAux;
@@ -182,25 +182,11 @@ public class FileHeader implements StructConverter {
// TODO: This is x86-64 architecture-specific and needs to be generalized.
private List<_IMAGE_RUNTIME_FUNCTION_ENTRY> irfes = new ArrayList<>();
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private int startIndex;
private NTHeader ntHeader;
- static FileHeader createFileHeader(FactoryBundledWithBinaryReader reader, int startIndex,
- NTHeader ntHeader) throws IOException {
- FileHeader fileHeader = (FileHeader) reader.getFactory().create(FileHeader.class);
- fileHeader.initFileHeader(reader, startIndex, ntHeader);
- return fileHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public FileHeader() {
- }
-
- private void initFileHeader(FactoryBundledWithBinaryReader reader, int startIndex,
- NTHeader ntHeader) throws IOException {
+ FileHeader(BinaryReader reader, int startIndex, NTHeader ntHeader) throws IOException {
this.reader = reader;
this.startIndex = startIndex;
this.ntHeader = ntHeader;
@@ -417,7 +403,7 @@ public class FileHeader implements StructConverter {
reader.setPointerIndex(start);
ImageRuntimeFunctionEntries entries =
- ImageRuntimeFunctionEntries.createImageRuntimeFunctionEntries(reader, start, ntHeader);
+ new ImageRuntimeFunctionEntries(reader, start, ntHeader);
irfes = entries.getRuntimeFunctionEntries();
reader.setPointerIndex(oldIndex);
@@ -452,8 +438,7 @@ public class FileHeader implements StructConverter {
break;
}
- DebugCOFFSymbol symbol =
- DebugCOFFSymbol.createDebugCOFFSymbol(reader, tmpIndex, stringTableOffset);
+ DebugCOFFSymbol symbol = new DebugCOFFSymbol(reader, tmpIndex, stringTableOffset);
tmpIndex += DebugCOFFSymbol.IMAGE_SIZEOF_SYMBOL;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/GlobalPointerDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/GlobalPointerDataDirectory.java
index e5c731f1df..800ad30f79 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/GlobalPointerDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/GlobalPointerDataDirectory.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.data.*;
@@ -29,22 +29,10 @@ import ghidra.util.task.TaskMonitor;
public class GlobalPointerDataDirectory extends DataDirectory {
private final static String NAME = "IMAGE_DIRECTORY_ENTRY_GLOBALPTR";
- static GlobalPointerDataDirectory createGlobalPointerDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- GlobalPointerDataDirectory globalPointerDataDirectory = (GlobalPointerDataDirectory) reader.getFactory().create(GlobalPointerDataDirectory.class);
- globalPointerDataDirectory.initGlobalPointerDataDirectory(ntHeader, reader);
- return globalPointerDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public GlobalPointerDataDirectory() {}
-
- private void initGlobalPointerDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ GlobalPointerDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+
+ }
@Override
public String getDirectoryName() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageCor20Header.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageCor20Header.java
index fd28f0c3d8..a46ecdf3be 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageCor20Header.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageCor20Header.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.pe;
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.cli.CliMetadataDirectory;
import ghidra.app.util.bin.format.pe.cli.streams.CliStreamMetadata;
import ghidra.app.util.bin.format.pe.cli.tables.CliTableMethodDef.CliMethodDefRow;
@@ -80,22 +80,7 @@ public class ImageCor20Header implements StructConverter, PeMarkupable {
private DefaultDataDirectory exportAddressTableJumps;
private DefaultDataDirectory managedNativeHeader;
- static ImageCor20Header createImageCor20Header(FactoryBundledWithBinaryReader reader,
- long index, NTHeader ntHeader) throws IOException {
- ImageCor20Header imageCor20Header =
- (ImageCor20Header) reader.getFactory().create(ImageCor20Header.class);
- imageCor20Header.initIMAGE_COR20_HEADER(reader, index, ntHeader);
- return imageCor20Header;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ImageCor20Header() {
- }
-
- private void initIMAGE_COR20_HEADER(FactoryBundledWithBinaryReader reader, long index,
- NTHeader ntHeader) throws IOException {
+ ImageCor20Header(BinaryReader reader, long index, NTHeader ntHeader) throws IOException {
long origIndex = reader.getPointerIndex();
reader.setPointerIndex(index);
@@ -103,15 +88,15 @@ public class ImageCor20Header implements StructConverter, PeMarkupable {
cb = reader.readNextInt();
majorRuntimeVersion = reader.readNextShort();
minorRuntimeVersion = reader.readNextShort();
- metadata = CliMetadataDirectory.createCliMetadataDirectory(ntHeader, reader);
+ metadata = new CliMetadataDirectory(ntHeader, reader);
flags = reader.readNextInt();
entryPointToken = reader.readNextInt();
- resources = DefaultDataDirectory.createDefaultDataDirectory(ntHeader, reader);
- strongNameSignature = DefaultDataDirectory.createDefaultDataDirectory(ntHeader, reader);
- codeManagerTable = DefaultDataDirectory.createDefaultDataDirectory(ntHeader, reader);
- vTableFixups = DefaultDataDirectory.createDefaultDataDirectory(ntHeader, reader);
- exportAddressTableJumps = DefaultDataDirectory.createDefaultDataDirectory(ntHeader, reader);
- managedNativeHeader = DefaultDataDirectory.createDefaultDataDirectory(ntHeader, reader);
+ resources = new DefaultDataDirectory(ntHeader, reader);
+ strongNameSignature = new DefaultDataDirectory(ntHeader, reader);
+ codeManagerTable = new DefaultDataDirectory(ntHeader, reader);
+ vTableFixups = new DefaultDataDirectory(ntHeader, reader);
+ exportAddressTableJumps = new DefaultDataDirectory(ntHeader, reader);
+ managedNativeHeader = new DefaultDataDirectory(ntHeader, reader);
reader.setPointerIndex(origIndex);
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java
index 94c27f5749..67b8ff0ec2 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.program.model.address.Address;
import ghidra.program.model.data.*;
import ghidra.program.model.listing.Program;
@@ -71,25 +71,8 @@ public class ImageRuntimeFunctionEntries {
List<_IMAGE_RUNTIME_FUNCTION_ENTRY> functionEntries = new ArrayList<>();
- static ImageRuntimeFunctionEntries createImageRuntimeFunctionEntries(
- FactoryBundledWithBinaryReader reader, long index, NTHeader ntHeader)
+ ImageRuntimeFunctionEntries(BinaryReader reader, long index, NTHeader ntHeader)
throws IOException {
- ImageRuntimeFunctionEntries imageRuntimeFunctionEntriesSection =
- (ImageRuntimeFunctionEntries) reader.getFactory()
- .create(ImageRuntimeFunctionEntries.class);
- imageRuntimeFunctionEntriesSection.initImageRuntimeFunctionEntries(reader, index, ntHeader);
- return imageRuntimeFunctionEntriesSection;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ImageRuntimeFunctionEntries() {
- }
-
- private void initImageRuntimeFunctionEntries(FactoryBundledWithBinaryReader reader, long index,
- NTHeader ntHeader) throws IOException {
-
int entryCount = 0;
// Find the exception handler data section. This is an unbounded array of
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportAddressTableDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportAddressTableDataDirectory.java
index 8967415c21..4ea0e46070 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportAddressTableDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportAddressTableDataDirectory.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-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.data.*;
@@ -35,22 +35,10 @@ public class ImportAddressTableDataDirectory extends DataDirectory {
private List<ThunkData []> thunkDataSetList;
- static ImportAddressTableDataDirectory createImportAddressTableDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- ImportAddressTableDataDirectory importAddressTableDataDirectory = (ImportAddressTableDataDirectory) reader.getFactory().create(ImportAddressTableDataDirectory.class);
- importAddressTableDataDirectory.initImportAddressTableDataDirectory(ntHeader, reader);
- return importAddressTableDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ImportAddressTableDataDirectory() {}
-
- private void initImportAddressTableDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ ImportAddressTableDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+
+ }
/**
* Returns the thunk data set at the specified index.
@@ -96,7 +84,7 @@ public class ImportAddressTableDataDirectory extends DataDirectory {
int tmp = size;
while (tmp > 0) {
- ThunkData thunk = ThunkData.createThunkData(reader, ptr, ntHeader.getOptionalHeader().is64bit());
+ ThunkData thunk = new ThunkData(reader, ptr, ntHeader.getOptionalHeader().is64bit());
if (thunk.getAddressOfData() == 0) {
ThunkData [] set = new ThunkData[thunkList.size()];
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportByName.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportByName.java
index 5c2ec90c3e..eebba0e58d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportByName.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportByName.java
@@ -15,13 +15,12 @@
*/
package ghidra.app.util.bin.format.pe;
+import java.io.IOException;
+
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.*;
import ghidra.program.model.data.*;
-import ghidra.util.*;
-import ghidra.util.exception.*;
-
-import java.io.*;
+import ghidra.util.DataConverter;
+import ghidra.util.exception.DuplicateNameException;
/**
* A class to represent the <code>IMAGE_IMPORT_BY_NAME</code>
@@ -42,22 +41,9 @@ public class ImportByName implements StructConverter, ByteArrayConverter {
private short hint;
private String name;
- static ImportByName createImportByName(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- ImportByName importByName = (ImportByName) reader.getFactory().create(ImportByName.class);
- importByName.initImportByName(reader, index);
- return importByName;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ImportByName() {}
-
- private void initImportByName(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- hint = reader.readShort(index);
- name = reader.readAsciiString(index+BinaryReader.SIZEOF_SHORT);
+ ImportByName(BinaryReader reader, int index) throws IOException {
+ hint = reader.readShort(index);
+ name = reader.readAsciiString(index + BinaryReader.SIZEOF_SHORT);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDataDirectory.java
index 5eb36e9e0e..309910f0bf 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDataDirectory.java
@@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.importer.MessageLog;
import ghidra.program.model.address.*;
import ghidra.program.model.data.*;
@@ -42,22 +42,7 @@ public class ImportDataDirectory extends DataDirectory {
ExportDataDirectory exportDirectory;
DataConverter conv = LittleEndianDataConverter.INSTANCE;
- static ImportDataDirectory createImportDataDirectory(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader) throws IOException {
- ImportDataDirectory importDataDirectory =
- (ImportDataDirectory) reader.getFactory().create(ImportDataDirectory.class);
- importDataDirectory.initImportDataDirectory(ntHeader, reader);
- return importDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public ImportDataDirectory() {
- }
-
- private void initImportDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
+ ImportDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
if (imports == null) {
@@ -237,7 +222,7 @@ public class ImportDataDirectory extends DataDirectory {
return false;
}
- ImportDescriptor id = ImportDescriptor.createImportDescriptor(reader, ptr);
+ ImportDescriptor id = new ImportDescriptor(reader, ptr);
while (!id.isNullEntry()) {
ptr += ImportDescriptor.SIZEOF;
@@ -254,7 +239,7 @@ public class ImportDataDirectory extends DataDirectory {
int tmpPtr = ntHeader.rvaToPointer(id.getName());
if (tmpPtr < 0) {
//Msg.error(this, "Invalid RVA "+id.getName());
- id = ImportDescriptor.createImportDescriptor(reader, ptr);
+ id = new ImportDescriptor(reader, ptr);
continue;
}
String dllName = reader.readAsciiString(tmpPtr);
@@ -274,7 +259,7 @@ public class ImportDataDirectory extends DataDirectory {
if (intptr < 0) {
Msg.error(this, "Invalid RVA " + Integer.toHexString(id.getOriginalFirstThunk()) +
" : " + Integer.toHexString(id.getFirstThunk()));
- id = ImportDescriptor.createImportDescriptor(reader, ptr);
+ id = new ImportDescriptor(reader, ptr);
return false;
}
int iatptr = ntHeader.rvaToPointer(id.getFirstThunk());
@@ -290,12 +275,12 @@ public class ImportDataDirectory extends DataDirectory {
break;
}
- ThunkData intThunk = ThunkData.createThunkData(reader, intptr,
- ntHeader.getOptionalHeader().is64bit());
+ ThunkData intThunk =
+ new ThunkData(reader, intptr, ntHeader.getOptionalHeader().is64bit());
intptr += intThunk.getStructSize();
- ThunkData iatThunk = ThunkData.createThunkData(reader, iatptr,
- ntHeader.getOptionalHeader().is64bit());
+ ThunkData iatThunk =
+ new ThunkData(reader, iatptr, ntHeader.getOptionalHeader().is64bit());
iatptr += iatThunk.getStructSize();
if (intThunk.getAddressOfData() == 0) {
@@ -323,7 +308,7 @@ public class ImportDataDirectory extends DataDirectory {
"Invalid RVA " + Long.toHexString(intThunk.getAddressOfData()));
break;
}
- ImportByName ibn = ImportByName.createImportByName(reader, ptrToData);
+ ImportByName ibn = new ImportByName(reader, ptrToData);
intThunk.setImportByName(ibn);
@@ -352,7 +337,7 @@ public class ImportDataDirectory extends DataDirectory {
importList.add(
new ImportInfo(addr, cmt.toString(), dllName, boundName, id.isBound()));
}
- id = ImportDescriptor.createImportDescriptor(reader, ptr);
+ id = new ImportDescriptor(reader, ptr);
}
imports = new ImportInfo[importList.size()];
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDescriptor.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDescriptor.java
index bd3929a4b4..1966575529 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDescriptor.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImportDescriptor.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.program.model.data.*;
import ghidra.util.DataConverter;
import ghidra.util.exception.DuplicateNameException;
@@ -58,21 +57,18 @@ public class ImportDescriptor implements StructConverter, ByteArrayConverter {
private List<ThunkData> intList = new ArrayList<ThunkData>();
private List<ThunkData> iatList = new ArrayList<ThunkData>();
- static ImportDescriptor createImportDescriptor(
- FactoryBundledWithBinaryReader reader, int index)
- throws IOException {
- ImportDescriptor importDescriptor = (ImportDescriptor) reader.getFactory().create(ImportDescriptor.class);
- importDescriptor.initImportDescriptor(reader, index);
- return importDescriptor;
- }
-
- private void initImportDescriptor(FactoryBundledWithBinaryReader reader, int index) throws IOException {
- characteristics = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- originalFirstThunk = characteristics;
- timeDateStamp = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- forwarderChain = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- name = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
- firstThunk = reader.readInt(index); index += BinaryReader.SIZEOF_INT;
+ ImportDescriptor(BinaryReader reader, int index) throws IOException {
+ characteristics = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ originalFirstThunk = characteristics;
+ timeDateStamp = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ forwarderChain = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ name = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
+ firstThunk = reader.readInt(index);
+ index += BinaryReader.SIZEOF_INT;
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDataDirectory.java
index bad01708f2..c7ee77b6d8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDataDirectory.java
@@ -17,13 +17,10 @@ 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.data.DataType;
-import ghidra.program.model.data.DataTypeConflictException;
-import ghidra.program.model.data.ImageBaseOffset32DataType;
-import ghidra.program.model.data.ImageBaseOffset64DataType;
+import ghidra.program.model.data.*;
import ghidra.program.model.listing.Program;
import ghidra.program.model.util.CodeUnitInsertionException;
import ghidra.util.exception.DuplicateNameException;
@@ -34,22 +31,9 @@ public class LoadConfigDataDirectory extends DataDirectory {
private LoadConfigDirectory lcd;
- static LoadConfigDataDirectory createLoadConfigDataDirectory(
- NTHeader ntHeader, FactoryBundledWithBinaryReader reader)
- throws IOException {
- LoadConfigDataDirectory loadConfigDataDirectory = (LoadConfigDataDirectory) reader.getFactory().create(LoadConfigDataDirectory.class);
- loadConfigDataDirectory.initLoadConfigDataDirectory(ntHeader, reader);
- return loadConfigDataDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public LoadConfigDataDirectory() {}
-
- private void initLoadConfigDataDirectory(NTHeader ntHeader, FactoryBundledWithBinaryReader reader) throws IOException {
+ LoadConfigDataDirectory(NTHeader ntHeader, BinaryReader reader) throws IOException {
processDataDirectory(ntHeader, reader);
- }
+ }
/**
* Returns the load config directory object defined in this data directory.
@@ -115,7 +99,7 @@ public class LoadConfigDataDirectory extends DataDirectory {
return false;
}
- lcd = LoadConfigDirectory.createLoadConfigDirectory(reader, ptr, ntHeader.getOptionalHeader());
+ lcd = new LoadConfigDirectory(reader, ptr, ntHeader.getOptionalHeader());
return true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDirectory.java
index 2b36be05b3..0a236fc376 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/LoadConfigDirectory.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.exception.DuplicateNameException;
@@ -76,22 +75,7 @@ public class LoadConfigDirectory implements StructConverter {
private boolean is64bit;
- static LoadConfigDirectory createLoadConfigDirectory(FactoryBundledWithBinaryReader reader,
- int index, OptionalHeader oh) throws IOException {
- LoadConfigDirectory loadConfigDirectory =
- (LoadConfigDirectory) reader.getFactory().create(LoadConfigDirectory.class);
- loadConfigDirectory.initLoadConfigDirectory(reader, index, oh);
- return loadConfigDirectory;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public LoadConfigDirectory() {
- }
-
- private void initLoadConfigDirectory(FactoryBundledWithBinaryReader reader, int index,
- OptionalHeader oh) throws IOException {
+ LoadConfigDirectory(BinaryReader reader, int index, OptionalHeader oh) throws IOException {
is64bit = oh.is64bit();
long oldIndex = reader.getPointerIndex();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java
index 02d130e01c..8b20fdfd2a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/NTHeader.java
@@ -20,7 +20,6 @@ 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.pe.PortableExecutable.SectionLayout;
import ghidra.program.model.data.*;
import ghidra.util.*;
@@ -52,7 +51,7 @@ public class NTHeader implements StructConverter, OffsetValidator {
private int signature;
private FileHeader fileHeader;
private OptionalHeader optionalHeader;
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private int index;
private boolean advancedProcess = true;
private boolean parseCliHeaders = false;
@@ -68,23 +67,8 @@ public class NTHeader implements StructConverter, OffsetValidator {
* @throws InvalidNTHeaderException if the bytes the specified index
* do not constitute an accurate NT header.
*/
- public static NTHeader createNTHeader(FactoryBundledWithBinaryReader reader, int index,
- SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders)
- throws InvalidNTHeaderException, IOException {
- NTHeader ntHeader = (NTHeader) reader.getFactory().create(NTHeader.class);
- ntHeader.initNTHeader(reader, index, layout, advancedProcess, parseCliHeaders);
- return ntHeader;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public NTHeader() {
- }
-
- private void initNTHeader(FactoryBundledWithBinaryReader reader, int index,
- SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders)
- throws InvalidNTHeaderException, IOException {
+ public NTHeader(BinaryReader reader, int index, SectionLayout layout, boolean advancedProcess,
+ boolean parseCliHeaders) throws InvalidNTHeaderException, IOException {
this.reader = reader;
this.index = index;
this.layout = layout;
@@ -254,14 +238,14 @@ public class NTHeader implements StructConverter, OffsetValidator {
tmpIndex += 4;
- fileHeader = FileHeader.createFileHeader(reader, tmpIndex, this);
+ fileHeader = new FileHeader(reader, tmpIndex, this);
if (fileHeader.getSizeOfOptionalHeader() == 0) {
Msg.warn(this, "Section headers overlap optional header");
}
tmpIndex += FileHeader.IMAGE_SIZEOF_FILE_HEADER;
try {
- optionalHeader = OptionalHeaderImpl.createOptionalHeader(this, reader, tmpIndex);
+ optionalHeader = new OptionalHeaderImpl(this, reader, tmpIndex);
}
catch (NotYetImplementedException e) {//TODO
Msg.error(this, "Unexpected Exception: " + e.getMessage());
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/OptionalHeaderImpl.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/OptionalHeaderImpl.java
index 0f01b5c945..2bc761cfae 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/OptionalHeaderImpl.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/OptionalHeaderImpl.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import java.io.RandomAccessFile;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.pe.ImageCor20Header.ImageCor20Flags;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressOutOfBoundsException;
@@ -139,29 +139,14 @@ public class OptionalHeaderImpl implements OptionalHeader {
protected DataDirectory[] dataDirectory;
protected NTHeader ntHeader;
- protected FactoryBundledWithBinaryReader reader;
+ protected BinaryReader reader;
protected int startIndex;
private long startOfDataDirs;
protected long originalImageBase;
protected boolean wasRebased;
- static OptionalHeader createOptionalHeader(NTHeader ntHeader,
- FactoryBundledWithBinaryReader reader, int startIndex) throws IOException {
- OptionalHeaderImpl optionalHeaderImpl =
- (OptionalHeaderImpl) reader.getFactory().create(OptionalHeaderImpl.class);
- optionalHeaderImpl.initOptionalHeaderImpl(ntHeader, reader, startIndex);
- return optionalHeaderImpl;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OptionalHeaderImpl() {
- }
-
- private void initOptionalHeaderImpl(NTHeader ntHeader, FactoryBundledWithBinaryReader reader,
- int startIndex) throws IOException {
+ OptionalHeaderImpl(NTHeader ntHeader, BinaryReader reader, int startIndex) throws IOException {
this.ntHeader = ntHeader;
this.reader = reader;
this.startIndex = startIndex;
@@ -292,7 +277,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
int ndata = 0;
monitor.setMessage("Parsing exports...");
try {
- dataDirectory[ndata] = ExportDataDirectory.createExportDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new ExportDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -305,7 +290,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing imports...");
try {
- dataDirectory[ndata] = ImportDataDirectory.createImportDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new ImportDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -318,8 +303,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing resources...");
try {
- dataDirectory[ndata] =
- ResourceDataDirectory.createResourceDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new ResourceDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -332,8 +316,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing exceptions...");
try {
- dataDirectory[ndata] =
- ExceptionDataDirectory.createExceptionDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new ExceptionDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -346,8 +329,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing security...");
try {
- dataDirectory[ndata] =
- SecurityDataDirectory.createSecurityDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new SecurityDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -360,8 +342,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing relocations...");
try {
- dataDirectory[ndata] =
- BaseRelocationDataDirectory.createBaseRelocationDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new BaseRelocationDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -374,7 +355,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing debug information...");
try {
- dataDirectory[ndata] = DebugDataDirectory.createDebugDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new DebugDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -387,8 +368,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing architecture...");
try {
- dataDirectory[ndata] =
- ArchitectureDataDirectory.createArchitectureDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new ArchitectureDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -401,8 +381,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing global pointer...");
try {
- dataDirectory[ndata] =
- GlobalPointerDataDirectory.createGlobalPointerDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new GlobalPointerDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -415,7 +394,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing TLS data...");
try {
- dataDirectory[ndata] = TLSDataDirectory.createTLSDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new TLSDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -428,8 +407,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing load config data...");
try {
- dataDirectory[ndata] =
- LoadConfigDataDirectory.createLoadConfigDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new LoadConfigDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -442,8 +420,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing bound imports...");
try {
- dataDirectory[ndata] =
- BoundImportDataDirectory.createBoundImportDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new BoundImportDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -456,9 +433,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing import address table...");
try {
- dataDirectory[ndata] =
- ImportAddressTableDataDirectory.createImportAddressTableDataDirectory(ntHeader,
- reader);
+ dataDirectory[ndata] = new ImportAddressTableDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -471,8 +446,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing delay imports...");
try {
- dataDirectory[ndata] =
- DelayImportDataDirectory.createDelayImportDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new DelayImportDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -485,8 +459,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
monitor.setMessage("Parsing COM descriptors...");
try {
- dataDirectory[ndata] =
- COMDescriptorDataDirectory.createCOMDescriptorDataDirectory(ntHeader, reader);
+ dataDirectory[ndata] = new COMDescriptorDataDirectory(ntHeader, reader);
}
catch (RuntimeException re) {
if (PortableExecutable.DEBUG) {
@@ -781,9 +754,7 @@ public class OptionalHeaderImpl implements OptionalHeader {
reader.setPointerIndex(startOfDataDirs + (DataDirectory.IMAGE_SIZEOF_IMAGE_DIRECTORY_ENTRY *
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR));
- ImageCor20Header cor20 =
- COMDescriptorDataDirectory.createCOMDescriptorDataDirectory(ntHeader,
- reader).getHeader();
+ ImageCor20Header cor20 = new COMDescriptorDataDirectory(ntHeader, reader).getHeader();
reader.setPointerIndex(origPointerIndex);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PEx64UnwindInfo.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PEx64UnwindInfo.java
index 5796ed71d3..6ecd231022 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PEx64UnwindInfo.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PEx64UnwindInfo.java
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.pe;
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.ImageRuntimeFunctionEntries._IMAGE_RUNTIME_FUNCTION_ENTRY;
import ghidra.program.model.data.DataType;
import ghidra.util.exception.DuplicateNameException;
@@ -156,8 +156,8 @@ class PEx64UnwindInfo implements StructConverter {
byte opInfo; // encoding varies based upon opCode
}
- static PEx64UnwindInfo readUnwindInfo(FactoryBundledWithBinaryReader reader,
- long offset, NTHeader ntHeader) throws IOException {
+ static PEx64UnwindInfo readUnwindInfo(BinaryReader reader, long offset, NTHeader ntHeader)
+ throws IOException {
long origIndex = reader.getPointerIndex();
long pointer = ntHeader.rvaToPointer(offset);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PortableExecutable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PortableExecutable.java
index f3bff5634c..010ee1b701 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PortableExecutable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/PortableExecutable.java
@@ -18,9 +18,8 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import java.io.RandomAccessFile;
-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.mz.DOSHeader;
import ghidra.util.DataConverter;
import ghidra.util.Msg;
@@ -47,7 +46,7 @@ public class PortableExecutable {
MEMORY
}
- private FactoryBundledWithBinaryReader reader;
+ private BinaryReader reader;
private DOSHeader dosHeader;
private RichHeader richHeader;
private NTHeader ntHeader;
@@ -58,57 +57,37 @@ public class PortableExecutable {
* Constructs a new Portable Executable using the specified byte provider and layout.
* <p>
* Same as calling <code>createFileAlignedPortableExecutable(factory, bp, layout, true, false)</code>
- * @param factory generic factory instance
* @param bp the byte provider
* @param layout specifies the layout of the underlying provider and governs RVA resolution
* @throws IOException if an I/O error occurs.
- * @see #createPortableExecutable(GenericFactory, ByteProvider, SectionLayout, boolean, boolean)
+ * @see #PortableExecutable(ByteProvider, SectionLayout, boolean, boolean)
**/
- public static PortableExecutable createPortableExecutable(GenericFactory factory,
- ByteProvider bp, SectionLayout layout) throws IOException {
- return createPortableExecutable(factory, bp, layout, true, false);
+ public PortableExecutable(ByteProvider bp, SectionLayout layout) throws IOException {
+ this(bp, layout, true, false);
}
/**
* Constructs a new Portable Executable using the specified byte provider and layout.
- * @param factory generic factory instance
* @param bp the byte provider
* @param layout specifies the layout of the underlying provider and governs RVA resolution
* @param advancedProcess if true, the data directories are also processed
* @param parseCliHeaders if true, CLI headers are parsed (if present)
* @throws IOException if an I/O error occurs.
*/
- public static PortableExecutable createPortableExecutable(GenericFactory factory,
- ByteProvider bp, SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders)
- throws IOException {
- PortableExecutable portableExecutable =
- (PortableExecutable) factory.create(PortableExecutable.class);
- portableExecutable.initPortableExecutable(factory, bp, layout, advancedProcess,
- parseCliHeaders);
- return portableExecutable;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public PortableExecutable() {
- }
-
- private void initPortableExecutable(GenericFactory factory, ByteProvider bp,
- SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders)
- throws IOException {
- reader = new FactoryBundledWithBinaryReader(factory, bp, true);
+ public PortableExecutable(ByteProvider bp, SectionLayout layout, boolean advancedProcess,
+ boolean parseCliHeaders) throws IOException {
+ reader = new BinaryReader(bp, true);
- dosHeader = DOSHeader.createDOSHeader(reader);
+ dosHeader = new DOSHeader(reader);
if (dosHeader.isDosSignature()) {
- richHeader = RichHeader.createRichHeader(reader);
+ richHeader = new RichHeader(reader);
if (richHeader.getSize() > 0) {
dosHeader.decrementStub(richHeader.getOffset());
}
try {
- ntHeader = NTHeader.createNTHeader(reader, dosHeader.e_lfanew(), layout,
- advancedProcess, parseCliHeaders);
+ ntHeader = new NTHeader(reader, dosHeader.e_lfanew(), layout, advancedProcess,
+ parseCliHeaders);
}
catch (InvalidNTHeaderException e) {
Msg.debug(this, "Expected InvalidNTHeaderException, ignoring");
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ResourceDataDirectory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ResourceDataDirectory.java
index e80ef3ad49..8f37e46b83 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ResourceDataDirectory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ResourceDataDirectory.java
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.pe;
import java.io.IOException;
import java.util.*;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.pe.resource.*;
import ghidra.app.util.datatype.microsoft.*;
import ghidra.app.util.importer.MessageLog;
@@ -161,22 +161,7 @@ public class ResourceDataDirectory extends DataDirectory {
public static Set<Integer> 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.
- * <p>
- * 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
* <b><code>IMAGE_THUNK_DATA32 struct</code></b>
@@ -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;
/**
* <pre>
@@ -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;
/**
* <pre>
@@ -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.
* <br>
@@ -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<DebugFixupElement> list = new ArrayList<DebugFixupElement>();
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;
/**
* <pre>
@@ -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;
/**
* <pre>
@@ -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<String> namesList = new ArrayList<String>();
- 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<DebugSymbol> symbols = new ArrayList<DebugSymbol>();
- 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<String> libList = new ArrayList<String>();
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;
/**
* <pre>
@@ -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;
- }
-
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public OMFModule() {}
-
- private void initOMFModule(FactoryBundledWithBinaryReader reader, int ptr, int byteCount) throws IOException {
- int index = ptr;
+ OMFModule(BinaryReader reader, int ptr, int byteCount) throws IOException {
+ int index = ptr;
- 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;
+ 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;
- this.segDescArr = new OMFSegDesc[cSeg];
+ this.segDescArr = new OMFSegDesc[cSeg];
- for (int i = 0 ; i < cSeg ; ++i) {
- segDescArr[i] = OMFSegDesc.createOMFSegDesc(reader, index);
+ for (int i = 0; i < cSeg; ++i) {
+ segDescArr[i] = new OMFSegDesc(reader, index);
- index += OMFSegDesc.IMAGE_SIZEOF_OMF_SEG_DESC;
- }
+ index += OMFSegDesc.IMAGE_SIZEOF_OMF_SEG_DESC;
+ }
- ++index; // why do we need to increment?????
+ ++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;
/**
* <pre>
@@ -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<OMFSrcModuleFile> moduleFileList = new ArrayList<OMFSrcModuleFile>();
- 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<OMFSrcModuleLine> moduleLineList = new ArrayList<OMFSrcModuleLine>();
- 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);
- /**
- * DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
- */
- public S_LABEL32() {}
+ 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);
+ }
- 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;
-
/**
* <pre>
* 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 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.CategoryPath;
-import ghidra.program.model.data.DataType;
-import ghidra.program.model.data.StructureDataType;
+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;
-
/**
* <pre>
* typedef struct _IMAGE_RESOURCE_DIRECTORY {
@@ -54,7 +51,7 @@ public class ResourceDirectory implements StructConverter {
private short numberOfIdEntries;
private ArrayList<ResourceDirectoryEntry> entries = new ArrayList<ResourceDirectoryEntry>();
- 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;
-
/**
* <pre>
* 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<VS_VERSION_CHILD> children;
- VS_VERSION_CHILD(FactoryBundledWithBinaryReader reader, long relativeOffset, String parentName,
+ VS_VERSION_CHILD(BinaryReader reader, long relativeOffset, String parentName,
HashMap<String, String> 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 java.io.IOException;
+import java.util.*;
+
+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;
-import java.io.IOException;
-import java.util.*;
-
/**
* 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<FatArch> architectures = new ArrayList<FatArch>();
private List<MachHeader> machHeaders = new ArrayList<MachHeader>();
- 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<Option> options, Program prog,
TaskMonitor monitor, MessageLog log) throws IOException {
- GenericFactory factory = MessageLogContinuesFactory.create(log);
-
if (!prog.getExecutableFormat().equals(PeLoader.PE_NAME)) {
throw new IOException("Loading of DBG file may only be 'added' to existing " +
PeLoader.PE_NAME + " Program");
}
- SeparateDebugHeader debug = new SeparateDebugHeader(factory, provider);
+ SeparateDebugHeader debug = new SeparateDebugHeader(provider);
String parentPath = prog.getExecutablePath();
File parentFile = new File(parentPath);
@@ -91,8 +85,7 @@ public class DbgLoader extends AbstractPeDebugLoader {
RandomAccessByteProvider provider2 = null;
try {
provider2 = new RandomAccessByteProvider(parentFile);
- PortableExecutable parentPE =
- PortableExecutable.createPortableExecutable(factory, provider2, SectionLayout.FILE);
+ PortableExecutable parentPE = new PortableExecutable(provider2, SectionLayout.FILE);
Address imageBase = prog.getImageBase();
Map<SectionHeader, Address> sectionToAddress = new HashMap<>();
FileHeader fileHeader = parentPE.getNTHeader().getFileHeader();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DyldCacheProgramBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DyldCacheProgramBuilder.java
index 47bfe7636a..11a46ee975 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DyldCacheProgramBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/DyldCacheProgramBuilder.java
@@ -26,7 +26,6 @@ import ghidra.app.util.bin.format.macho.MachHeader;
import ghidra.app.util.bin.format.macho.commands.NList;
import ghidra.app.util.bin.format.macho.dyld.*;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.app.util.opinion.DyldCacheUtils.SplitDyldCache;
import ghidra.program.database.mem.FileBytes;
import ghidra.program.model.address.Address;
@@ -211,9 +210,7 @@ public class DyldCacheProgramBuilder extends MachoProgramBuilder {
monitor.initialize(dyldCacheHeader.getBranchPoolAddresses().size());
for (Long addr : dyldCacheHeader.getBranchPoolAddresses()) {
try {
- MachHeader header =
- MachHeader.createMachHeader(MessageLogContinuesFactory.create(log), bp,
- addr - dyldCacheHeader.getBaseAddress());
+ MachHeader header = new MachHeader(bp, addr - dyldCacheHeader.getBaseAddress());
header.parse();
super.markupHeaders(header, space.getAddress(addr));
}
@@ -359,8 +356,7 @@ public class DyldCacheProgramBuilder extends MachoProgramBuilder {
public DyldCacheMachoInfo(ByteProvider provider, long offset, Address headerAddr,
String path) throws Exception {
this.headerAddr = headerAddr;
- this.header = MachHeader.createMachHeader(MessageLogContinuesFactory.create(log),
- provider, offset, false);
+ this.header = new MachHeader(provider, offset, false);
this.header.parse();
this.path = path;
this.name = new File(path).getName();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoLoader.java
index 33dc4d1ad2..bb2172656c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoLoader.java
@@ -19,7 +19,6 @@ import java.io.File;
import java.io.IOException;
import java.util.*;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.*;
import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.macho.*;
@@ -64,8 +63,7 @@ public class MachoLoader extends AbstractLibrarySupportLoader {
}
try {
- MachHeader machHeader =
- MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
+ MachHeader machHeader = new MachHeader(provider);
String magic =
CpuTypes.getMagicString(machHeader.getCpuType(), machHeader.getCpuSubType());
List<QueryResult> results = QueryOpinionService.query(getName(), magic, null);
@@ -146,8 +144,7 @@ public class MachoLoader extends AbstractLibrarySupportLoader {
try (ByteProvider provider = new RandomAccessByteProvider(libFile)) {
- FatHeader header =
- FatHeader.createFatHeader(RethrowContinuesFactory.INSTANCE, provider);
+ FatHeader header = new FatHeader(provider);
List<FatArch> architectures = header.getArchitectures();
if (architectures.isEmpty()) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkProgramBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkProgramBuilder.java
index 81e758c409..50b0b210aa 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkProgramBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkProgramBuilder.java
@@ -30,7 +30,6 @@ import ghidra.app.util.bin.format.macho.dyld.DyldChainedPtr;
import ghidra.app.util.bin.format.macho.dyld.DyldChainedPtr.DyldChainType;
import ghidra.app.util.bin.format.macho.prelink.PrelinkMap;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.program.database.mem.FileBytes;
import ghidra.program.model.address.Address;
import ghidra.program.model.data.Pointer64DataType;
@@ -564,8 +563,7 @@ public class MachoPrelinkProgramBuilder extends MachoProgramBuilder {
public PrelinkMachoInfo(ByteProvider provider, long fileOffset, Address headerAddr,
String kextName) throws Exception {
this.headerAddr = headerAddr;
- this.header = MachHeader.createMachHeader(MessageLogContinuesFactory.create(log),
- provider, fileOffset, false);
+ this.header = new MachHeader(provider, fileOffset, false);
this.header.parse();
this.headerAddr = headerAddr;
this.name = kextName;
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkUtils.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkUtils.java
index eab97e05d6..9b8680c845 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkUtils.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoPrelinkUtils.java
@@ -22,7 +22,6 @@ import org.apache.commons.collections4.BidiMap;
import org.apache.commons.collections4.bidimap.DualHashBidiMap;
import org.jdom.JDOMException;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.ByteProviderWrapper;
import ghidra.app.util.bin.format.macho.MachException;
@@ -51,8 +50,7 @@ public class MachoPrelinkUtils {
throws IOException, JDOMException {
try {
- MachHeader mainHeader =
- MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
+ MachHeader mainHeader = new MachHeader(provider);
mainHeader.parse(); // make sure first Mach-O header is valid....
monitor.setMessage("Parsing PRELINK XML...");
@@ -77,8 +75,7 @@ public class MachoPrelinkUtils {
throws IOException, JDOMException {
try {
- MachHeader mainHeader =
- MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
+ MachHeader mainHeader = new MachHeader(provider);
mainHeader.parse(); // make sure first Mach-O header is valid....
DyldChainedFixupsCommand cmd =
@@ -187,8 +184,7 @@ public class MachoPrelinkUtils {
"Using PrelinkExecutableLoadAddr to find Mach-O offsets (%d modules found)",
machoHeaderOffsets.size()));
- MachHeader machoHeader =
- MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider, 0, true);
+ MachHeader machoHeader = new MachHeader(provider, 0, true);
machoHeader.parse();
long prelinkStart = MachoPrelinkUtils.getPrelinkStartAddr(machoHeader);
for (PrelinkMap info : prelinkList) {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
index 2fab612d7a..ef036a88f7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
@@ -28,7 +28,6 @@ import ghidra.app.util.bin.format.macho.relocation.*;
import ghidra.app.util.bin.format.macho.threadcommand.ThreadCommand;
import ghidra.app.util.bin.format.objectiveC.ObjectiveC1_Constants;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.framework.options.Options;
import ghidra.program.database.function.OverlappingFunctionException;
import ghidra.program.database.mem.FileBytes;
@@ -107,7 +106,7 @@ public class MachoProgramBuilder {
monitor.setMessage("Completing Mach-O header parsing...");
monitor.setCancelEnabled(false);
- machoHeader = MachHeader.createMachHeader(MessageLogContinuesFactory.create(log), provider);
+ machoHeader = new MachHeader(provider);
machoHeader.parse();
monitor.setCancelEnabled(true);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MzLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MzLoader.java
index 9a6d2aa9f7..c6a31a7e44 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MzLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MzLoader.java
@@ -19,16 +19,13 @@ import java.io.IOException;
import java.math.BigInteger;
import java.util.*;
-import generic.continues.ContinuesFactory;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.MemoryBlockUtils;
import ghidra.app.util.Option;
+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.mz.DOSHeader;
import ghidra.app.util.bin.format.mz.OldStyleExecutable;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.framework.store.LockException;
import ghidra.program.database.mem.FileBytes;
import ghidra.program.model.address.*;
@@ -69,7 +66,7 @@ public class MzLoader extends AbstractLibrarySupportLoader {
if (provider.length() < MIN_BYTE_LENGTH) {
return loadSpecs;
}
- OldStyleExecutable ose = new OldStyleExecutable(RethrowContinuesFactory.INSTANCE, provider);
+ OldStyleExecutable ose = new OldStyleExecutable(provider);
DOSHeader dos = ose.getDOSHeader();
if (dos.isDosSignature() && !dos.hasNewExeHeader() && !dos.hasPeHeader()) {
List<QueryResult> results =
@@ -100,10 +97,9 @@ public class MzLoader extends AbstractLibrarySupportLoader {
ProgramContext context = prog.getProgramContext();
Memory memory = prog.getMemory();
- ContinuesFactory factory = MessageLogContinuesFactory.create(log);
- OldStyleExecutable ose = new OldStyleExecutable(factory, provider);
+ OldStyleExecutable ose = new OldStyleExecutable(provider);
DOSHeader dos = ose.getDOSHeader();
- FactoryBundledWithBinaryReader reader = ose.getBinaryReader();
+ BinaryReader reader = ose.getBinaryReader();
if (monitor.isCancelled()) {
return;
@@ -249,8 +245,7 @@ public class MzLoader extends AbstractLibrarySupportLoader {
}
private void processSegments(Program program, FileBytes fileBytes, SegmentedAddressSpace space,
- FactoryBundledWithBinaryReader reader, DOSHeader dos, MessageLog log,
- TaskMonitor monitor) {
+ BinaryReader reader, DOSHeader dos, MessageLog log, TaskMonitor monitor) {
try {
int relocationTableOffset = Conv.shortToInt(dos.e_lfarlc());
int csStart = INITIAL_SEGMENT_VAL;
@@ -349,7 +344,7 @@ public class MzLoader extends AbstractLibrarySupportLoader {
}
}
- private void doRelocations(Program prog, FactoryBundledWithBinaryReader reader, DOSHeader dos) {
+ private void doRelocations(Program prog, BinaryReader reader, DOSHeader dos) {
try {
Memory mem = prog.getMemory();
SegmentedAddressSpace space =
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java
index 7289411fd0..1e2be5245e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java
@@ -20,15 +20,12 @@ import java.io.IOException;
import java.math.BigInteger;
import java.util.*;
-import generic.continues.ContinuesFactory;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.MemoryBlockUtils;
import ghidra.app.util.Option;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.format.ne.*;
import ghidra.app.util.bin.format.ne.Resource;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.framework.options.Options;
import ghidra.program.database.function.OverlappingFunctionException;
import ghidra.program.model.address.*;
@@ -67,7 +64,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
if (provider.length() < MIN_BYTE_LENGTH) {
return loadSpecs;
}
- NewExecutable ne = new NewExecutable(RethrowContinuesFactory.INSTANCE, provider, null);
+ NewExecutable ne = new NewExecutable(provider, null);
WindowsHeader wh = ne.getWindowsHeader();
if (wh != null) {
List<QueryResult> results = QueryOpinionService.query(getName(),
@@ -94,8 +91,6 @@ public class NeLoader extends AbstractLibrarySupportLoader {
initVars();
- ContinuesFactory factory = MessageLogContinuesFactory.create(log);
-
// We don't use the file bytes to create block because the bytes are manipulated before
// forming the block. Creating the FileBytes anyway in case later we want access to all
// the original bytes.
@@ -103,7 +98,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
SegmentedAddressSpace space =
(SegmentedAddressSpace) prog.getAddressFactory().getDefaultAddressSpace();
- NewExecutable ne = new NewExecutable(factory, provider, space.getAddress(SEGMENT_START, 0));
+ NewExecutable ne = new NewExecutable(provider, space.getAddress(SEGMENT_START, 0));
WindowsHeader wh = ne.getWindowsHeader();
InformationBlock ib = wh.getInformationBlock();
SegmentTable st = wh.getSegmentTable();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeDataType.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeDataType.java
index bf0c68ca8a..d95d11876b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeDataType.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeDataType.java
@@ -17,7 +17,6 @@ package ghidra.app.util.opinion;
import java.io.IOException;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.bin.ByteArrayProvider;
import ghidra.app.util.bin.format.mz.DOSHeader;
import ghidra.app.util.bin.format.pe.*;
@@ -66,8 +65,7 @@ public class PeDataType extends FactoryStructureDataType {
ByteArrayProvider bap = new ByteArrayProvider(bytes);
- PortableExecutable pe = PortableExecutable.createPortableExecutable(
- RethrowContinuesFactory.INSTANCE, bap, SectionLayout.FILE);
+ PortableExecutable pe = new PortableExecutable(bap, SectionLayout.FILE);
DOSHeader dosHeader = pe.getDOSHeader();
addComponent(struct, dosHeader.toDataType(), DOSHeader.NAME);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java
index df25c84b4d..bf4b2040dd 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java
@@ -19,8 +19,6 @@ import java.io.IOException;
import java.math.BigInteger;
import java.util.*;
-import generic.continues.GenericFactory;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.MemoryBlockUtils;
import ghidra.app.util.Option;
import ghidra.app.util.bin.BinaryReader;
@@ -33,7 +31,6 @@ import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
import ghidra.app.util.bin.format.pe.debug.DebugCOFFSymbol;
import ghidra.app.util.bin.format.pe.debug.DebugDirectoryParser;
import ghidra.app.util.importer.MessageLog;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.framework.model.DomainObject;
import ghidra.framework.options.Options;
import ghidra.program.database.function.OverlappingFunctionException;
@@ -79,8 +76,7 @@ public class PeLoader extends AbstractPeDebugLoader {
return loadSpecs;
}
- PortableExecutable pe = PortableExecutable.createPortableExecutable(
- RethrowContinuesFactory.INSTANCE, provider, SectionLayout.FILE, false, false);
+ PortableExecutable pe = new PortableExecutable(provider, SectionLayout.FILE, false, false);
NTHeader ntHeader = pe.getNTHeader();
if (ntHeader != null && ntHeader.getOptionalHeader() != null) {
long imageBase = ntHeader.getOptionalHeader().getImageBase();
@@ -106,9 +102,8 @@ public class PeLoader extends AbstractPeDebugLoader {
return;
}
- GenericFactory factory = MessageLogContinuesFactory.create(log);
- PortableExecutable pe = PortableExecutable.createPortableExecutable(factory, provider,
- SectionLayout.FILE, false, shouldParseCliHeaders(options));
+ PortableExecutable pe = new PortableExecutable(provider, SectionLayout.FILE, false,
+ shouldParseCliHeaders(options));
NTHeader ntHeader = pe.getNTHeader();
if (ntHeader == null) {
diff --git a/Ghidra/Features/FileFormats/ghidra_scripts/MachoProcessBindScript.java b/Ghidra/Features/FileFormats/ghidra_scripts/MachoProcessBindScript.java
index 6b650f2e26..8042f288d1 100644
--- a/Ghidra/Features/FileFormats/ghidra_scripts/MachoProcessBindScript.java
+++ b/Ghidra/Features/FileFormats/ghidra_scripts/MachoProcessBindScript.java
@@ -20,7 +20,6 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.List;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.script.GhidraScript;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.RandomAccessByteProvider;
@@ -29,7 +28,8 @@ import ghidra.app.util.bin.format.macho.Section;
import ghidra.app.util.bin.format.macho.commands.*;
import ghidra.program.model.address.Address;
import ghidra.program.model.symbol.*;
-import ghidra.util.*;
+import ghidra.util.DataConverter;
+import ghidra.util.StringUtilities;
public class MachoProcessBindScript extends GhidraScript {
@@ -49,11 +49,7 @@ public class MachoProcessBindScript extends GhidraScript {
}
ByteProvider provider = new RandomAccessByteProvider( file ) ;
try {
- MachHeader header = MachHeader.createMachHeader( RethrowContinuesFactory.INSTANCE, provider );
- if ( header == null ) {
- popup( "unable to create mach header from original file" );
- return;
- }
+ MachHeader header = new MachHeader(provider);
header.parse();
List<DyldInfoCommand> commands = header.getLoadCommands( DyldInfoCommand.class );
for ( DyldInfoCommand command : commands ) {
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/dyldcache/DyldCacheDylibExtractor.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/dyldcache/DyldCacheDylibExtractor.java
index 6faa7c836f..e71c07c42e 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/dyldcache/DyldCacheDylibExtractor.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/dyldcache/DyldCacheDylibExtractor.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.macho.*;
import ghidra.app.util.bin.format.macho.commands.*;
@@ -53,8 +52,8 @@ public class DyldCacheDylibExtractor {
int index, FSRL fsrl, TaskMonitor monitor) throws IOException, MachException {
// Make sure Mach-O header is valid
- MachHeader dylibHeader = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE,
- splitDyldCache.getProvider(index), dylibOffset, false);
+ MachHeader dylibHeader =
+ new MachHeader(splitDyldCache.getProvider(index), dylibOffset, false);
dylibHeader.parse();
// Pack the DYLIB
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/prelink/PrelinkFileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/prelink/PrelinkFileSystem.java
index 3e384c1c6f..902c949393 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/prelink/PrelinkFileSystem.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/prelink/PrelinkFileSystem.java
@@ -22,7 +22,6 @@ import java.util.*;
import org.apache.commons.collections4.BidiMap;
import org.jdom.JDOMException;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.MemoryBlockUtils;
import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.macho.*;
@@ -181,8 +180,7 @@ public class PrelinkFileSystem extends GFileSystemBase implements GFileSystemPro
if (offset == null) {
return null;
}
- MachHeader machHeader =
- MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider, offset, true);
+ MachHeader machHeader = new MachHeader(provider, offset, true);
LanguageCompilerSpecPair lcs = MacosxLanguageHelper.getLanguageCompilerSpecPair(
languageService, machHeader.getCpuType(), machHeader.getCpuSubType());
Program program =
@@ -315,8 +313,7 @@ public class PrelinkFileSystem extends GFileSystemBase implements GFileSystemPro
ByteProvider systemKextProvider =
new MemoryByteProvider(systemProgram.getMemory(), address);
- MachHeader machHeader = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE,
- systemKextProvider, 0, false);
+ MachHeader machHeader = new MachHeader(systemKextProvider, 0, false);
machHeader.parse();
//MachoLoader loader = new MachoLoader();
@@ -419,8 +416,7 @@ public class PrelinkFileSystem extends GFileSystemBase implements GFileSystemPro
}
String kextName = "Kext_0x" + Conv.toHexString(machoHeaderOffset) + ".kext";
try {
- MachHeader header = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE,
- provider, machoHeaderOffset);
+ MachHeader header = new MachHeader(provider, machoHeaderOffset);
header.parse();
String name = findNameOfKext(header, monitor);
if (name != null) {
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java
index 7639798ed4..238ae9e688 100644
--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java
+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ubi/UniversalBinaryFileSystem.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.util.bin.*;
import ghidra.app.util.bin.format.macho.CpuTypes;
import ghidra.app.util.bin.format.ubi.FatArch;
@@ -74,7 +73,7 @@ public class UniversalBinaryFileSystem extends GFileSystemBase {
@Override
public void open(TaskMonitor monitor) throws IOException, CancelledException {
try {
- header = FatHeader.createFatHeader(RethrowContinuesFactory.INSTANCE, provider);
+ header = new FatHeader(provider);
List<FatArch> architectures = header.getArchitectures();
for (FatArch architecture : architectures) {
Processor processor =
diff --git a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PEUtil.java b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PEUtil.java
index ce80468d88..a714d58b19 100644
--- a/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PEUtil.java
+++ b/Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/plugin/prototype/MicrosoftCodeAnalyzerPlugin/PEUtil.java
@@ -17,9 +17,8 @@ package ghidra.app.plugin.prototype.MicrosoftCodeAnalyzerPlugin;
import java.io.IOException;
-import generic.continues.RethrowContinuesFactory;
+import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.MemoryByteProvider;
-import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
import ghidra.app.util.bin.format.mz.DOSHeader;
import ghidra.app.util.bin.format.pe.Constants;
import ghidra.app.util.datatype.microsoft.GuidInfo;
@@ -46,9 +45,8 @@ public class PEUtil {
MemoryByteProvider mbp = new MemoryByteProvider(program.getMemory(),
program.getAddressFactory().getDefaultAddressSpace());
try {
- FactoryBundledWithBinaryReader reader = new FactoryBundledWithBinaryReader(
- RethrowContinuesFactory.INSTANCE, mbp, true/*LittleEndian*/);
- DOSHeader dosHeader = DOSHeader.createDOSHeader(reader);
+ BinaryReader reader = new BinaryReader(mbp, true/*LittleEndian*/);
+ DOSHeader dosHeader = new DOSHeader(reader);
if (dosHeader.e_magic() == DOSHeader.IMAGE_DOS_SIGNATURE) {
int peHeaderStartIndex = dosHeader.e_lfanew();
int peMagicNumber = reader.readInt(peHeaderStartIndex);
diff --git a/Ghidra/Features/PDB/ghidra_scripts/GetMSDownloadLinkScript.java b/Ghidra/Features/PDB/ghidra_scripts/GetMSDownloadLinkScript.java
index 6f62be5074..541839bbb8 100644
--- a/Ghidra/Features/PDB/ghidra_scripts/GetMSDownloadLinkScript.java
+++ b/Ghidra/Features/PDB/ghidra_scripts/GetMSDownloadLinkScript.java
@@ -23,14 +23,12 @@
// showing it to the user.
//@category Import
-import java.util.List;
-
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.AccessMode;
+import java.util.List;
-import generic.continues.RethrowContinuesFactory;
import ghidra.app.script.GhidraScript;
import ghidra.app.util.bin.FileByteProvider;
import ghidra.app.util.bin.format.pe.NTHeader;
@@ -56,8 +54,7 @@ public class GetMSDownloadLinkScript extends GhidraScript {
try (FileByteProvider bp = new FileByteProvider(f, null, AccessMode.READ)) {
monitor.setMessage("Parsing file " + f.getName());
- PortableExecutable pe = PortableExecutable.createPortableExecutable(
- RethrowContinuesFactory.INSTANCE, bp, SectionLayout.FILE, false, false);
+ PortableExecutable pe = new PortableExecutable(bp, SectionLayout.FILE, false, false);
NTHeader ntHeader = pe.getNTHeader();
if (ntHeader != null && ntHeader.getOptionalHeader() != null) {
int timeDateStamp = ntHeader.getFileHeader().getTimeDateStamp();
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbCliInfoManager.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbCliInfoManager.java
index 0262be71ad..21411e3cf8 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbCliInfoManager.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbCliInfoManager.java
@@ -19,7 +19,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Objects;
-import generic.continues.GenericFactory;
import ghidra.app.util.bin.ByteProvider;
import ghidra.app.util.bin.FileBytesProvider;
import ghidra.app.util.bin.format.pdb2.pdbreader.PdbException;
@@ -28,7 +27,6 @@ import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
import ghidra.app.util.bin.format.pe.cli.streams.CliStreamMetadata;
import ghidra.app.util.bin.format.pe.cli.tables.CliAbstractTable;
import ghidra.app.util.bin.format.pe.cli.tables.CliAbstractTableRow;
-import ghidra.app.util.importer.MessageLogContinuesFactory;
import ghidra.program.database.mem.FileBytes;
import ghidra.program.model.listing.Program;
@@ -115,9 +113,8 @@ public class PdbCliInfoManager {
FileBytes fileBytes = allFileBytes.get(0); // Should be that of main imported file
ByteProvider provider = new FileBytesProvider(fileBytes); // close not required
try {
- GenericFactory factory = MessageLogContinuesFactory.create(applicator.getMessageLog());
- PortableExecutable pe = PortableExecutable.createPortableExecutable(factory, provider,
- SectionLayout.FILE, true, true);
+ PortableExecutable pe =
+ new PortableExecutable(provider, SectionLayout.FILE, true, true);
NTHeader ntHeader = pe.getNTHeader(); // will be null if header parse fails
if (ntHeader == null) {
applicator.pdbLogAndErrorMessage(this,
diff --git a/Ghidra/Framework/Generic/Module.manifest b/Ghidra/Framework/Generic/Module.manifest
index 36c2f7d214..4ea98d2d3d 100644
--- a/Ghidra/Framework/Generic/Module.manifest
+++ b/Ghidra/Framework/Generic/Module.manifest
@@ -1,4 +1,3 @@
-MODULE FILE LICENSE: lib/cglib-nodep-2.2.jar Apache License 2.0
MODULE FILE LICENSE: lib/guava-19.0.jar Apache License 2.0
MODULE FILE LICENSE: lib/jdom-legacy-1.1.3.jar JDOM License
MODULE FILE LICENSE: lib/log4j-api-2.17.1.jar Apache License 2.0
diff --git a/Ghidra/Framework/Generic/build.gradle b/Ghidra/Framework/Generic/build.gradle
index a92c4b1d09..15e4c2e1b2 100644
--- a/Ghidra/Framework/Generic/build.gradle
+++ b/Ghidra/Framework/Generic/build.gradle
@@ -26,7 +26,6 @@ eclipse.project.name = 'Framework Generic'
dependencies {
api project(':Utility')
- api "cglib:cglib-nodep:2.2"
api "com.google.guava:guava:19.0"
api "org.jdom:jdom-legacy:1.1.3"
api "org.apache.logging.log4j:log4j-api:2.17.1"
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/ContinuesFactory.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/ContinuesFactory.java
deleted file mode 100644
index f8b017a25e..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/ContinuesFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ###
- * IP: GHIDRA
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-import java.lang.reflect.Constructor;
-
-import net.sf.cglib.proxy.Enhancer;
-
-public class ContinuesFactory implements GenericFactory {
-
- private static final boolean enabled = Boolean.getBoolean("ContinuesInterceptor.enabled");
-
- private ExceptionHandler exceptionHandler;
-
- public ContinuesFactory(ExceptionHandler exceptionHandler) {
- if (exceptionHandler == null) {
- throw new IllegalArgumentException("exceptionHandler == null not allowed");
- }
- this.exceptionHandler = exceptionHandler;
- }
-
- @Override
- public Object create(Class<?> type, Object... args) {
- try {
- Object thing;
- if (!enabled) {
- Constructor<?> c = type.getConstructor(new Class<?>[0]);
- thing = c.newInstance(args);
- }
- else {
- ContinuesInterceptor interceptor = new ContinuesInterceptor(exceptionHandler);
- Enhancer e = new Enhancer();
- e.setSuperclass(type);
- e.setCallback(interceptor);
- thing = e.create();
- }
- return thing;
- }
- catch (Throwable e) {
- try {
- exceptionHandler.handle(e);
- }
- catch (Throwable t) {
- // let the handler supplant the original exception if need be
- e = t;
- }
- // wrap so clients don't need try/catch everywhere
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/ContinuesInterceptor.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/ContinuesInterceptor.java
deleted file mode 100644
index 5c2e363ee9..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/ContinuesInterceptor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-import java.lang.reflect.Method;
-
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-class ContinuesInterceptor implements MethodInterceptor {
- private final ExceptionHandler handler;
-
- ContinuesInterceptor(ExceptionHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public Object intercept(Object obj, Method method, Object[] args,
- MethodProxy proxy) throws Throwable {
- Object retValFromSuper = null;
- if (method.getAnnotation(DoNotContinue.class) != null) {
- retValFromSuper = proxy.invokeSuper(obj, args);
- } else {
- try {
- retValFromSuper = proxy.invokeSuper(obj, args);
- }
- catch (Exception e) {
- handler.handle(e);
- }
- }
- return retValFromSuper;
- }
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/DoNotContinue.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/DoNotContinue.java
deleted file mode 100644
index e6f882c68f..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/DoNotContinue.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface DoNotContinue {
- // marker interface
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/ExceptionHandler.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/ExceptionHandler.java
deleted file mode 100644
index 129496137f..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/ExceptionHandler.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-public interface ExceptionHandler {
- public void handle(Throwable e) throws Throwable;
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/GenericFactory.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/GenericFactory.java
deleted file mode 100644
index e838e6c702..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/GenericFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-public interface GenericFactory {
- public Object create(Class<?> type, Object... args);
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/RethrowContinuesFactory.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/RethrowContinuesFactory.java
deleted file mode 100644
index 457df0cbfb..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/RethrowContinuesFactory.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-public class RethrowContinuesFactory extends ContinuesFactory {
- public static final RethrowContinuesFactory INSTANCE = new RethrowContinuesFactory();
-
- private RethrowContinuesFactory() {
- super(RethrowExceptionHandler.INSTANCE);
- }
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/continues/RethrowExceptionHandler.java b/Ghidra/Framework/Generic/src/main/java/generic/continues/RethrowExceptionHandler.java
deleted file mode 100644
index 862cc20fbf..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/generic/continues/RethrowExceptionHandler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package generic.continues;
-
-public class RethrowExceptionHandler implements ExceptionHandler {
- public static final RethrowExceptionHandler INSTANCE = new RethrowExceptionHandler();
-
- private RethrowExceptionHandler() {}
-
- @Override
- public void handle(Throwable e) throws Throwable {
- throw e;
- }
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLogContinuesFactory.java b/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLogContinuesFactory.java
deleted file mode 100644
index 0dfefb5545..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLogContinuesFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/* ###
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ghidra.app.util.importer;
-
-import generic.continues.*;
-
-public class MessageLogContinuesFactory {
- public static ContinuesFactory create(MessageLog log) {
- if (log == null) {
- throw new IllegalArgumentException("log == null not allowed");
- }
- return new ContinuesFactory(new MessageLogExceptionHandler(log));
- }
-}
diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLogExceptionHandler.java b/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLogExceptionHandler.java
deleted file mode 100644
index f17a76edbd..0000000000
--- a/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLogExceptionHandler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ###
- * IP: GHIDRA
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ghidra.app.util.importer;
-
-import generic.continues.ExceptionHandler;
-import ghidra.util.Msg;
-
-public class MessageLogExceptionHandler implements ExceptionHandler {
-
- private MessageLog messageLog;
-
- public MessageLogExceptionHandler() {
- this.messageLog = new MessageLog();
- }
-
- public MessageLogExceptionHandler(MessageLog messageLog) {
- this.messageLog = messageLog;
- }
-
- public MessageLog getMessageLog() {
- return messageLog;
- }
-
- public void setMessageLog(MessageLog messageLog) {
- this.messageLog = messageLog;
- }
-
- @Override
- public void handle(Throwable t) throws Throwable {
- if ((t instanceof Exception) && !(t instanceof RuntimeException)) {
- throw t; // original code must have handler for this
- }
- if (messageLog != null) {
- messageLog.appendException(t);
- Msg.warn(this, t.getMessage(), t);
- }
- }
-}
diff --git a/Ghidra/RuntimeScripts/Common/support/launch.properties b/Ghidra/RuntimeScripts/Common/support/launch.properties
index 4f02de154e..45329d0cbc 100644
--- a/Ghidra/RuntimeScripts/Common/support/launch.properties
+++ b/Ghidra/RuntimeScripts/Common/support/launch.properties
@@ -70,7 +70,6 @@ VMARGS_WINDOWS=-Dlog4j.skipJansi=true
VMARGS=-Xshare:off
# Permit "illegal reflective accesses" to enable JDK compatibility with Ghidra and 3rd party jars.
-VMARGS=--add-opens=java.base/java.lang=ALL-UNNAMED
VMARGS=--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED
# Persistent cache directory used by the application. This directory will be used to store
@@ -89,11 +88,6 @@ VMARGS=--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED
# Disable alternating row colors in tables
#VMARGS=-Ddisable.alternating.row.colors=true
-# The ContinuesInterceptor allows the import process to proceed if parsing corrupted headers
-# generates uncaught exceptions. Its usage has been deprecated and will be removed in a future
-# release of Ghidra. It is disabled by default.
-#VMARGS=-DContinuesInterceptor.enabled=true
-
# Limit on XML parsing. See https://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html
#VMARGS=-Djdk.xml.totalEntitySizeLimit=50000000