23 May
Posted by: Christian Wimmer in: JEDI Windows Security Code Lib
This simple example shows how you can change the target session of a new process.
All the source is doing is to get a user’s token by calling CreateWTSQueryUserToken and then duplicate so it will become possible to change the Token SessionID. The session ID is changed by setting the property TokenSessionID which is only possible with the TCB privilege (we need it, but it needn’t to be active).
You can do the CreateProcess part a little better if you read this: “CreateProcess in full glory“.
Did you know?
1. You can test this example in your own Delphi environment without writing a service first.
2. It is not possible to change the session ID of a running process.
One Response
Remko
24|May|2008 1Don’t forget that the if the new Session Id is a session belonging to another user you need to assure permissions on the desktop (by default even administrators do not have permissions on another user’s winstation and desktop). This is only an issue for GUI apps, console (cmd.exe) doesn’t need desktop permissions.
Leave a reply