这是我编的一个读PE头的程序,但是有点问题,
void main()
{
IMAGE_DOS_HEADER Dh;
FILE *fq;
IMAGE_NT_HEADERS Nth;
PIMAGE_SECTION_HEADER pSh=NULL;
fq=openfile("C:\\123.exe");
GetDosHead(fq,&Dh);
if(!IsDOSfile(&Dh))
printf("this is not a dos file");
GetNtfile(fq,&Nth,Dh.e_lfanew);
if(!IsPEfile(&Nth))
printf("this is not a pe file");
IMAGE_FILE_HEADER pFh=Nth.FileHeader;
IMAGE_OPTIONAL_HEADER pOh=Nth.OptionalHeader;
printf("section number: \t%04X\n",pFh.NumberOfSections);
printf("Machine:\t%04X\n",pFh.Machine);
printf("size of option head:\t%04X\n",pFh.SizeOfOptionalHeader );
printf("address of entry:\t%04X\n",pOh.AddressOfEntryPoint );
printf("ImageBase:\t%04X\n",pOh.ImageBase);