Fixed NE_LoadExeHeader error handling.

This commit is contained in:
Andreas Mohr 2000-09-10 03:14:36 +00:00 committed by Alexandre Julliard
parent 208955cada
commit c4a264428b

View file

@ -396,6 +396,9 @@ HANDLE NE_OpenFile( NE_MODULE *pModule )
/*********************************************************************** /***********************************************************************
* NE_LoadExeHeader * NE_LoadExeHeader
*
* We always have to close hFile upon exit.
* Otherwise we get file sharing trouble !
*/ */
static HMODULE16 NE_LoadExeHeader( LPCSTR filename ) static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
{ {
@ -439,13 +442,20 @@ static HMODULE16 NE_LoadExeHeader( LPCSTR filename )
return (HMODULE16)11; /* invalid exe */ return (HMODULE16)11; /* invalid exe */
} }
if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE16)21; /* win32 exe */ if (ne_header.ne_magic == IMAGE_NT_SIGNATURE)
if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11; /* invalid exe */ {
_lclose16( hFile );
return (HMODULE16)21; /* win32 exe */
}
if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) { if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) {
MESSAGE("Sorry, this is an OS/2 linear executable (LX) file !\n"); MESSAGE("Sorry, this is an OS/2 linear executable (LX) file !\n");
_lclose16( hFile ); _lclose16( hFile );
return (HMODULE16)12; 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 */ /* We now have a valid NE header */