c++中使用createProcess打开新子进程的时候怎么控制权限?

父进程是管理员权限,要打开一个新进程,希望能够以普通权限执行。没有办法获得账号和密码。

        // 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,但是我没法拿到账号密码,只是需要打开的新进程不继承管理员就好了,求指点。

阅读 6.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题