Blame src/headers/pe_get_image_opt_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
#include <pemagine/pe_structs.h>
feffc7
#include <pemagine/pemagine.h>
feffc7
feffc7
pe_api
fad23f
union pe_raw_opt_hdr * pe_get_image_opt_hdr_addr(const void * base)
feffc7
{
b7ba5f
	struct pe_raw_coff_file_hdr *	coff;
b7ba5f
	void *				addr;
feffc7
feffc7
	if (!(coff = pe_get_image_coff_hdr_addr(base)))
feffc7
		return 0;
b7ba5f
b7ba5f
	addr = pe_va_from_rva(coff,sizeof(*coff));
b7ba5f
	return (union pe_raw_opt_hdr *)addr;
feffc7
}