Blame src/headers/pe_get_image_dos_hdr_addr.c

feffc7
/*****************************************************************************/
feffc7
/*  pemagination: a (virtual) tour into portable bits and executable bytes   */
feffc7
/*  Copyright (C) 2013,2014,2015  Z. Gilboa                                  */
feffc7
/*  Released under GPLv2 and GPLv3; see COPYING.PEMAGINE.                    */
feffc7
/*****************************************************************************/
feffc7
feffc7
#include <psxtypes/psxtypes.h>
feffc7
feffc7
#include <pemagine/pe_consts.h>
feffc7
#include <pemagine/pe_structs.h>
feffc7
#include <pemagine/pemagine.h>
feffc7
feffc7
pe_api
feffc7
struct pe_image_dos_hdr * pe_get_image_dos_hdr_addr(const void * base)
feffc7
{
feffc7
	struct pe_image_dos_hdr * dos;
feffc7
feffc7
	dos = (struct pe_image_dos_hdr *)base;
feffc7
feffc7
	if ((dos->dos_magic[0] == 'M') && (dos->dos_magic[1] == 'Z'))
feffc7
		return dos;
feffc7
	else
feffc7
		return 0;
feffc7
}