summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/perk/perk.h2
-rw-r--r--src/driver/pe_amain.c2
-rw-r--r--src/output/pe_output_export_symbols.c22
3 files changed, 16 insertions, 10 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h
index 1e955b5..d30971e 100644
--- a/include/perk/perk.h
+++ b/include/perk/perk.h
@@ -199,7 +199,7 @@ perk_api void pe_free_unit_ctx (struct pe_unit_ctx *);
/* utility api */
perk_api int pe_main (int, char **, char **);
-perk_api int pe_output_export_symbols (const struct pe_image_meta *, const struct pe_common_ctx *, FILE *);
+perk_api int pe_output_export_symbols (const struct pe_driver_ctx *, const struct pe_image_meta *, FILE *);
perk_api int pe_output_import_libraries(const struct pe_driver_ctx *, const struct pe_image_meta *, FILE *);
perk_api int pe_output_error_record (const struct pe_driver_ctx *, const struct pe_error_info *);
perk_api int pe_output_error_vector (const struct pe_driver_ctx *);
diff --git a/src/driver/pe_amain.c b/src/driver/pe_amain.c
index 142db3b..e90cede 100644
--- a/src/driver/pe_amain.c
+++ b/src/driver/pe_amain.c
@@ -67,7 +67,7 @@ static void pe_perform_unit_actions(
uint64_t flags = uctx->cctx->fmtflags;
if (flags & PERK_OUTPUT_EXPORT_SYMS) {
- uctx->status = pe_output_export_symbols(uctx->meta,uctx->cctx,0);
+ uctx->status = pe_output_export_symbols(dctx,uctx->meta,0);
uctx->nerrors += !!uctx->status;
fpara += uctx->meta->summary.nexpsyms;
}
diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c
index 0ab3539..d47cb7a 100644
--- a/src/output/pe_output_export_symbols.c
+++ b/src/output/pe_output_export_symbols.c
@@ -13,6 +13,7 @@
#include <perk/perk.h>
#include <perk/perk_output.h>
#include "perk_output_impl.h"
+#include "perk_errinfo_impl.h"
static int pretty_header(const struct pe_common_ctx * cctx, FILE * fout)
{
@@ -32,23 +33,26 @@ static int pretty_export_item(const struct pe_common_ctx * cctx, const char * na
}
int pe_output_export_symbols(
+ const struct pe_driver_ctx * dctx,
const struct pe_image_meta * m,
- const struct pe_common_ctx * cctx,
FILE * fout)
{
- FILE * ftmp;
- uint32_t offset;
- uint32_t * symrva;
- unsigned i;
+ FILE * ftmp;
+ uint32_t offset;
+ uint32_t * symrva;
+ unsigned i;
+ const struct pe_common_ctx * cctx = dctx->cctx;
if (!m->hedata)
return 0;
if (!(fout = pe_output_prolog(cctx,fout,&ftmp)))
- return -1;
+ return PERK_SYSTEM_ERROR(dctx);
if ((pretty_header(cctx,fout)) < 0)
- return pe_output_epilog(-1,ftmp);
+ return pe_output_epilog(
+ PERK_FILE_ERROR(dctx),
+ ftmp);
offset = m->hedata->virtual_addr - m->hedata->ptr_to_raw_data;
symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.name_ptr_rva - offset));
@@ -58,7 +62,9 @@ int pe_output_export_symbols(
cctx,
(char *)((uintptr_t)m->image.addr + symrva[i] - offset),
fout)) < 0)
- return pe_output_epilog(-1,ftmp);
+ return pe_output_epilog(
+ PERK_FILE_ERROR(dctx),
+ ftmp);
return pe_output_epilog(0,ftmp);
}