ExitProcessEx function

The ExitProcessEx function terminates the process, returning the exit code. The return code is passed through the stack. The function automatically aligns the stack to 2 bytes.

Parameters (stack): 1. Return code.

Return value: The function does not return a value.

Flag state: The function does not modify the flags.

Program source code

Intel 8086 assembly program example demonstrating the use of the ExitProcessEx function to terminate the process with the return code passed through the stack.

title Author: Evgeny Sergeevich Dovgopolov

.286C
.model small
.stack 100h

code segment public
    assume  cs:code
    include Handyfar.inc        ; Include the file with functions

    main proc
        call    SetDataSegment  ; Call the SetDataSegment procedure

        push    0               ; Push the byte return code onto the top of the stack
        call    ExitProcessEx   ; Call the ExitProcessEx(0) procedure
    main endp

code ends
end main

Return value: 0

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".