Windows service launch UI in wrong user session in RDP multiuser session

abbas shaikh 1 Reputation point
2021-07-13T16:50:32.973+00:00

I had develop windows file watcher service to launch UI (as user give file print from menu) using createuserprocess winapi. It works fine for single user. For multi user this UI get launch in wrong user's session.

So I need launch UI in respective user's session

Any help appreciated

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,054 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,613 questions
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,551 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 45,476 Reputation points
    2021-07-13T17:27:12.437+00:00

    How are you obtaining the token you are passing to CreateProcessAsUser?

    The token that you pass to CreateProcessAsUser must contain the proper session number. The session can be set with SetTokenInformation.

    0 comments No comments

  2. abbas shaikh 1 Reputation point
    2021-07-14T06:38:18.637+00:00

    Thanks for reply.

    I use winapi method WTSQuerySessionInformation to get session id. But it all sessionids currently connected users.

    I need sessionid of user who fire command to launch UI app.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.