createprocessasuser(createProcessAsUser Error2)
请教一个关于CreateProcessAsUser的问题
CreateProcessAsUser function
Creates a new process and its primary thread. The new process runs in the security context of the user represented by the specified token.
Typically, the process that calls the CreateProcessAsUser function must have the SE_INCREASE_QUOTA_NAME privilege and may require theSE_ASSIGNPRIMARYTOKEN_NAME privilege if the token is not assignable. If this function fails with ERROR_PRIVILEGE_NOT_HELD (1314), use theCreateProcessWithLogonW function instead. CreateProcessWithLogonW requires no special privileges, but the specified user account must be allowed to log on interactively. Generally, it is best to use CreateProcessWithLogonW to create a process with alternate credentials.
请教关于使用函数CreateProcessAsUser的问题
CreateProcessAsUser这个函数的第一个参数是一个用户令牌(Token),然后这个令牌会携带很多信息。
你说的报错那个问题,估计是因为Token中没有相关的GUI信息,貌似用LogonUser登录后需要做很多事情才能创建界面进程。
我当时的情况是:那个地方没有使用LogonUser,而是由System账户调用CreateProcessAsUser启动线程,然后是查找系统中的explorer.exe进程,然后获取该进程的Token,然后用该Token调用CreateProcessAsUser创建新进程。
还有就是环境变量的问题,可以参照如下:
if(!CreateEnvironmentBlock(lpEnvBlock, hUserToken, FALSE))
return GetLastError();
if(!CreateProcessAsUser(hUserToken, strExePath, NULL, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT, lpEnvBlock, strDirectory, si, pi))
return GetLastError();
if(!DestroyEnvironmentBlock(lpEnvBlock))
return GetLastError();

CreateProcessAsUser Error:5老是弹出桌面
尊敬的华硕用户,您好!
根据您的描述。抱歉,不确定您的电脑具体型号及使用的系统版本。
1、建议您更新杀毒软件补丁并全盘查杀下病毒。
2、是否通过第三方软件优化系统文件之后出现这个提示的,尝试通过【控制面板】--windows update更新下系统补丁。
3、如果是运行某个特定程序软件时提示这个信息,建议您将该软件卸载删除。
希望以上信息能够对您有所帮助,谢谢。若以上回复还是没有帮您解决您的问题,欢迎您继续追问,您也可以登录华硕在线即时服务:?进一步向工程师咨询,感谢您对华硕的支持和关注,祝您生活愉快!
电脑老是弹出 CreateProcessAsUser Error:2的窗口 请问如何解决?
你跟踪一下,这个警告对话框是哪个应用程序弹出来的,通过任务管理器--》选择提示信息--》右键,转到进程。就可以看到时哪个程序弹出来的了,你可以考虑把这个程序卸载掉