#pragma once
#include "pe32_64.h"

PIMAGE_NT_HEADERS get_nt_hdr(BYTE *rawPE)
{
    //get header
    IMAGE_DOS_HEADER* DOSHeader = PIMAGE_DOS_HEADER(rawPE);
    if (DOSHeader->e_magic != IMAGE_DOS_SIGNATURE) {
        return NULL;
    }
    PIMAGE_NT_HEADERS nt = PIMAGE_NT_HEADERS((char*)(rawPE)+DOSHeader->e_lfanew);
    if (nt->Signature != IMAGE_NT_SIGNATURE) {
        return NULL;
    }
    return nt;
}