Make DOS process exit using ExitProcess instead of ExitThread.
Make calling DOS exit functions from DPMI either return to StartPM or print error message if not allowed by DPMI specification.
This commit is contained in:
parent
09a97f0608
commit
7fb4957873
@ -18,10 +18,10 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "winbase.h"
|
|
||||||
#include "dosexe.h"
|
#include "dosexe.h"
|
||||||
#include "miscemu.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(int);
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DOSVM_Int20Handler (WINEDOS16.132)
|
* DOSVM_Int20Handler (WINEDOS16.132)
|
||||||
@ -30,9 +30,10 @@
|
|||||||
*/
|
*/
|
||||||
void WINAPI DOSVM_Int20Handler( CONTEXT86 *context )
|
void WINAPI DOSVM_Int20Handler( CONTEXT86 *context )
|
||||||
{
|
{
|
||||||
/* FIXME: Is this correct in DOS DPMI? */
|
if (DOSVM_IsWin16())
|
||||||
if (ISV86(context))
|
ExitThread( 0 );
|
||||||
|
else if(ISV86(context))
|
||||||
MZ_Exit( context, TRUE, 0 );
|
MZ_Exit( context, TRUE, 0 );
|
||||||
else
|
else
|
||||||
ExitThread(0);
|
ERR( "Called from DOS protected mode\n" );
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
#include "wine/exception.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: Delete this reference when all int21 code has been moved to winedos.
|
* FIXME: Delete this reference when all int21 code has been moved to winedos.
|
||||||
@ -2623,8 +2624,10 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||||||
TRACE("TERMINATE PROGRAM\n");
|
TRACE("TERMINATE PROGRAM\n");
|
||||||
if (DOSVM_IsWin16())
|
if (DOSVM_IsWin16())
|
||||||
ExitThread( 0 );
|
ExitThread( 0 );
|
||||||
else
|
else if(ISV86(context))
|
||||||
MZ_Exit( context, FALSE, 0 );
|
MZ_Exit( context, FALSE, 0 );
|
||||||
|
else
|
||||||
|
ERR( "Called from DOS protected mode\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x01: /* READ CHARACTER FROM STANDARD INPUT, WITH ECHO */
|
case 0x01: /* READ CHARACTER FROM STANDARD INPUT, WITH ECHO */
|
||||||
@ -3398,8 +3401,16 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||||||
TRACE( "EXIT with return code %d\n", AL_reg(context) );
|
TRACE( "EXIT with return code %d\n", AL_reg(context) );
|
||||||
if (DOSVM_IsWin16())
|
if (DOSVM_IsWin16())
|
||||||
ExitThread( AL_reg(context) );
|
ExitThread( AL_reg(context) );
|
||||||
else
|
else if(ISV86(context))
|
||||||
MZ_Exit( context, FALSE, AL_reg(context) );
|
MZ_Exit( context, FALSE, AL_reg(context) );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Exit from DPMI.
|
||||||
|
*/
|
||||||
|
DWORD rv = AL_reg(context);
|
||||||
|
RaiseException( EXCEPTION_VM86_INTx, 0, 1, &rv );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x4d: /* GET RETURN CODE */
|
case 0x4d: /* GET RETURN CODE */
|
||||||
|
@ -69,6 +69,7 @@ typedef struct tagRMCB {
|
|||||||
static RMCB *FirstRMCB = NULL;
|
static RMCB *FirstRMCB = NULL;
|
||||||
static WORD dpmi_flag;
|
static WORD dpmi_flag;
|
||||||
static void* lastvalloced = NULL;
|
static void* lastvalloced = NULL;
|
||||||
|
static BYTE DPMI_retval;
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DOSVM_IsDos32
|
* DOSVM_IsDos32
|
||||||
@ -100,6 +101,14 @@ static WINE_EXCEPTION_FILTER(dpmi_exception_handler)
|
|||||||
DOSVM_SendQueuedEvents(context);
|
DOSVM_SendQueuedEvents(context);
|
||||||
return EXCEPTION_CONTINUE_EXECUTION;
|
return EXCEPTION_CONTINUE_EXECUTION;
|
||||||
}
|
}
|
||||||
|
else if (rec->ExceptionCode == EXCEPTION_VM86_INTx)
|
||||||
|
{
|
||||||
|
if (ISV86(context))
|
||||||
|
ERR( "Real mode INTx caught by protected mode handler!\n" );
|
||||||
|
DPMI_retval = (BYTE)rec->ExceptionInformation[0];
|
||||||
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
@ -593,8 +602,14 @@ static void StartPM( CONTEXT86 *context )
|
|||||||
}
|
}
|
||||||
__ENDTRY
|
__ENDTRY
|
||||||
|
|
||||||
/* in the current state of affairs, we won't ever actually return here... */
|
TRACE( "Protected mode DOS program is terminating\n" );
|
||||||
/* we should have int21/ah=4c do it someday, though... */
|
|
||||||
|
/*
|
||||||
|
* FIXME: Instead of calling ExitThread, we should release all
|
||||||
|
* allocated protected mode resources and call MZ_Exit
|
||||||
|
* using real mode context. See DPMI specification.
|
||||||
|
*/
|
||||||
|
ExitThread( DPMI_retval );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
FreeSelector16(psp->environment);
|
FreeSelector16(psp->environment);
|
||||||
|
@ -623,7 +623,7 @@ static void MZ_Launch( LPCSTR cmdtail, int length )
|
|||||||
loop_thread = 0; loop_tid = 0;
|
loop_thread = 0; loop_tid = 0;
|
||||||
|
|
||||||
VGA_Clean();
|
VGA_Clean();
|
||||||
ExitThread(rv);
|
ExitProcess(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user