I'm using LogonUser
to get a HANDLE to the target session token and use it for the function CreateProcessAsUser
.
status = LogonUserW(sessiondata->UserName.Buffer, sessiondata->LogonDomain.Buffer,NULL,LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &targettoken);
My executable is going to be executed by Administrator, but even though I'm administrator, I can't get the handle to the token and always get 1326 error: Logon failure: unknown user name or bad password.. I put NULL
as lpszPassword with the hope that it checks if I'm administrator and give me the privilege to get the access token.
Of course I should not be using LogonUser for this purpose, so what do you suggest ?
I expected to get a HANDLE to the access token because of my high-level privilege(Administrator) without giving the password.