blob: 3c90d7e430ecdec6f6c2f3ad3a924b733badc5fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/***************************************************************/
/* perk: PE Resource Kit */
/* Copyright (C) 2015--2017 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.PERK. */
/***************************************************************/
#include <string.h>
#include <perk/perk.h>
#include "perk_endian_impl.h"
#include "perk_reader_impl.h"
int pe_read_section_header(const struct pe_raw_sec_hdr * p, struct pe_meta_sec_hdr * m)
{
/* name: meta struct conveniently contains null termination */
memset(m,0,sizeof(m->sh_name));
memcpy(m,p,sizeof(p->sh_name));
m->sh_long_name = 0;
m->sh_virtual_size = pe_read_long(p->sh_virtual_size);
m->sh_virtual_addr = pe_read_long(p->sh_virtual_addr);
m->sh_size_of_raw_data = pe_read_long(p->sh_size_of_raw_data);
m->sh_ptr_to_raw_data = pe_read_long(p->sh_ptr_to_raw_data);
m->sh_ptr_to_relocs = pe_read_long(p->sh_ptr_to_relocs);
m->sh_ptr_to_line_nums = pe_read_long(p->sh_ptr_to_line_nums);
m->sh_num_of_relocs = pe_read_short(p->sh_num_of_relocs);
m->sh_num_of_line_nums = pe_read_short(p->sh_num_of_line_nums);
m->sh_characteristics = pe_read_long(p->sh_characteristics);
return 0;
}
|