Alexandre Julliard : winedos: Print better diagnostics when a DOS app fails to start.
Alexandre Julliard
julliard at winehq.org
Wed May 7 13:28:10 CDT 2008
Module: wine
Branch: master
Commit: 2dc9ed3006dde794113c490ba15e06af551c8788
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2dc9ed3006dde794113c490ba15e06af551c8788
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed May 7 17:33:50 2008 +0200
winedos: Print better diagnostics when a DOS app fails to start.
---
dlls/kernel32/wowthunk.c | 2 +-
dlls/winedos/dosmem.c | 2 --
dlls/winedos/dosvm.c | 13 +++++++------
dlls/winedos/module.c | 20 +++++++++++++++++---
4 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/wowthunk.c b/dlls/kernel32/wowthunk.c
index 791f7cf..e86c582 100644
--- a/dlls/kernel32/wowthunk.c
+++ b/dlls/kernel32/wowthunk.c
@@ -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
diff --git a/dlls/winedos/dosmem.c b/dlls/winedos/dosmem.c
index 876a3e7..76bf10c 100644
--- a/dlls/winedos/dosmem.c
+++ b/dlls/winedos/dosmem.c
@@ -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;
diff --git a/dlls/winedos/dosvm.c b/dlls/winedos/dosvm.c
index 7defba1..4a86855 100644
--- a/dlls/winedos/dosvm.c
+++ b/dlls/winedos/dosvm.c
@@ -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;
}
/***********************************************************************
diff --git a/dlls/winedos/module.c b/dlls/winedos/module.c
index ade7732..ac35e85 100644
--- a/dlls/winedos/module.c
+++ b/dlls/winedos/module.c
@@ -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)
More information about the wine-cvs
mailing list