Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Mon, 4 Aug 2008 09:24:47 +0200,    group: microsoft.public.platformsdk.security        back       


How to launch a user process from a system process   
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: Mon, 4 Aug 2008 09:24:47 +0200   author:   Erwan

Re: How to launch a user process from a system process   
Erwan wrote:
> 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. 
> 
> 
CreateProcessAsUser, I think.
date: Mon, 04 Aug 2008 14:20:24 -0500   author:   ferrix

Re: How to launch a user process from a system process   
> CreateProcessAsUser, I think.

Yes, but how to get the token of the current user from a SYSTEM process?
date: Mon, 4 Aug 2008 22:20:04 +0200   author:   Erwan

Re: How to launch a user process from a system process   
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 15:36:21 +0200   author:   Christoph Lindemann am

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

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us