У меня есть процесс, работающий в рамках учетной записи System в сеансе 1. Я называю CreateProcessAsuser () и могу видеть, что создается процесс (я мог бы распечатать новый процесс и идентификаторы потока и мог бы увидеть процесс в мониторе процесса), но в UI также нет ничего видимого.
// usrToken has the following
// Is in session 1
// Obtained by calling LogonUser and then user profile is loaded and user environment is created.
// Has generic read and write access to session 1 winsta0 and default desktop. I added these explicitly by modifying ACLs
// trying to launch notepad.exe in the new user session. I have tried with cmd.exe as well but could not see any UI window
BOOL InjectProcess2(HANDLE usrToken)
{
BOOL ret;
DWORD err;
PROCESS_INFORMATION pi = {};
DWORD sessionId = WTSGetActiveConsoleSessionId();
// i think this may be redundant
if (!SetTokenInformation(usrToken, TokenSessionId,
&sessionId, sizeof(sessionId)))
{
err = GetLastError();
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79698035/createprocessasuser-succeeds-and-process-is-created-but-ui-is-not-visible[/url]
У меня есть процесс, работающий в рамках учетной записи System в сеансе 1. Я называю CreateProcessAsuser () и могу видеть, что создается процесс (я мог бы распечатать новый процесс и идентификаторы потока и мог бы увидеть процесс в мониторе процесса), но в UI также нет ничего видимого.[code]// usrToken has the following
// Is in session 1
// Obtained by calling LogonUser and then user profile is loaded and user environment is created.
// Has generic read and write access to session 1 winsta0 and default desktop. I added these explicitly by modifying ACLs
// trying to launch notepad.exe in the new user session. I have tried with cmd.exe as well but could not see any UI window
BOOL InjectProcess2(HANDLE usrToken)
{
BOOL ret; DWORD err;
PROCESS_INFORMATION pi = {};
DWORD sessionId = WTSGetActiveConsoleSessionId();
// i think this may be redundant if (!SetTokenInformation(usrToken, TokenSessionId, &sessionId, sizeof(sessionId))) { err = GetLastError(); cout