English 中文(简体)
NSIS: 搁置申请,始终担任署长
原标题:NSIS: Installing an Application to always Run as Administrator

我有一份供大量使用的国家峰会文件。 我在网上读到许多线索,但无法对以下事项作出明确回答:是否可以使用“国家信息社会倡议”安装一个应用程序,在发射时(无论用户类型如何)自动管理? 如果有可能,如何做到这一点?

Note: I am already imposing that the NSIS package must be run as admin using

RequestExecutionLevel admin

我已尝试用method撰写申请登记要求,但我无法得到RUNASADMIN>/code>的指挥,以进行汇编,因为它不符合国家信息社会首脑会议的要求格式。

最佳回答

为了确保安装人作为管理人运行,我建议举这个少的例子:

Outfile RequireAdmin.exe
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)

!include LogicLib.nsh

Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
    MessageBox mb_iconstop "Administrator rights required!"
    SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
    Quit
${EndIf}
FunctionEnd

Page InstFile

Section
SectionEnd

安装的应用软件如果总是需要作为行政操作,就应当采取类似步骤,供Win32的配料:

如果采用“自动管理者”的方式,你就意味着绕过电梯的电梯,那么实际上不可能做到,电算中心的整个点就是允许用户确认/认可特许操作! 一些申请通过安装一个以申请名义开展任何业务的非关税壁垒服务而获得。 我不建议这样做,因为它填补了用户的机器,如果服务没有正确编码,就会削弱系统的安全。

If you did not write the application you are installing then your options are a bit more limited. If the application does not have a manifest at all you could use a external (myapp.exe.manifest) manifest.

在上诉委员会的关键下设置RUNASADMIN,实际上并不是安装人应当做的事,这些兼容性选择应当由用户而不是用户控制。

该论坛把你与你联系在一起,并告诉你们:2;, 设置/code>,短期旗帜,这不会确保申请在一切情况下都不会启动。

问题回答




相关问题
Correct place to install demostration projects?

With the new Windows 7 restrictions (well, new to Windows Vista anyways), we can no longer install demo projects to %ProgramFilesFolder%OurApplicationdemo since restricted users will not be able to ...

.deb package conffiles problem

I am distributing one of my applications using a .deb package, but have a problem relating to one of the files. The distribution includes a database file which is constantly updated by the app, on a ...

Closing an application using WiX

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this. <util:...

VS 2005 Setup - HKCU

I am trying to fix an existing application that uses a Visual Studio 2005 setup project. We are requiring it to work on limited user accounts for XP, our app is written in C# for .Net 2.0. It writes ...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

configsource and installer

I have an project csproj, with app.config file, and logging Ent.Library section using configsource attribute. The logging section is in ahother file Configloggingconfiguration.config. I have a ...