Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tried to start a process in service session ( session 0 : window 2008 server (session 0 isolation)) with user account. then I use LogonUser and createProcessAsUser api.....

but, user account('frank') //session id :0 //process name: notepad.exe
when interactive service and desktop is checked, Interactive desktop Detection popup -> notepad.exe' process in service session(0)can draw well, crack!!! Am I doing something wrong?

part of source below
--------------------------------------------------------------------------------------------
C++
result = LogonUser(username, domain, password, (int)LOGON_TYPE.LOGON32_LOGON_NETWORK, (int)LOGON_PROVIDER.LOGON32_PROVIDER_DEFAULT, out token);

 result = DuplicateTokenEx(token, (TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_SESSIONID | TOKEN_ADJUST_DEFAULT | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE), ref processAttributes, SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation, TOKEN_TYPE.TokenPrimary, out primaryToken);

result = CreateProcessAsUser(primaryToken, applicationName, commandLine, ref processAttributes, ref threadAttributes, inheritHandles, 0, environment, currentDirectory, ref startupInfo, out processInformation);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900