コード例 #1
0
ファイル: lnxcore.c プロジェクト: ABratovic/open-watcom-v2
static int load_core_header( const char *core_name )
{
    int         fd;
    int         result;

    result = FALSE;
    if( core_info.e_hdr == NULL ) {
        core_info.e_hdr = malloc( sizeof( *core_info.e_hdr ) );
        if( core_info.e_hdr == NULL )
            return( result );
    }
    fd = open( core_name, O_RDONLY );
    if( fd < 0 )
        return( result );

    core_info.fd = fd;
    if( !elf_read_hdr( fd, core_info.e_hdr ) ) {
        close( fd );
    } else {
        if( elf_read_phdr( fd, core_info.e_hdr, &core_info.e_phdr ) ) {
            result = TRUE;
        }
    }
    return( result );
}
コード例 #2
0
ファイル: makeself.c プロジェクト: manusan/ps3tools
static void parse_elf(void)
{
	u32 i;

	arch64 = elf_read_hdr(elf, &ehdr);

	for (i = 0; i < ehdr.e_phnum; i++)
		elf_read_phdr(arch64, elf + ehdr.e_phoff + i * ehdr.e_phentsize, &phdr[i]);
}
コード例 #3
0
static int load_elf_header( const char *core_name, Elf32_Ehdr *ehdr, Elf32_Phdr **pphdr )
{
    int         fd;

    fd = open( core_name, O_RDONLY | O_BINARY );
    if( fd < 0 ) {
        return( NO_FILE );
    }
    if( !elf_read_hdr( fd, ehdr ) ) {
        close( fd );
        fd = NO_FILE;
    } else {
        if( !elf_read_phdr( fd, ehdr, pphdr ) ) {
            close( fd );
            fd = NO_FILE;
        }
    }
    return( fd );
}
コード例 #4
0
ファイル: unself.c プロジェクト: SerialVelocity/ps3tools
static void read_header(void)
{
	key_ver =    be16(self + 0x08);
	meta_offset = be32(self + 0x0c);
	header_len =  be64(self + 0x10);
	filesize =    be64(self + 0x18);
	info_offset = be64(self + 0x28);
	elf_offset =  be64(self + 0x30);
	phdr_offset = be64(self + 0x38) - elf_offset;
	shdr_offset = be64(self + 0x40) - elf_offset;
	sec_offset =  be64(self + 0x48);
	ver_offset =  be64(self + 0x50);

	version =   be64(self + info_offset + 0x10);
	app_type =    be32(self + info_offset + 0x0c);

	elf = self + elf_offset;
	arch64 = elf_read_hdr(elf, &ehdr);
}