仅在需要时询问管理员权限。 [英] Ask Administative privilege only when needed..

查看:136
本文介绍了仅在需要时询问管理员权限。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我正在用C#开发一个Windows应用程序......

有时我需要行政特权来执行一些程序中的任务...

,我不希望应用程序在启动时询问管理权限,

我只需要程序询问任务何时到来,,,,

我怎样才能使我的prgram?

解决方案
你不能。

基本上,所有假装这样做的应用都会使用一些黑客。

例如TaskManager:当您想要查看所有用户的任务时,程序将关闭并使用admin priviledges重新启动。

另一种可能性是为管理任务启动一个不同的exe,并且exe是以admin特权启动的。在这种情况下,您的原始程序将继续以正常的用户权限运行。

现在,您可以选择其中一个黑客,或者在计划执行此类任务时要求用户以管理员身份启动您的程序。

Hi friends,

I am developing a Windows Application in C#...
Sometimes I need administrative privilege to carry out some tasks in the program...
and, I dont want the application to ask for Administrative privileges at the startup,
I only need the program to ask when the task comes,,,,
How can I make it in my prgram ?

解决方案

You cannot.
Basically, all applications which pretend to do so use some hacks.
E.g. TaskManager: when you want to see tasks of all users, the program shuts down and restarts with admin priviledges.
Another possibility is to launch a different exe for the administrative tasks, and that exe is started with admin priviledges. in this case, your original program continues to run with normal user priviledges.
Now you may choose one of the two hacks or ask the user to start your program as admin when he plans to do such tasks.


这篇关于仅在需要时询问管理员权限。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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