Creating a process in a non-zero session from a service in windows-2008-server?
        Posted  
        
            by Itay Levin
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Itay Levin
        
        
        
        Published on 2010-02-10T14:59:44Z
        Indexed on 
            2010/05/07
            2:58 UTC
        
        
        Read the original article
        Hit count: 469
        
Hi,
I was wondering if there is a simple way for a service to create a process in user session?
My service is running as a user(administrator) account and not as a LocalSystem acount, therefore i can't use the WTSQueryUserToken function.
i have tried calling
OpenProcessToken(GetCurrentProcess,TOKEN_ALL_ACCESS,TokenHandle);
but when i use this token to run
 CreateProcessAsUser(TokenHandle,.....)
my process is still running in session 0. how can i resolve this issue?
I'm using an Ole automation so i don't really care on which session the process will be running on, as long it is not the session 0 - because the Ole from some reason doesn't create its processes (winword.exe for instance) in session 0, but rather it creates them in other user sessions.
Any suggestions will be welcome. Thanks in advance.
© Stack Overflow or respective owner