Commit c4a26442 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Fixed NE_LoadExeHeader error handling.

parent 208955ca
......@@ -396,6 +396,9 @@ HANDLE NE_OpenFile( NE_MODULE *pModule )
/***********************************************************************
* NE_LoadExeHeader
*
* We always have to close hFile upon exit.
* Otherwise we get file sharing trouble !
*/
static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
{
......@@ -439,14 +442,21 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
return (HMODULE16)11; /* invalid exe */
}
if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE16)21; /* win32 exe */
if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11; /* invalid exe */
if (ne_header.ne_magic == IMAGE_NT_SIGNATURE)
{
_lclose16( hFile );
return (HMODULE16)21; /* win32 exe */
}
if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) {
MESSAGE("Sorry, this is an OS/2 linear executable (LX) file !\n");
_lclose16( hFile );
return (HMODULE16)12;
}
if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE)
{
_lclose16( hFile );
return (HMODULE16)11; /* invalid exe */
}
/* We now have a valid NE header */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment