murrayju / CreateProcessAsUser

Creates a process in a different Windows session
MIT License
369 stars 114 forks source link

WTSQueryUserToken fails #22

Closed hedbisker closed 6 years ago

hedbisker commented 6 years ago

In this line if (WTSQueryUserToken(activeSessionId, ref hImpersonationToken) != 0)

the method WTSQueryUserToken return 0

AndrewSav commented 6 years ago

It means that this call is failing. You need to find the reason for it and eliminate it. Good luck! Read up in the closed issues for troubleshooting. Start here https://github.com/murrayju/CreateProcessAsUser/issues/18 and follow the links.

murrayju commented 6 years ago

Most likely a permissions problem, are you running the service as the System account?

You could also try calling the win32 GetLastError() for more clues.

AndrewSav commented 6 years ago

@hedbisker do you need any more help with this?

hedbisker commented 6 years ago

@AndrewSav No, thank you