65,187
社区成员




HANDLE hToken;
STARTUPINFO si;
if (!GetTokenByName(hToken,L"EXPLORER.EXE"))
{
goto Cleanup;
}
ZeroMemory(&si, sizeof(STARTUPINFO));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
CreateProcessAsUser(
hToken, // client's access token
lpProcessname, // 你要运行的程序的全路径
lpCommandLine, // command line
NULL, // pointer to process SECURITY_ATTRIBUTES
NULL, // pointer to thread SECURITY_ATTRIBUTES
FALSE, // handles are not inheritable
NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE, // creation flags
NULL, // pointer to new environment block
NULL, // name of current directory
&si, // pointer to STARTUPINFO structure
&pi // receives information about new process
);