ft_nm/src/header.c

21 lines
464 B
C

#include "ft_nm.h"
int get_header64(t_mapped_file mapped_file, Elf64_Ehdr *header) {
void *header_ptr = fetch(mapped_file, 0, 64);
if (!header_ptr) {
return FT_NM_FAILURE;
}
ft_memcpy(header, header_ptr, 64);
return FT_NM_SUCCESS;
}
int get_header32(t_mapped_file mapped_file, Elf32_Ehdr *header) {
void *header_ptr = fetch(mapped_file, 0, 52);
if (!header_ptr) {
return FT_NM_FAILURE;
}
ft_memcpy(header, header_ptr, 52);
return FT_NM_SUCCESS;
}