|
|
|
date: Mon, 4 Aug 2008 09:24:47 +0200,
group: microsoft.public.platformsdk.security
back
Re: How to launch a user process from a system process
Finally I found a solution with CreateProcessAsUser, using the token of explorer.exe :
- EnumProcesses
Loop for each process id:
- OpenProcess
- EnumProcessModules
- GetModuleBaseName (looking for explorer.exe)
If explorer.exe found (we got its id)
- OpenProcessToken
- DuplicateTokenEx
- CreateProcessAsUser
This way, my client is launched with the context of explorer, the current user session one.
"Christoph Lindemann" <clindemann2@newsgroups.nospam> a écrit dans le message de news: %23NRxABw9IHA.2496@TK2MSFTNGP04.phx.gbl...
I had a similar problem, and I found no solution. There where some hacks I think to remeber, but no real sollution. Preoblem is, there is no way to get the user context
I ended up starting the process from another process on first access by the user.
I think you can work around this by bootstraping the msi with you own executable which executes the msi and on completion excutes the other proccess.
-> bootstrap.exe [user context]
|
+-> Windows Installer [user context]
| |
| ---> Windows Installer [system context]
| |
| ---> MSI sequences [system context]
|
---> start process [user context]
Another way is to shedule an action for the user context execution (via In-Script Execution Options) which starts a process, and this process then waits for some IPC event. Later in the system context you start another process which signals the user context process to continue.
--
Christoph Lindemann
"Erwan" wrote in message news:4896aeaf$0$859$ba4acef3@news.orange.fr...
> Under Vista, my application's installation is launched by Windows installer
> with elevated priviledges. So the owner of my installation program is
> "SYSTEM" under Wista (and current administrator under 2000/XP). The trouble
> is this installation program then launches a client program with
> ShellExecute, and the owner of this client program is still "SYSTEM". I need
> to launch it under the current Windows user, not SYSTEM.
> Any idea? Thanks for your help.
>
>
date: Tue, 5 Aug 2008 16:09:29 +0200
author: Erwan
Re: How to launch a user process from a system process
Hi Erwan,
Try that with several people logged on (Vista Fast User Switching, Terminal Server,...) Here you would have several explorer process running.
--
Christoph Lindemann
"Erwan" wrote in message news:48985f1a$0$856$ba4acef3@news.orange.fr...
Finally I found a solution with CreateProcessAsUser, using the token of explorer.exe :
- EnumProcesses
Loop for each process id:
- OpenProcess
- EnumProcessModules
- GetModuleBaseName (looking for explorer.exe)
If explorer.exe found (we got its id)
- OpenProcessToken
- DuplicateTokenEx
- CreateProcessAsUser
This way, my client is launched with the context of explorer, the current user session one.
"Christoph Lindemann" <clindemann2@newsgroups.nospam> a écrit dans le message de news: %23NRxABw9IHA.2496@TK2MSFTNGP04.phx.gbl...
I had a similar problem, and I found no solution. There where some hacks I think to remeber, but no real sollution. Preoblem is, there is no way to get the user context
I ended up starting the process from another process on first access by the user.
I think you can work around this by bootstraping the msi with you own executable which executes the msi and on completion excutes the other proccess.
-> bootstrap.exe [user context]
|
+-> Windows Installer [user context]
| |
| ---> Windows Installer [system context]
| |
| ---> MSI sequences [system context]
|
---> start process [user context]
Another way is to shedule an action for the user context execution (via In-Script Execution Options) which starts a process, and this process then waits for some IPC event. Later in the system context you start another process which signals the user context process to continue.
--
Christoph Lindemann
"Erwan" wrote in message news:4896aeaf$0$859$ba4acef3@news.orange.fr...
> Under Vista, my application's installation is launched by Windows installer
> with elevated priviledges. So the owner of my installation program is
> "SYSTEM" under Wista (and current administrator under 2000/XP). The trouble
> is this installation program then launches a client program with
> ShellExecute, and the owner of this client program is still "SYSTEM". I need
> to launch it under the current Windows user, not SYSTEM.
> Any idea? Thanks for your help.
>
>
date: Fri, 8 Aug 2008 10:48:30 +0200
author: Christoph Lindemann am
Re: How to launch a user process from a system process
Erwan, curious if you did get this to work as you describe under XP. I am
trying to do the same and I always get Error 5 when calling OpenProcessToken
with the process handle of explorer.exe
"Erwan" wrote:
> Finally I found a solution with CreateProcessAsUser, using the token of explorer.exe :
>
> - EnumProcesses
>
> Loop for each process id:
> - OpenProcess
> - EnumProcessModules
> - GetModuleBaseName (looking for explorer.exe)
>
> If explorer.exe found (we got its id)
> - OpenProcessToken
> - DuplicateTokenEx
> - CreateProcessAsUser
>
> This way, my client is launched with the context of explorer, the current user session one.
> "Christoph Lindemann" <clindemann2@newsgroups.nospam> a écrit dans le message de news: %23NRxABw9IHA.2496@TK2MSFTNGP04.phx.gbl...
> I had a similar problem, and I found no solution. There where some hacks I think to remeber, but no real sollution. Preoblem is, there is no way to get the user context
> I ended up starting the process from another process on first access by the user.
>
> I think you can work around this by bootstraping the msi with you own executable which executes the msi and on completion excutes the other proccess.
>
> -> bootstrap.exe [user context]
> |
> +--> Windows Installer [user context]
> | |
> | ---> Windows Installer [system context]
> | |
> | ---> MSI sequences [system context]
> |
> ---> start process [user context]
>
> Another way is to shedule an action for the user context execution (via In-Script Execution Options) which starts a process, and this process then waits for some IPC event. Later in the system context you start another process which signals the user context process to continue.
>
> --
> Christoph Lindemann
>
>
> "Erwan" wrote in message news:4896aeaf$0$859$ba4acef3@news.orange.fr...
> > Under Vista, my application's installation is launched by Windows installer
> > with elevated priviledges. So the owner of my installation program is
> > "SYSTEM" under Wista (and current administrator under 2000/XP). The trouble
> > is this installation program then launches a client program with
> > ShellExecute, and the owner of this client program is still "SYSTEM". I need
> > to launch it under the current Windows user, not SYSTEM.
> > Any idea? Thanks for your help.
> >
> >
date: Wed, 8 Oct 2008 08:32:01 -0700
author: rlangham
|
|