Hi All
Im am trying this difficult way, i 'd like to launch a process from service with reateProcessAsUser API, with 2 simple rows i have the process Loaded in RAM with corrent User, but i don't see nothing, becouse i understood that process run in another context, now i am trying from two week, but i cannot understand as do.
Cam you complete this code with me ?
Thanks in advance
Giovanni
HANDLE hUserToken = INVALID_HANDLE_VALUE;
PROCESS_INFORMATION pi;
STARTUPINFO si;
BOOL bResult = FALSE;
DWORD dwCreationFlags = CREATE_NEW_CONSOLE;
LPVOID pEnv = NULL;
ZeroMemory(&pi, sizeof(pi));
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.lpDesktop = _T("winsta0\\default");
if (!LogonUser(Settings.szUserName, NULL, Settings.szPassword, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hUserToken))
goto Cleanup;
bResult = CreateProcessAsUser(hUserToken, NULL, Settings.szCommandLine, NULL, NULL, FALSE, dwCreationFlags, pEnv, NULL, &si, &pi);
What I have tried:
i have tried DuplicateTokenEX and SetokenInformation but always fail i don't know what do, really :(