从提升的进程正常执行进程 [英] Executing a process normally from an elevated one

查看:30
本文介绍了从提升的进程正常执行进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有某种方法可以从提升的方式以非提升的方式启动流程.我的设置以提升的方式启动,当它完成时,它只会启动主应用程序.因为设置被提升,主要过程也将被提升,这是不可取的.对此的最佳解决方案是什么?

Is there some way to launch a process in non-elevated way from an elevated one. My setup is launched elevated and when it finalizes, it will just launch the main application. Because the setup is elevated, the main process will be elevated as well which is not desirable. What is the best solution to this?

推荐答案

这是个问题,Vista/Win7 似乎没有 API 来获取您需要调用 CreateProcessAsUser() 的非特权用户令牌.我发现的唯一解决方案是使用任务调度程序来启动程序.我觉得这不太实用.

That's a problem, Vista/Win7 don't appear to have an API to obtain the unprivileged user token you need to call CreateProcessAsUser(). The only solutions I've found involve using the task scheduler to launch the program. That doesn't strike me as very practical.

一个简单的解决方案是使用一个小的非提升的辅助进程.它可以依次启动提升的设置过程并等待来自该进程的确认以启动非提升的设置过程.握手很简单,可以使用命名的互斥锁来做到这一点.

An easy solution that jumps to mind is to use a small non-elevated helper process. It can in turn launch the elevated setup process and wait for a confirmation from that one to launch the non-elevated one. The handshake is simple enough to do this with a named mutex.

这篇关于从提升的进程正常执行进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆