vakuras
vakuras

Reputation: 1007

CreateProcessWithUser fails to impersonate user with errors 87, 1349

On a windows 2003 server, running from a service, createprocessasuser fails with error 87, and an error from WLEXECSERVER that says fails to impersonate user.

On a windows 2003 server 64 bit, running from a service, createprocessasuser fails with error 1349.

The token is created using OpenProcess -> OpenProcessToken(TOKEN_QUERY, TOKEN_DUPLICATE) -> DuplicateTokenEx (WITH GRANT_ALL, PrimaryToken, SecurityImpersonation).

On WIN7 and 2008 R2 it works fine with no problems.

If i take the token with WTSQueryUserToken, it works fine also.

Anyone has an idea why?

Upvotes: 1

Views: 2170

Answers (1)

Stas'M
Stas'M

Reputation: 81

It seems the same problem on Windows XP: CreateProcessAsUser fails with error 233 (0xE9) if the session id is not 0 and if no user logged on. This bug is fixed on NT 6.0 and higher.

There are some workarounds which may help: https://groups.google.com/d/msg/microsoft.public.win32.programmer.kernel/h72eJ7iMynE/zVgBe_aVj24J https://github.com/zealotous/ultravnc/blob/master/winvnc/winvnc/service.cpp

Take a look on CreateRemoteSessionProcess function.

Upvotes: 2

Related Questions