TE loader for IDA Pro  The EFI documentation defines a
simplified version of the PE32 image format, called “TE”, which
is intended to reduce the overheads of the PE/COFF headers. The
document in which this format is defined can be found here.
Apple’s EFI firmare (or at least one version I was looking at)
uses the TE image format for the SEC phase binary, but IDA Pro
doesn’t seem to understand TE, so I decided to have a crack at
writing a loader to handle TE images. This post describes both a
bit about the TE image format, and how to go about writing a
basic image loader for IDA Pro in Python.  First, a quick look
at the TE image format. It is a stripped down version of PE32,
so if you’re familiar with that then you’ll probably recognise
these fields. The main image header looks something like this:
typedef struct {     UINT16                   Signature;
UINT16                   Machine;     UINT8
NumberOfSections;     UINT8                    Subsystem;
UINT16                   St