I need to end all processes from a specific logon session. I know that this
can be done with the ExitWindows() or ExitWindowsEx() API.
So I have created a logoff.exe, which calls one of the above functions and I
start this with CreateProcessAsUser (hToken,...) to end the session
represented by hToken. The token is from a LogonUser() call.
However, this does not work - it seems that there happens nothing. If I run
a console (cmd.exe) under hToken and start the logoff.exe from there, the
console hangs. The window remains on the desktop, but there is no "cmd.exe"
process. Any other process running under hToken still remains.
What I'am doing wrong? How is it possible to end a session created with
LogonUser() ?
Thanks in advance
Daniel
> What I'am doing wrong? How is it possible to end a session created with
> LogonUser() ?
Until you can move to NT5 (Job objects are neat!), I would probably
attach as a debugger to the first process I launch, and have myself
notified of child creation. This is not without risk (timing issues,
serialization point in the debug event loop), but it is guaranteed to
get you the handles of _all_ child processes.
Once you have the handles, it's just a matter of trying WM_CLOSE,
console control events, or TerminateProcess().
--
Cheers,
Felix.
If you post a reply, kindly refrain from emailing it, too.
Note to spammers: fel...@mvps.org is my real email address.
No anti-spam address here. Just one comment: IN YOUR FACE!
Anthony
In article <3648b...@news.ivm.net>, dan...@uni-koblenz.de (Daniel Lohmann) wrote:
> Hi,
>
> I need to end all processes from a specific logon session. I know that
> this
> can be done with the ExitWindows() or ExitWindowsEx() API.
>
> So I have created a logoff.exe, which calls one of the above functions
> and I
> start this with CreateProcessAsUser (hToken,...) to end the session
> represented by hToken. The token is from a LogonUser() call.
>
> However, this does not work - it seems that there happens nothing. If I
> run
> a console (cmd.exe) under hToken and start the logoff.exe from there,
> the
> console hangs. The window remains on the desktop, but there is no
> "cmd.exe"
> process. Any other process running under hToken still remains.
>
> What I'am doing wrong? How is it possible to end a session created with
> LogonUser() ?
>
>
> Thanks in advance
>
> Daniel