Blame src/info/pe_get_image_framework.c

bf447f
/***************************************************************/
bf447f
/*  perk: PE Resource Kit                                      */
ced38a
/*  Copyright (C) 2015--2017  Z. Gilboa                        */
bf447f
/*  Released under GPLv2 and GPLv3; see COPYING.PERK.          */
bf447f
/***************************************************************/
bf447f
bf447f
#include <string.h>
bf447f
#include <stdbool.h>
bf447f
bf447f
#include <perk/perk.h>
bf447f
#include <perk/perk_meta.h>
bf447f
6ad4d2
static const char * const pe_framework_str[PE_FRAMEWORK_CAP] = {
bf447f
	[PE_FRAMEWORK_UNKNOWN]  = "unknown",
bf447f
	[PE_FRAMEWORK_FREESTD]  = "freestd",
bf447f
	[PE_FRAMEWORK_PSXSCL]   = "psxscl",
bf447f
	[PE_FRAMEWORK_MIDIPIX]  = "midipix",
bf447f
	[PE_FRAMEWORK_CYGONE]   = "cygone",
bf447f
	[PE_FRAMEWORK_CYGWIN]   = "cygwin",
bf447f
	[PE_FRAMEWORK_MINGW]    = "mingw",
bf447f
	[PE_FRAMEWORK_MSYS]     = "msys",
bf447f
	[PE_FRAMEWORK_SUACON]   = "suacon",
bf447f
	[PE_FRAMEWORK_WINCON]   = "wincon",
bf447f
	[PE_FRAMEWORK_WINCLI]   = "wincli",
bf447f
	[PE_FRAMEWORK_WIN32]    = "win32",
bf447f
};
bf447f
bf447f
int pe_get_image_framework(const struct pe_image_meta * m, struct pe_info_string * infostr)
bf447f
{
bf447f
	int framework;
bf447f
c13a6b
	if (((framework = m->m_framework) < 0) || (framework >= PE_FRAMEWORK_CAP))
bf447f
		framework = PE_FRAMEWORK_UNKNOWN;
bf447f
bf447f
	if (infostr)
bf447f
		strcpy(infostr->buffer,pe_framework_str[framework]);
bf447f
bf447f
	return framework;
bf447f
}