如何从更高级别的用户级别启动一个Exe [英] How to Launch an Exe at User Level from a Higher Level

查看:215
本文介绍了如何从更高级别的用户级别启动一个Exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个过程总是在用户级运行。由安装程序启动时(自定义,而不是msi),以管理员级别运行或在用户登录时运行。看看,我不知道这是可能的。

解决方案

有很多hacky的方法来做到这一点(使用taskscheduler,注入到explorer.exe等)



获得正确用户的唯一方法(在UAC升级之前启动程序的唯一方法(这可能不是与shell /login/会话所有者))是让安装程序运行自身的两个实例,一个外部实例没有提升,它大多只是启动另一个实例,启动自身与ShellExecute [Ex] runas动词。当开始中/低级进程时,通过某种形式的IPC提升的实例告诉外部实例启动新的进程。



这是一个痛苦的脖子实现,我建议只是在安装程序的结尾有一个运行复选框。 p>

I would like a process to always run at the user level. Either when it is launched by the installer (custom, not msi), which runs as at the administrator level, or when a user logs on. Looking around, I'm not sure this is possible.

解决方案

There are many hacky ways to do this (Use the taskscheduler, inject into explorer.exe etc)

The only way to get the correct user (The one that started your program before UAC elevation (This might not be the same user as the shell/"login"/"session owner")) is to have the installer run two instances of itself, one "outer" instance that is not elevated, it mostly just starts the other instance by starting itself with ShellExecute[Ex] with the runas verb. When it comes time to start the medium/low level process, the elevated instance by some form of IPC tells the outer instance to start the new process.

It is a pain in the neck to implement, I would recommend just not having a run checkbox at the end of your installer.

这篇关于如何从更高级别的用户级别启动一个Exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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