From f6e706f2b0573610d7f3815d8a30590f8eb6ad2d Mon Sep 17 00:00:00 2001 From: kichik Date: Sat, 16 Sep 2006 14:06:45 +0000 Subject: [PATCH] added RequestExecutionLevel git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4753 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/attributes.but | 10 ++++++++++ Source/script.cpp | 21 +++++++++++++++++++++ Source/tokens.cpp | 1 + Source/tokens.h | 1 + 4 files changed, 33 insertions(+) diff --git a/Docs/src/attributes.but b/Docs/src/attributes.but index ddbd12a1..76453a0c 100644 --- a/Docs/src/attributes.but +++ b/Docs/src/attributes.but @@ -306,6 +306,16 @@ Accepts variables. If variables are used, they must be initialized in \R{oninit} Specifies the output file that the MakeNSIS should write the installer to. This is just the file that MakeNSIS writes, it doesn't affect the contents of the installer. +\S2{requestexecutionlevel} RequestExecutionLevel + +\c \\none\\|user|admin + +Specifies the requested execution level for Windows Vista. The value is embedded in the installer's XML manifest and tells Vista, and probably future versions of Windows, what privileges level the installer requires. \e{user} requests the current's user level, be it normal user or administrator. \e{admin} requests administrator level and will cause Windows to prompt for the administrator password to verify privilege escalation. Specifying \e{none}, which is also the default, will keep the manifest empty and let Windows decide which execution level is required. Windows Vista RC1 automatically identifies NSIS installers and decides administrator privileges are required. Because of this, \e{none} and \e{admin} have virtually the same effect. + +As Windows Vista is still in development, anything might change. It's recommended, at least by Microsoft, that every application will be marked with the required execution level. Installers that need not install anything into system folders or write to the local machine registry (HKLM) should specify \e{user} execution level. + +More information about this topic can be found at MSDN. Keywords include "UAC", "requested execution level", "vista manifest" and "vista security". + \S2{asetfont} SetFont \c [/LANG=lang_id] font_face_name font_size diff --git a/Source/script.cpp b/Source/script.cpp index 2a77c16d..5be1ddee 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -2580,6 +2580,27 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error: %s specified, NSIS_CONFIG_VISIBLE_SUPPORT not defined.\n",line.gettoken_str(0)); return PS_ERROR; #endif// NSIS_CONFIG_VISIBLE_SUPPORT + + case TOK_REQEXECLEVEL: + { + int k=line.gettoken_enum(1,"none\0user\0admin\0"); + switch (k) + { + case 0: + manifest_exec_level = manifest::exec_level_none; + break; + case 1: + manifest_exec_level = manifest::exec_level_user; + break; + case 2: + manifest_exec_level = manifest::exec_level_admin; + break; + default: + PRINTHELP(); + } + } + return PS_OK; + // Ability to change compression methods from within the script case TOK_SETCOMPRESSOR: #ifdef NSIS_CONFIG_COMPRESSION_SUPPORT diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 644efceb..919001c9 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -219,6 +219,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_WRITEREGEXPANDSTR,"WriteRegExpandStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE}, {TOK_WRITEUNINSTALLER,"WriteUninstaller",1,0,"uninstall_exe_name",TP_CODE}, {TOK_XPSTYLE, "XPStyle",1,0,"(on|off)",TP_GLOBAL}, +{TOK_REQEXECLEVEL, "RequestExecutionLevel",1,0,"none|user|admin",TP_GLOBAL}, {TOK_P_PACKEXEHEADER,"!packhdr",2,0,"temp_file_name command_line_to_compress_that_temp_file",TP_ALL}, {TOK_P_SYSTEMEXEC,"!system",1,2,"command [<|>|<>|=) retval]",TP_ALL}, {TOK_P_EXECUTE,"!execute",1,0,"command",TP_ALL}, diff --git a/Source/tokens.h b/Source/tokens.h index e10f4c0a..701ad5d6 100644 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -42,6 +42,7 @@ enum TOK_FILEERRORTEXT, TOK_INSTPROGRESSFLAGS, TOK_XPSTYLE, + TOK_REQEXECLEVEL, TOK_CHANGEUI, TOK_ADDBRANDINGIMAGE, TOK_SETFONT,