GP-1907: Removing ContinuesInterceptor and associated API

This commit is contained in:
Ryan Kurtz 2022-04-11 01:05:30 -04:00
parent 2db3a6be15
commit 96674d4f62
208 changed files with 1125 additions and 3387 deletions

View file

@ -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;

View file

@ -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>

View file

@ -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>

View file

@ -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");

View file

@ -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) {

View file

@ -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);

View file

@ -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) {

View file

@ -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) {

View file

@ -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();

View file

@ -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;
}
}

View file

@ -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

View file

@ -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;

View file

@ -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();

View file

@ -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);
}

View file

@ -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();

View file

@ -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);

View file

@ -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

View file

@ -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();
}

View file

@ -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) {

View file

@ -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);
}

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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);
}
/**

View file

@ -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();

View file

@ -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()) {

View file

@ -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() {

View file

@ -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));
}
}

View file

@ -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();

View file

@ -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();

View file

@ -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;

View file

@ -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);
}

View file

@ -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

View file

@ -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);
}
/**

View file

@ -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

View file

@ -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();

View file

@ -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);

View file

@ -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();

View file

@ -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);
}

View file

@ -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);
}
}
}

View file

@ -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);
}

View file

@ -15,26 +15,21 @@
*/
package ghidra.app.util.bin.format.macho.commands;
import ghidra.app.util.bin.format.*;
import ghidra.app.util.bin.format.macho.*;
import ghidra.app.util.importer.*;
import ghidra.program.flatapi.*;
import ghidra.program.model.address.*;
import ghidra.program.model.data.*;
import ghidra.program.model.listing.*;
import ghidra.util.exception.*;
import ghidra.util.task.*;
import java.io.IOException;
import java.io.*;
import ghidra.app.util.bin.BinaryReader;
import ghidra.app.util.bin.format.macho.*;
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.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();
}

View file

@ -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();
}

View file

@ -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

View file

@ -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) {

View file

@ -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() {

View file

@ -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));
}
}

View file

@ -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();
}

View file

@ -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);
}
/**

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -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;
}

View file

@ -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 =

View file

@ -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();
}

View file

@ -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;

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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();

View file

@ -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);
}

View file

@ -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 {

View file

@ -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();

View file

@ -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();

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();

View file

@ -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();

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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();

View file

@ -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));

View file

@ -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...

View file

@ -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;
}

View file

@ -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));

View file

@ -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;

View file

@ -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();

View file

@ -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));

View file

@ -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;
}
/**

View file

@ -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);

View file

@ -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));

View file

@ -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();

View file

@ -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);

View file

@ -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();

View file

@ -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();

View file

@ -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...

View file

@ -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;

View file

@ -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();

View file

@ -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));

View file

@ -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);

View file

@ -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() {

View file

@ -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;
}
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;
/**
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
*/
public BaseRelocation() {}
int len = (sizeOfBlock-IMAGE_SIZEOF_BASE_RELOCATION)/BinaryReader.SIZEOF_SHORT;
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;
for (int i = 0 ; i < len ; ++i) {
short typeOffset = reader.readShort(index);
index += 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;
typeOffsetList.add(new TypeOffset(typeOffset));
}
typeOffsetList.add(new TypeOffset(typeOffset));
}
}
BaseRelocation(int virtualAddress) {

View file

@ -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)

View file

@ -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;

View file

@ -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,35 +55,29 @@ 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;
}
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;
}
}
/**
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
*/
public BoundImportDescriptor() {}
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;
}
}
}
public BoundImportDescriptor(String name, int timeDateStamp) {
this.moduleName = name;

View file

@ -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;

View file

@ -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()) {

View file

@ -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;

View file

@ -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;
}

View file

@ -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() {

Some files were not shown because too many files have changed in this diff Show more