Java Code Examples for ghidra.app.util.bin.BinaryReader#SIZEOF_SHORT

The following examples show how to use ghidra.app.util.bin.BinaryReader#SIZEOF_SHORT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityCertificate.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void initSecurityCertificate(FactoryBundledWithBinaryReader reader, int index) throws IOException {
      int i = index;

int maxDwLength = (int) ClampPropertiesLookup.getClampValue("ghidra.app.util.bin.format.pe.SecurityCertificate.dwLength.max", 30000);
      dwLength         = reader.readInt  (i, 8, maxDwLength); i += BinaryReader.SIZEOF_INT;
if (dwLength < 0)  return;
wRevision        = reader.readShort(i); i += BinaryReader.SIZEOF_SHORT;
wCertificateType = reader.readShort(i); i += BinaryReader.SIZEOF_SHORT;
bCertificate     = reader.readByteArray(i, dwLength-4-2-2);
  }
 
Example 2
Source File: DebugSymbolSelector.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public static DebugSymbol selectSymbol(FactoryBundledWithBinaryReader reader, int ptr) throws IOException {
	short length = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;
	short type   = reader.readShort(ptr); ptr+=BinaryReader.SIZEOF_SHORT;

	if (length == 0 || type < 0) {
		return null;
	}

	switch (type) {
		case DebugCodeViewConstants.S_LDATA32:
		case DebugCodeViewConstants.S_GDATA32:
		case DebugCodeViewConstants.S_PUB32:
			return DataSym32.createDataSym32(length, type, reader, ptr);                   

		case DebugCodeViewConstants.S_PUBSYM32_NEW:
			return DataSym32_new.createDataSym32_new(length, type, reader, ptr);

		case DebugCodeViewConstants.S_PROCREF:
		case DebugCodeViewConstants.S_LPROCREF:
			return S_PROCREF.createS_PROCREF(length, type, reader, ptr);

		case DebugCodeViewConstants.S_DATAREF:
			return S_DATAREF.createS_DATAREF(length, type, reader, ptr);

		case DebugCodeViewConstants.S_ALIGN:
			return S_ALIGN.createS_ALIGN(length, type, reader, ptr);

		case DebugCodeViewConstants.S_UDT32:
			return S_UDT32_NEW.createS_UDT32_NEW(length, type, reader, ptr);

		case DebugCodeViewConstants.S_LDATA32_NEW:
			return S_LDATA32_NEW.createS_LDATA32_NEW(length, type, reader, ptr);

		case DebugCodeViewConstants.S_LPROC32_NEW:
		case DebugCodeViewConstants.S_GPROC32_NEW:
			return S_GPROC32_NEW.createS_GPROC32_NEW(length, type, reader, ptr);

		case DebugCodeViewConstants.S_BPREL32_NEW:
			return S_BPREL32_NEW.createS_BPREL32_NEW(length, type, reader, ptr);

		case DebugCodeViewConstants.S_END:
			return S_END.createS_END(length, type, reader, ptr);

		case DebugCodeViewConstants.S_BLOCK32:
			return S_BLOCK32.createS_BLOCK32(length, type);

		case DebugCodeViewConstants.S_COMPILE:
			return S_COMPILE.createS_COMPILE(length, type);

		case DebugCodeViewConstants.S_OBJNAME:
			return S_OBJNAME.createS_OBJNAME(length, type, reader, ptr);

		case DebugCodeViewConstants.S_CONSTANT32:
			return S_CONSTANT32.createS_CONSTANT32(length, type, reader, ptr);

		case DebugCodeViewConstants.S_GDATA32_NEW:
			return S_GDATA32_NEW.createS_GDATA32_NEW(length, type, reader, ptr);
		
		case DebugCodeViewConstants.S_LABEL32:
			return S_LABEL32.createS_LABEL32(length, type, reader, ptr);
		
		default:
			return UnknownSymbol.createUnknownSymbol(length, type, reader, ptr);
	}
}
 
Example 3
Source File: SecurityCertificate.java    From ghidra with Apache License 2.0 4 votes vote down vote up
int getNumberOfBytesConsumed() {
    return dwLength + BinaryReader.SIZEOF_INT +
                2 * BinaryReader.SIZEOF_SHORT;
}