Commit 2dc9ed30 authored by Alexandre Julliard's avatar Alexandre Julliard

winedos: Print better diagnostics when a DOS app fails to start.

parent f334c0fb
...@@ -593,7 +593,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, ...@@ -593,7 +593,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
__wine_pop_frame( &frame ); __wine_pop_frame( &frame );
if (errno != 0) /* enter_vm86 will fall with ENOSYS on x64 kernels */ if (errno != 0) /* enter_vm86 will fall with ENOSYS on x64 kernels */
{ {
ERR("__wine_enter_vm86 failed (errno=%d)\n", errno); WARN("__wine_enter_vm86 failed (errno=%d)\n", errno);
if (errno == ENOSYS) if (errno == ENOSYS)
SetLastError(ERROR_NOT_SUPPORTED); SetLastError(ERROR_NOT_SUPPORTED);
else else
......
...@@ -511,8 +511,6 @@ BOOL DOSMEM_MapDosLayout(void) ...@@ -511,8 +511,6 @@ BOOL DOSMEM_MapDosLayout(void)
ERR( "Need full access to the first megabyte for DOS mode\n" ); ERR( "Need full access to the first megabyte for DOS mode\n" );
ExitProcess(1); ExitProcess(1);
} }
MESSAGE( "Warning: unprotecting memory to allow real-mode calls.\n"
" NULL pointer accesses will no longer be caught.\n" );
/* copy the BIOS and ISR area down */ /* copy the BIOS and ISR area down */
memcpy( DOSMEM_dosmem, DOSMEM_sysmem, 0x400 + 0x100 ); memcpy( DOSMEM_dosmem, DOSMEM_sysmem, 0x400 + 0x100 );
DOSMEM_sysmem = DOSMEM_dosmem; DOSMEM_sysmem = DOSMEM_dosmem;
......
...@@ -569,15 +569,16 @@ static LONG WINAPI exception_handler(EXCEPTION_POINTERS *eptr) ...@@ -569,15 +569,16 @@ static LONG WINAPI exception_handler(EXCEPTION_POINTERS *eptr)
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
int WINAPI DOSVM_Enter( CONTEXT86 *context ) INT WINAPI DOSVM_Enter( CONTEXT86 *context )
{ {
INT ret = 0;
if (!ISV86(context)) if (!ISV86(context))
ERR( "Called with protected mode context!\n" ); ERR( "Called with protected mode context!\n" );
__TRY __TRY
{ {
WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)context ); if (!WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)context )) ret = -1;
TRACE_(module)( "vm86 returned: %s\n", strerror(errno) ); TRACE_(module)( "ret %d err %u\n", ret, GetLastError() );
} }
__EXCEPT(exception_handler) __EXCEPT(exception_handler)
{ {
...@@ -585,7 +586,7 @@ int WINAPI DOSVM_Enter( CONTEXT86 *context ) ...@@ -585,7 +586,7 @@ int WINAPI DOSVM_Enter( CONTEXT86 *context )
} }
__ENDTRY __ENDTRY
return 0; return ret;
} }
/*********************************************************************** /***********************************************************************
...@@ -645,8 +646,8 @@ void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val) ...@@ -645,8 +646,8 @@ void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val)
*/ */
INT WINAPI DOSVM_Enter( CONTEXT86 *context ) INT WINAPI DOSVM_Enter( CONTEXT86 *context )
{ {
ERR_(module)("DOS realmode not supported on this architecture!\n"); SetLastError( ERROR_NOT_SUPPORTED );
return -1; return -1;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -614,7 +614,7 @@ void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg ) ...@@ -614,7 +614,7 @@ void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg )
static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra ) static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra )
{ {
CONTEXT context; CONTEXT context;
DWORD ret; INT ret;
dosvm_pid = getpid(); dosvm_pid = getpid();
...@@ -628,9 +628,23 @@ static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra ) ...@@ -628,9 +628,23 @@ static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra )
context.EFlags = V86_FLAG | VIF_MASK; context.EFlags = V86_FLAG | VIF_MASK;
DOSVM_SetTimer(0x10000); DOSVM_SetTimer(0x10000);
ret = DOSVM_Enter( &context ); ret = DOSVM_Enter( &context );
if (ret == -1)
{
/* fetch the app name from the environment */
PDB16 *psp = PTR_REAL_TO_LIN( DOSVM_psp, 0 );
char *env = PTR_REAL_TO_LIN( psp->environment, 0 );
while (*env) env += strlen(env) + 1;
env += 1 + sizeof(WORD);
if (GetLastError() == ERROR_NOT_SUPPORTED)
MESSAGE( "wine: Cannot start DOS application %s\n"
" because vm86 mode is not supported on this platform.\n",
debugstr_a(env) );
else
FIXME( "vm86 mode failed error %u\n", GetLastError() );
}
dosvm_pid = 0; dosvm_pid = 0;
return ret; return ret != 0;
} }
static BOOL MZ_InitTask(void) static BOOL MZ_InitTask(void)
......
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