Don't reject OS/2 programs, try to carry on in DOS mode.

oldstable
Andreas Mohr 2004-09-10 21:16:02 +00:00 committed by Alexandre Julliard
parent 9b5c0ff375
commit 85b06836a5
3 changed files with 18 additions and 12 deletions

View File

@ -118,7 +118,7 @@ static enum binary_type MODULE_Decide_OS2_OldWin(HANDLE hfile, const IMAGE_DOS_H
}
broken:
ERR("Hmm, an error occurred. Is this binary file broken ?\n");
ERR("Hmm, an error occurred. Is this binary file broken?\n");
good:
HeapFree( GetProcessHeap(), 0, modtab);
@ -169,7 +169,7 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile, void **res_start, void **re
return BINARY_UNKNOWN;
}
/* Mach-o File with Endian set to Big Endian or Little Endian*/
/* Mach-o File with Endian set to Big Endian or Little Endian */
if (header.macho.magic == 0xfeedface || header.macho.magic == 0xecafdeef)
{
switch(header.macho.filetype)
@ -230,8 +230,12 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile, void **res_start, void **re
{
switch ( ext_header.os2.ne_exetyp )
{
case 2: return BINARY_WIN16;
case 5: return BINARY_DOS;
case 1: return BINARY_OS216; /* OS/2 */
case 2: return BINARY_WIN16; /* Windows */
case 3: return BINARY_DOS; /* European MS-DOS 4.x */
case 4: return BINARY_WIN16; /* Windows 386; FIXME: is this 32bit??? */
case 5: return BINARY_DOS; /* BOSS, Borland Operating System Services */
/* other types, e.g. 0 is: "unknown" */
default: return MODULE_Decide_OS2_OldWin(hfile, &header.mz, &ext_header.os2);
}
}

View File

@ -644,13 +644,20 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) 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");
MESSAGE("Sorry, this is an OS/2 linear executable (LX) file!\n");
return (HMODULE16)12;
}
if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11; /* invalid exe */
/* We now have a valid NE header */
/* check to be able to fall back to loading OS/2 programs as DOS
* FIXME: should this check be reversed in order to be less strict?
* (only fail for OS/2 ne_exetyp 0x01 here?) */
if ((ne_header.ne_exetyp != 0x02 /* Windows */)
&& (ne_header.ne_exetyp != 0x04) /* Windows 386 */)
return (HMODULE16)11; /* invalid exe */
size = sizeof(NE_MODULE) +
/* segment table */
ne_header.ne_cseg * sizeof(SEGTABLEENTRY) +

View File

@ -1109,6 +1109,7 @@ void __wine_kernel_init(void)
ExitProcess(1);
}
/* fall through */
case BINARY_OS216:
case BINARY_WIN16:
case BINARY_DOS:
TRACE( "starting Win16/DOS binary %s\n", debugstr_w(main_exe_name) );
@ -1122,9 +1123,6 @@ void __wine_kernel_init(void)
MESSAGE( "wine: trying to run %s, cannot open builtin library for 'winevdm.exe': %s\n",
debugstr_w(main_exe_name), error );
ExitProcess(1);
case BINARY_OS216:
MESSAGE( "wine: %s is an OS/2 binary, not supported\n", debugstr_w(main_exe_name) );
ExitProcess(1);
case BINARY_UNIX_EXE:
MESSAGE( "wine: %s is a Unix binary, not supported\n", debugstr_w(main_exe_name) );
ExitProcess(1);
@ -1906,16 +1904,13 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_ATTRIB
retv = create_process( hFile, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info, unixdir, res_start, res_end );
break;
case BINARY_OS216:
case BINARY_WIN16:
case BINARY_DOS:
TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) );
retv = create_vdm_process( name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info, unixdir );
break;
case BINARY_OS216:
FIXME( "%s is OS/2 binary, not supported\n", debugstr_w(name) );
SetLastError( ERROR_BAD_EXE_FORMAT );
break;
case BINARY_PE_DLL:
TRACE( "not starting %s since it is a dll\n", debugstr_w(name) );
SetLastError( ERROR_BAD_EXE_FORMAT );