I'm trying to study more about PE headers, so i wanted to load a file diretly into memory and then print his PE headers.
To do this i first use fopen() and fread()
And then o got the "MZ".
FILE* fd = fopen("test.exe","r");
printf("The magic is: %s",buffer);
Now i'm trying to simulate a file structure:
But here is here i got stuck. In order for me to "point" this structure on the exe, i have to be able to load this exe directly onto memory (without using a file descriptor i think). Do you guys know a way to do this?
Just to better explain what im thinking, i wanted to do the following:
Can you guys help me!?
//Magicaly load the exe onto memory and a pointer named "p_EXE" points to the first byte, so:
dos_header* dheader = p_EXE;
printf("The magic is %s", dheader->e_magic);