🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Robby Gebauer Sat, 01 Mar 2008 14:05
Start an app from a service under accout of current user
#589
Author: Robby Gebauer
Date: Sat, 01 Mar 2008 14:05
11 lines
1254 bytes
Hello,

I have a service running, that is watching a directory. If something 
changes in that directory, my service terminates an app, copies some 
files and starts the previously terminated app again. Unfortunatly, 
after that the app is running under system's account.

Is there a way to start the app like before?

Thanks in advance
Rob'
Re: Start an app from a service under accout of current user
#593
Author: Remy Lebeau (TeamB)
Date: Mon, 03 Mar 2008 17:22
14 lines
1467 bytes
"Robby Gebauer" <robby.gebauer@gmx.de> wrote in message 
news:47c96278$1@newsgroups.borland.com...

> I have a service running, that is watching a directory. If
> something changes in that directory, my service terminates
> an app, copies some files and starts the previously terminated
> app again. Unfortunatly, after that the app is running under
> system's account.

Look at CreateProcessAsUser() or CreateProcessWithLogonW()


Gambit 
Re: Start an app from a service under accout of current user
#595
Author: Robby Gebauer
Date: Mon, 03 Mar 2008 17:44
8 lines
1178 bytes
Hi Remy,

thanks for your answer.

I know this fuctions, but I don't know how to get the token of the 
current user. Have you a hint (or better a code snippet) how to do that?

Rob'
Re: Start an app from a service under accout of current user
#597
Author: Remy Lebeau (TeamB)
Date: Mon, 03 Mar 2008 20:10
18 lines
1766 bytes
"Robby Gebauer" <robby.gebauer@gmx.de> wrote in message 
news:47cc38d4$1@newsgroups.borland.com...

> I know this fuctions, but I don't know how to
> get the token of the current user.

That can be difficult to do from inside a service, especially on XP with 
Fast User Switching enabled, or on systems using Terminal Services (which 
FUS uses internally).  In a nutshell, you would have to locate a running 
process for the desired user (such as the Explorer.exe shell) and extract 
its token via OpenProcessToken().

I suggest you go to http://www.deja.com and search the newsgroup archives. 
This has been discussed in detail many times before.


Gambit 
Re: Start an app from a service under accout of current user
#605
Author: Robby Gebauer
Date: Tue, 04 Mar 2008 12:31
3 lines
1052 bytes
Thanks for your help.

Rob'
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads