Skip to content
Snippets Groups Projects
Commit c8c800c8 authored by Uwe Bonnes's avatar Uwe Bonnes Committed by Alexandre Julliard
Browse files

Check for MZ header before trying to decipher the PE header.

parent 9c55e6dc
No related branches found
No related tags found
No related merge requests found
......@@ -498,13 +498,18 @@ HMODULE PE_LoadImage( HANDLE hFile, LPCSTR filename, WORD *version )
WARN("MapViewOfFile error %ld\n", GetLastError() );
return 0;
}
if ( *(WORD*)hModule !=IMAGE_DOS_SIGNATURE)
{
WARN("%s image doesn't have DOS signature, but 0x%04x\n", filename,*(WORD*)hModule);
goto error;
}
nt = PE_HEADER( hModule );
/* Check signature */
if ( nt->Signature != IMAGE_NT_SIGNATURE )
{
WARN("image doesn't have PE signature, but 0x%08lx\n",
nt->Signature );
WARN("%s image doesn't have PE signature, but 0x%08lx\n", nt->Signature );
goto error;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment