|
|
049a18 |
/***************************************************************/
|
|
|
049a18 |
|
|
|
049a18 |
|
|
|
049a18 |
|
|
|
049a18 |
/***************************************************************/
|
|
|
049a18 |
|
|
|
049a18 |
#include <string.h>
|
|
|
049a18 |
|
|
|
049a18 |
#include <perk/perk.h>
|
|
|
049a18 |
#include <perk/perk_meta.h>
|
|
|
049a18 |
|
|
|
049a18 |
static const char const * pe_subsystem_str[0x10] = {
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_UNKNOWN] = "unknown",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_NATIVE] = "native",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_WINDOWS_GUI] = "windows",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_WINDOWS_CUI] = "console",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_POSIX_CUI] = "posix",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_WINDOWS_CE_GUI] = "wince",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_EFI_APPLICATION] = "efi_app",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER] = "efi_driver",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_EFI_ROM] = "efi_rom",
|
|
|
049a18 |
[PE_IMAGE_SUBSYSTEM_XBOX] = "xbox"
|
|
|
049a18 |
};
|
|
|
049a18 |
|
|
|
049a18 |
int pe_get_image_subsystem(const struct pe_image_meta * m, struct pe_info_string * infostr)
|
|
|
049a18 |
{
|
|
|
049a18 |
int subsystem;
|
|
|
049a18 |
|
|
|
049a18 |
if (m->opt.img.subsystem >= 0x10)
|
|
|
049a18 |
subsystem = -1;
|
|
|
049a18 |
|
|
|
049a18 |
else if (!pe_subsystem_str[m->opt.img.subsystem])
|
|
|
049a18 |
subsystem = -1;
|
|
|
049a18 |
|
|
|
049a18 |
else
|
|
|
049a18 |
subsystem = m->opt.img.subsystem;
|
|
|
049a18 |
|
|
|
049a18 |
if ((subsystem < 0) && infostr) {
|
|
|
049a18 |
strcpy(infostr->buffer,"INVALID");
|
|
|
049a18 |
return subsystem;
|
|
|
049a18 |
}
|
|
|
049a18 |
|
|
|
049a18 |
if (infostr)
|
|
|
049a18 |
strcpy(infostr->buffer,pe_subsystem_str[subsystem]);
|
|
|
049a18 |
|
|
|
049a18 |
return subsystem;
|
|
|
049a18 |
}
|