summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-11-26 11:46:46 -0500
committermidipix <writeonce@midipix.org>2016-11-10 23:35:27 -0500
commit9c5807c7cadf7219a32f3b2c081a8d21aceb4837 (patch)
tree05b106b7f8119bd7bd0e1ab6116ef2ee2b4285b8 /src/output
parent949bb3ba304be9bd80cda27c37c2d0d0da6a67dd (diff)
downloadperk-9c5807c7cadf7219a32f3b2c081a8d21aceb4837.tar.bz2
perk-9c5807c7cadf7219a32f3b2c081a8d21aceb4837.tar.xz
output import libraries and dependency symbols: initial implementation.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/pe_output_import_libraries.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/output/pe_output_import_libraries.c b/src/output/pe_output_import_libraries.c
new file mode 100644
index 0000000..1e47d81
--- /dev/null
+++ b/src/output/pe_output_import_libraries.c
@@ -0,0 +1,39 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#include <perk/perk.h>
+#include <perk/perk_output.h>
+#include "perk_output_impl.h"
+
+int pe_output_import_libraries(
+ const struct pe_image_meta * m,
+ const struct pe_common_ctx * cctx,
+ FILE * fout)
+{
+ FILE * ftmp;
+ int i,j;
+
+ if (!m->summary.num_of_implibs)
+ return 0;
+
+ if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
+ return -1;
+
+ for (i=0; i<m->summary.num_of_implibs; i++) {
+ if (cctx->fmtflags & PERK_OUTPUT_IMPORT_SYMS)
+ fprintf(fout,"%s:\n",m->idata[i].name);
+ else
+ fprintf(fout,"%s\n",m->idata[i].name);
+
+ if (cctx->fmtflags & PERK_OUTPUT_IMPORT_SYMS)
+ for (j=0; j<m->idata[i].count; j++)
+ if (m->idata[i].items[j].name)
+ fprintf(fout,"==> %s\n",
+ m->idata[i].items[j].name);
+ }
+
+ return pe_output_epilog(0,ftmp);
+}