private Optional < Long > getEntryPoint ( ) { long rva = data . getOptionalHeader ( ) . get ( StandardFieldEntryKey . ADDR_OF_ENTRY_POINT ) ; Optional < SectionHeader > section = new SectionLoader ( data ) . maybeGetSectionHeaderByRVA ( rva ) ; if ( section . isPresent ( ) ) { long phystovirt = section . get ( ) . get ( SectionHeaderKey . VIRTUAL_ADDRESS ) - section . get ( ) . get ( SectionHeaderKey . POINTER_TO_RAW_DATA ) ; return Optional . of ( rva - phystovirt ) ; } return Optional . absent ( ) ; }
Returns the entry point of the PE if present and valid otherwise absent .