Blame src/info/pe_get_image_abi.c

8c7b6a
/***************************************************************/
8c7b6a
/*  perk: PE Resource Kit                                      */
ced38a
/*  Copyright (C) 2015--2017  Z. Gilboa                        */
8c7b6a
/*  Released under GPLv2 and GPLv3; see COPYING.PERK.          */
8c7b6a
/***************************************************************/
8c7b6a
8c7b6a
#include <string.h>
8c7b6a
8c7b6a
#include <perk/perk.h>
d6e02b
#include <perk/perk_consts.h>
8c7b6a
#include <perk/perk_meta.h>
8c7b6a
461c11
static const char * const pe_abi_str[PE_ABI_CAP] = {
8c7b6a
	[PE_ABI_UNSUPPORTED]    = "UNSUPPORTED",
8c7b6a
	[PE_ABI_PE32]           = "PE32",
8c7b6a
	[PE_ABI_PE64]           = "PE64",
8c7b6a
};
8c7b6a
8c7b6a
int pe_get_image_abi(const struct pe_image_meta * m, struct pe_info_string * infostr)
8c7b6a
{
8c7b6a
	int abi;
8c7b6a
180890
	if (((abi = m->m_abi) < 0) || (abi >= PE_ABI_CAP))
180890
		abi = PE_ABI_UNSUPPORTED;
8c7b6a
8c7b6a
	if (infostr)
8c7b6a
		strcpy(infostr->buffer,pe_abi_str[abi]);
8c7b6a
8c7b6a
	return abi;
8c7b6a
}