Search code examples
windows-servicescreateprocessasuser

CreateProcessAsUser from Windows Service, WTSQueryUserToken function return false


I'm trying to create a process which a wpf application. In Visual Studio debugging mode, it runs perfectly but windows service cant create it with gui.

I'm using CreateProcessAsUser() with WTSQueryUserToken(), DuplicateTokenEx().

But WTSQueryUserToken() return false cause of privilege, and i cant run my app.

I have searched similar problems but i couldnt find a solution for my problem.


Solution

  • Just like my problem before; applications which working with manifest files, you have to disable Run all administrator in Admin Approval Mode.

    You can check: https://social.technet.microsoft.com/Forums/windowsserver/en-US/0aeac9d8-3591-4294-b13e-825705b27730/how-to-disable-uac?forum=winserversecurity