Location: Symbol Reference > Functions > JwCreateProcessInSession Function
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
JwCreateProcessInSession Function
Pascal
procedure JwCreateProcessInSession(const ApplicationName: TJwString; const CommandLine: TJwString; const CurrentDirectory: TJwString; const SessionID: TJwSessionId; const CreationFlags: DWORD; const Desktop: TJwString; StartupInfo: TStartupInfoW; WaitForProcess: Boolean; out Output: TJwProcessOutputInformation; LogServer: IJwLogServer);
Parameters 
Description 
const ApplicationName: TJwString 
defines the application to be run in the session  
const CommandLine: TJwString 
defines the parameters for the application  
const CurrentDirectory: TJwString 
defines the start folder of the app.  
const SessionID: TJwSessionId 
defines the target session where the new application is to be started.  
const CreationFlags: DWORD 
defines creation flags that are delivered to CreateProcess parameter with same name  
const Desktop: TJwString 
defines the target windowstation and desktop name. If empty the default target is "winsta0default"  
StartupInfo: TStartupInfoW 
defines startup info delivered to to CreateProcess parameter with same name. Don't forget to initialize the structure first before calling this procedure.  
WaitForProcess: Boolean 
defines whether the procedure should wait for the process to end and clean up all allocated resources or just return to the caller. In last case the caller is responsible to free the returned token, the environment block and the users profile  
out Output: TJwProcessOutputInformation 
contains returned data in case parameter WaitForProcess is false. The caller is responsible to free the contained member allocation  
LogServer: IJwLogServer 
receives a log server instance. It is used to log events for mostly debugging purposes. If this parameter is nil, no events are logged 

JwCreateProcessInSession creates a new process in a user's session using various ways to achieve success. This procedure needs JwInitWellKnownSIDs to be called. 

To run a process in another session the process needs SYSTEM rights. It means that the current process token must have the TOKEN_ASSIGN_PRIMARY right for the target token. Otherwise the CreateProcessAsUser function fails with bad error explanation (like "A call to an OS function failed"). However the procedure won't stop you from doing this! 

 

Exceptions 
Description 
will be raised if no token could be found for the given SessionID 
will be raised if JwInitWellKnownSIDs was not called before 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!