diff --git a/dlls/kernel/module.c b/dlls/kernel/module.c index d06b0c495c3..6e8a51e8523 100644 --- a/dlls/kernel/module.c +++ b/dlls/kernel/module.c @@ -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); } } diff --git a/dlls/kernel/ne_module.c b/dlls/kernel/ne_module.c index 212650a6aa3..5c053bde92a 100644 --- a/dlls/kernel/ne_module.c +++ b/dlls/kernel/ne_module.c @@ -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) + diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index 521391a6ca7..a9e33e780e2 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -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 );