Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Apr : TerminateProcess doesn't work when app. started from WinService.

www.cryer.info
Managed Newsgroup Archive

TerminateProcess doesn't work when app. started from WinService.

Subject:TerminateProcess doesn't work when app. started from WinService.
Posted by:"Peter Stade" (peter.te..@telia.com)
Date:Thu, 12 Apr 2007 10:08:21

I know I posted this in the wrong forum earlier, sorry for that...

I'm trying to build a watch-dog which should "kill" some client-applications
started from a winservice using :TerminateProcess(processHandle, 0).
If I start the application myself there is no problem to kill it,  but it
fails when it's started from the service.

Due to limitations in the service-application which starts a lot of clients,
the clients are created on different desktops and are therefor not visible.
Instead they are shown on wireless handheld devices used to pick goods in
big warehouses.
Sometimes the connection fails between the server-application and the
handheld device which causes the client exe-file to hung. It's those hunged
clients I'm trying to kill...
Its probably user-rights in combination with different desktops but there
must be someway to solve it ?

Since the whole server-application is a third-party application with lots of
limitations I have to solve it myself the "hard way".
Any tip ?

Got this answer in an other forum ...

>Services run in the SYSTEM account by default, and any child process
>is likely to be running in the same account as well, unless
>CreateProcessAsUser() is used instead of CreateProcess().  System
>processes cannot be killed manually.

Does this mean that its no solution to this problem?

kind regards Peter

Replies:

www.cryer.info
Managed Newsgroup Archive