[PATCH] winedbg: Avoid truncating a 32 bit exception code as exit code
Ken Thomases
ken at codeweavers.com
Fri May 10 19:39:59 CDT 2019
On May 10, 2019, at 3:20 PM, Martin Storsjo <martin at martin.st> wrote:
>
> On unix, traditionally only the lower 8 bits of the exit code
> are returned. In case ExceptionCode is EXCEPTION_WINE_STUB,
> 80000100, the observed exit code outside is zero, which would
> indicate successful execution.
>
> Therefore, just return a one, instead of trying to pass on the
> whole exception code, of which only a quarter is returned on unix.
>
> Signed-off-by: Martin Storsjo <martin at martin.st>
> ---
> programs/winedbg/tgt_active.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
> index 5385d0effa..0a4453f8d6 100644
> --- a/programs/winedbg/tgt_active.c
> +++ b/programs/winedbg/tgt_active.c
> @@ -977,7 +977,7 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
> DWORD exit_code = 0;
>
> if (pcs == dbg_curr_process && dbg_curr_thread->in_exception)
> - exit_code = dbg_curr_thread->excpt_record.ExceptionCode;
> + exit_code = 1;
>
> TerminateProcess(pcs->handle, exit_code);
> }
Other Win32 programs could presumably get the full exit code passed to TerminateProcess(), right? This seems like a problem that should be fixed at the point of the call to exit() or _exit(), instead.
-Ken
More information about the wine-devel
mailing list