DosStopSession (OS/2 1.x)

This call terminates a session previously started with DosStartSession.

Syntax
DosStopSession (TargetOption, SessID, Reserved)

Parameters

 * TargetOption (USHORT) - input : Specifies whether the session specified by SessID or all sessions should be terminated.
 * 0 - Terminate session specified.
 * 1 - Terminate all child sessions and descendant sessions.


 * SessID (USHORT) - input : Session ID session to be terminated. The value specified must equal the SessID returned on a previous DosStartSession call. SessID is ignored if TargetOption = 1.
 * Reserved (ULONG) - input : A doubleword of 0's.

Return Code

 * rc (USHORT) - return:Return code descriptions are:
 * 0 NO_ERROR
 * 369 ERROR_SMG_INVALID_SESSION_ID
 * 418 ERROR/SMG_INVALID_CALL
 * 452 ERROR_SMG_SESSION_NOT_PARENT
 * 458 ERROR_SMG_INVALID_STOP_OPTION
 * 459 ERROR_SMG_BAD_RESERVE

Remarks
DosStopSession may be issued by a parent session only for a child session. The parent session cannot issue this call with itself as the target or a descendant of a child session as the target. However, if the child session specified with DosStopSession does have descendants, these sessions are also terminated.

DosStopSession may terminate only child sessions originally started by the caller with DosStartSession specifying Related = 1. Sessions started as independent sessions cannot be stopped by this call.

A parent session may be running in either the foreground or background when DosStopSession is issued. If a child session is running in the foreground at the time it is stopped, the parent session becomes the foreground session. DosStopSession breaks any bond that was established between the parent session and child session by a DosSetSession request.

The process running in the session specified on the DosStopSession call may refuse to terminate. DosStopSession returns a normal return code in this case. The only way to ensure that a target session has terminated is to wait for notification of its demise by a termination queue created with a DosStartSession request.

C

 * 1) define INCL_DOSSESMGR

USHORT rc = DosStopSession(TargetOption, SessID, Reserved);

USHORT TargetOption;  /* Target option */ USHORT SessID;        /* Session ID */ ULONG  0;             /* Reserved (must be zero) */

USHORT rc;            /* return code */ 

MASM
 EXTRN DosStopSession:FAR INCL_DOSSESMGR     EQU 1

PUSH  WORD    TargetOption  ;Target option PUSH  WORD    SessID        ;Session ID PUSH   DWORD   0             ;Reserved (must be zero) CALL  DosStopSession

Returns WORD 