以用户身份从服务运行代码(不是新进程) [英] running code (not a new process) as a user from service

查看:108
本文介绍了以用户身份从服务运行代码(不是新进程)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以像使用CreateProcessAsUser一样在与服务不同的用户会话上运行函数/线程,而无需在磁盘上之前放置单独的.exe文件?

谢谢

Hi,

Is it possible to run a function/thread on a different user session from a service as done with CreateProcessAsUser without the need to put a seperate .exe file on the disk before?

Thanks

推荐答案

我想运行一个与服务中的桌面进行交互的进程,但是我不想放置一个单独的exe文件,如果服务未运行,则用户可能会意外运行.

然后,也许要创建要作为控制台运行代码的可执行文件,或者需要向其发送有效命令行参数的可执行文件.如果未检索到有效参数,则会立即退出

这样,如果用户启动它,它将退出.但是当您的服务启动时&提供所需的参数,它将运行.

这是简单的方法,imo.
I want to run a process which interacts with the desktop from my service, but I don''t want to put a seperate exe file which the user could run accidentally if the service didn''t run it.

Then maybe create the executable you want to run code as a console or something that requires valid command line parameters sent to it. If it doesn''t retrieve valid parameters, it exits immediately

This way, if the user starts it it''ll just exit. But when your service starts it & provides the required parameter, it will run.

That''s the easy way, imo.


这篇关于以用户身份从服务运行代码(不是新进程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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