父进程是管理员权限,要打开一个新进程,希望能够以普通权限执行。没有办法获得账号和密码。
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line)
path, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi ) // Pointer to PROCESS_INFORMATION structure
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return 1;
}
看了官网文档,好像得使用CreateProcessAsUser,但是我没法拿到账号密码,只是需要打开的新进程不继承管理员就好了,求指点。