diff options
Diffstat (limited to 'src/internal/perk_hdrdump_impl.h')
-rw-r--r-- | src/internal/perk_hdrdump_impl.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/internal/perk_hdrdump_impl.h b/src/internal/perk_hdrdump_impl.h new file mode 100644 index 0000000..41528ad --- /dev/null +++ b/src/internal/perk_hdrdump_impl.h @@ -0,0 +1,49 @@ +/***************************************************************/ +/* perk: PE Resource Kit */ +/* Copyright (C) 2015--2018 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.PERK. */ +/***************************************************************/ + +#ifndef PERK_HDRDUMP_IMPL_H +#define PERK_HDRDUMP_IMPL_H + +#include <stddef.h> + +#define PE_QUOTE(s) #s +#define PE_STRING(s) PE_QUOTE(s) +#define PE_TYPE(t) struct pe_raw_ ## t +#define PE_OFFSET(t,x) offsetof(PE_TYPE(t),x) +#define PE_SIZE(p,x) sizeof((p)->x) + +#define PE_OUTPUT_RAW_ELEMENT_TABLE(ch,p,t,x) \ + pe_output_raw_element( \ + ch,p, \ + PE_STRING(x), \ + PE_OFFSET(t,x), \ + PE_SIZE(p,x)) + +#define PE_OUTPUT_TABLE(x) \ + PE_OUTPUT_RAW_ELEMENT_TABLE( \ + ch, \ + PE_ADDR, \ + PE_RAW_STRUCT, \ + x) + +size_t pe_output_hex_header( + char * buf, + const char * sname, + uint64_t faddr, + uint64_t vaddr, + int bits); + +size_t pe_output_hex_footer( + char * buf); + +size_t pe_output_raw_element( + char * ch, + const void * rdata, + const char * mname, + uint32_t moffset, + uint32_t msize); + +#endif |