This call terminates a session previously started with DosStartSession.
DosStopSession
TargetOption (USHORT) - input
Value
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.