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

This commit is contained in:
Alexandre Julliard 2008-05-07 17:33:50 +02:00
parent f334c0fbba
commit 2dc9ed3006
4 changed files with 24 additions and 11 deletions

View File

@ -593,7 +593,7 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
__wine_pop_frame( &frame );
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)
SetLastError(ERROR_NOT_SUPPORTED);
else

View File

@ -511,8 +511,6 @@ BOOL DOSMEM_MapDosLayout(void)
ERR( "Need full access to the first megabyte for DOS mode\n" );
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 */
memcpy( DOSMEM_dosmem, DOSMEM_sysmem, 0x400 + 0x100 );
DOSMEM_sysmem = DOSMEM_dosmem;

View File

@ -569,15 +569,16 @@ static LONG WINAPI exception_handler(EXCEPTION_POINTERS *eptr)
return EXCEPTION_CONTINUE_SEARCH;
}
int WINAPI DOSVM_Enter( CONTEXT86 *context )
INT WINAPI DOSVM_Enter( CONTEXT86 *context )
{
INT ret = 0;
if (!ISV86(context))
ERR( "Called with protected mode context!\n" );
__TRY
{
WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)context );
TRACE_(module)( "vm86 returned: %s\n", strerror(errno) );
if (!WOWCallback16Ex( 0, WCB16_REGS, 0, NULL, (DWORD *)context )) ret = -1;
TRACE_(module)( "ret %d err %u\n", ret, GetLastError() );
}
__EXCEPT(exception_handler)
{
@ -585,7 +586,7 @@ int WINAPI DOSVM_Enter( CONTEXT86 *context )
}
__ENDTRY
return 0;
return ret;
}
/***********************************************************************
@ -645,8 +646,8 @@ void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val)
*/
INT WINAPI DOSVM_Enter( CONTEXT86 *context )
{
ERR_(module)("DOS realmode not supported on this architecture!\n");
return -1;
SetLastError( ERROR_NOT_SUPPORTED );
return -1;
}
/***********************************************************************

View File

@ -614,7 +614,7 @@ void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg )
static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra )
{
CONTEXT context;
DWORD ret;
INT ret;
dosvm_pid = getpid();
@ -628,9 +628,23 @@ static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra )
context.EFlags = V86_FLAG | VIF_MASK;
DOSVM_SetTimer(0x10000);
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;
return ret;
return ret != 0;
}
static BOOL MZ_InitTask(void)