summaryrefslogtreecommitdiffhomepage
path: root/src/output
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-05-02 10:05:51 -0400
committermidipix <writeonce@midipix.org>2016-11-10 23:35:18 -0500
commitc0fbae7a40c662ae77f59f5f919cd6b88e38a85d (patch)
treead6aaca1b75a1f4b5e9ac533220e382f49489c94 /src/output
parent99ace9f6a21b254216f60613e91191d902daeeb8 (diff)
downloadperk-c0fbae7a40c662ae77f59f5f919cd6b88e38a85d.tar.bz2
perk-c0fbae7a40c662ae77f59f5f919cd6b88e38a85d.tar.xz
initial commit.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/pe_output_export_symbols.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c
new file mode 100644
index 0000000..192bca3
--- /dev/null
+++ b/src/output/pe_output_export_symbols.c
@@ -0,0 +1,24 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <perk/perk.h>
+
+int pe_output_export_symbols (const struct pe_image_meta * m, uint32_t flags, FILE * f)
+{
+ uint32_t offset;
+ uint32_t * symrva;
+ int i;
+
+ if (!m->hedata) return 0;
+
+ offset = m->hedata->virtual_addr - m->hedata->ptr_to_raw_data;
+ symrva = (uint32_t *)(m->image.addr + (m->edata.name_ptr_rva - offset));
+
+ for (i=0; i<m->edata.num_of_name_ptrs; i++)
+ fprintf(f,"%s\n",(char *)(m->image.addr + symrva[i] - offset));
+
+ return 0;
+}