Blame src/output/pe_output_image_symbols.c

f779e3
/***************************************************************/
f779e3
/*  perk: PE Resource Kit                                      */
6a5301
/*  Copyright (C) 2015--2025  SysDeer Technologies, LLC        */
f779e3
/*  Released under GPLv2 and GPLv3; see COPYING.PERK.          */
f779e3
/***************************************************************/
f779e3
f779e3
#include <stdio.h>
f779e3
#include <string.h>
f779e3
f779e3
#include <perk/perk.h>
d6e02b
#include <perk/perk_structs.h>
f779e3
#include <perk/perk_output.h>
f779e3
#include "perk_reader_impl.h"
67bba7
#include "perk_driver_impl.h"
67bba7
#include "perk_dprintf_impl.h"
f779e3
#include "perk_errinfo_impl.h"
f779e3
f779e3
int pe_output_image_symbols(
f779e3
	const struct pe_driver_ctx *	dctx,
67bba7
	const struct pe_image_meta *	meta)
f779e3
{
67bba7
	int				fdout;
f848fd
	struct pe_meta_coff_symbol *	symrec;
f779e3
	const char * 			dash = "";
f779e3
67bba7
	fdout = pe_driver_fdout(dctx);
f779e3
f779e3
	if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) {
67bba7
		if (pe_dprintf(fdout,"symbols:\n") < 0)
f779e3
			return PERK_FILE_ERROR(dctx);
f779e3
f779e3
		dash = "- ";
f779e3
	}
f779e3
f848fd
	for (symrec=meta->m_symtbl; symrec->cs_name; symrec++)
f848fd
		if (pe_dprintf(fdout,"%s%s\n",dash,symrec->cs_name) < 0)
ea6b78
			return PERK_FILE_ERROR(dctx);
f779e3
f779e3
	return 0;
f779e3
}