Readme.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html>
  3. <head>
  4. <title>Multi-User Header File (MultiUser.nsh)</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
  6. <style type="text/css">
  7. td
  8. {
  9. padding: 5px;
  10. vertical-align: top;
  11. border-bottom: 1px solid black;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <h1>
  17. Multi-User Header File (MultiUser.nsh)</h1>
  18. <p>
  19. <i>Installer configuration for multi-user Windows environments</i></p>
  20. <h2>
  21. Table of Contents</h2>
  22. <ul>
  23. <li><a href="#introduction">Introduction</a></li>
  24. <li><a href="#executionlevel">Initalization and Execution Level</a>
  25. <li><a href="#installationmode">Installation Mode</a></ul>
  26. <h2>
  27. <a name="introduction"></a>Introduction</h2>
  28. <p>
  29. Modern Windows versions support multiple users accounts on a single computer, each
  30. with different privileges. For security reasons, the privileges of applications
  31. can also be limited. For an installer, the <i>execution level</i> and <i>installation
  32. mode</i> are important. The execution level determines the privileges of the
  33. installer application. For example, to install hardware drivers, administrator privileges
  34. are required. Applications can also be installed for a single user or for all users
  35. on a computer, which is determined by the installation mode. Installation for all
  36. users requires a higher execution level as compared with a single user setup. The
  37. MultiUser.nsh header files provides the features to automatically handle all these
  38. aspects related to user accounts and installer privileges.</p>
  39. <p>
  40. Note that all settings need to be set before including the MultiUser.nsh header
  41. file.</p>
  42. <h2>
  43. Initialization and <a name="executionlevel"></a>Execution Level&nbsp;</h2>
  44. <p>
  45. Before the MultiUser.nsh file is included, the MULTIUSER_EXECUTIONLEVEL define should
  46. be set to one of the following values depending on the execution level that is required:</p>
  47. <table>
  48. <tr>
  49. <td>
  50. <b>Value </b>
  51. </td>
  52. <td>
  53. <b>Description</b>
  54. </td>
  55. <td>
  56. <b>Typical application</b>
  57. </td>
  58. </tr>
  59. <tr>
  60. <td>
  61. Admin
  62. </td>
  63. <td>
  64. Administrator privileges are required
  65. </td>
  66. <td>
  67. Access data of all users accounts
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>
  72. Power
  73. </td>
  74. <td>
  75. Power User privileges are required<br />
  76. (Power Users no longer exist in Windows Vista. For Vista this is equivalent to Admin)
  77. </td>
  78. <td>
  79. Installation for all users (writing to &quot;Program Files&quot; or HKLM registry
  80. keys), driver installation
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>
  85. Highest
  86. </td>
  87. <td>
  88. Request the highest possible execution level for the current user
  89. </td>
  90. <td>
  91. Mixed-mode installer that can both be installed per-machine or per-user
  92. </td>
  93. </tr>
  94. <tr>
  95. <td>
  96. Standard
  97. </td>
  98. <td>
  99. No special rights required
  100. </td>
  101. <td>
  102. Installation for current user only
  103. </td>
  104. </tr>
  105. </table>
  106. <p>
  107. Insert the MULTIUSER_INIT and MULTIUSER_UNINT macros in the .onInit and un.onInit
  108. function to verify these privileges. If no uninstaller is created in the script,
  109. set MULTIUSER_NOUNINSTALL.</p>
  110. <blockquote>
  111. <pre>!define MULTIUSER_EXECUTIONLEVEL Highest
  112. ;!define MULTIUSER_NOUNINSTALL ;Uncomment if no uninstaller is created
  113. !include MultiUser.nsh
  114. ...
  115. Function .onInit
  116. !insertmacro MULTIUSER_INIT
  117. FunctionEnd
  118. Function un.onInit
  119. !insertmacro MULTIUSER_UNINIT
  120. FunctionEnd</pre>
  121. </blockquote>
  122. <p>
  123. Whether the required privileges can be obtained depends on the user that starts
  124. the installer:</p>
  125. <ul>
  126. <li>Windows NT 4/2000/XP/2003 give the installer the same privileges as the user itself.
  127. If the privileges of the user are not sufficient (e.g. Admin level is required is
  128. set but the user has no administrator rights), the macros will display an error
  129. message and quit the installer. If is however possible to manually run the installer
  130. with an administrator account.</li>
  131. <li>Windows Vista restricts the privileges of all applications by default. Depending
  132. on requested execution level, MultiUser.nsh will set the RequestExecutionLevel flag
  133. to request privileges. The user will be asked for confirmation and (if necessary)
  134. for an administrator password.</li>
  135. <li>Windows 95/98/98 do not set any restrictions on users or applications. Administrator
  136. rights are always available.</li>
  137. </ul>
  138. <p>
  139. It is recommended to insert these initialization macros before macros that require
  140. user intervention. For example, it does not make sense to ask a user for an installer
  141. language if the installer will quit afterwards because the user account does not
  142. have the required privileges. After the macros are inserted, the variable $MultiUser.Privileges
  143. will contain the current execution level (Admin, Power, User or Guest).</p>
  144. <p>
  145. The following additional settings are available to customize the initialization:</p>
  146. <table>
  147. <tr>
  148. <td>
  149. <b>Setting<td>
  150. <b>Description</b>
  151. </td>
  152. </tr>
  153. <tr>
  154. <td>
  155. MULTIUSER_INIT_TEXT_ADMINREQUIRED
  156. </td>
  157. <td>
  158. Error message to be displayed when administrator rights are required but not available.
  159. </td>
  160. </tr>
  161. <tr>
  162. <td>
  163. MULTIUSER_INIT_TEXT_POWERREQUIRED
  164. </td>
  165. <td>
  166. Error message to be displayed when Power User rights are required but not available.
  167. </td>
  168. </tr>
  169. <tr>
  170. <td>
  171. MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE
  172. </td>
  173. <td>
  174. Error message to be displayed when administrator or Power User rights are required
  175. because of an installation mode setting on the command line (see below) but are
  176. not available.
  177. </td>
  178. </tr>
  179. <tr>
  180. <td>
  181. MULTIUSER_INIT_FUNCTIONQUIT<br />
  182. MULTIUSER_INIT_UNFUNCTIONQUIT
  183. </td>
  184. <td>
  185. A custom function to be called when the installer is closed due to insufficient
  186. privileges.
  187. </td>
  188. </tr>
  189. </table>
  190. <h2>
  191. <a name="installationmode"></a>Installation Mode</h2>
  192. <p>
  193. As mentioned before, applications can both be installed for a single users or for
  194. all users on a computer. Applications for all users are typically installed in the
  195. Program Files folder and appear in the Start Menu of every user. On the contrary,
  196. applications for a single user are usually installed in the local Application Data
  197. folder and only a appear in the Start Menu of the user who installed the application.</p>
  198. <p>
  199. By default, MultiUser.nsh will set the installation mode for a per-machine installation
  200. if Administrator or Power User rights are available (this is always the case if
  201. the execution level is set to Admin or Power, if Highest is set it depends on the
  202. user account). For the Standard execution level the installation will always be
  203. for a single user. On Windows 95/98/Me installation for a single user is not possible.</p>
  204. <p>
  205. The following settings are available to change the default installation mode:
  206. <table>
  207. <tr>
  208. <td>
  209. <b>Setting</b>
  210. </td>
  211. <td>
  212. <b>Description</b>
  213. </td>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td>
  218. MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
  219. </td>
  220. <td>
  221. Set default to a per-user installation, even if the rights for a per-machine installation
  222. are available.
  223. </td>
  224. </tr>
  225. <tr>
  226. <td>
  227. MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME
  228. </td>
  229. <td>
  230. Non-empty registry key that is created during the installation in either HKCU or
  231. HKLM. The default installation mode will automatically be set to the previously
  232. selected mode depending on the location of the key.
  233. </td>
  234. </tr>
  235. </table>
  236. <p>
  237. After initialization, the variable $MultiUser.InstallMode will contain the current
  238. installation mode (AllUsers or CurrentUser).
  239. </p>
  240. <h3>
  241. Mixed-Mode Installation</h3>
  242. <p>
  243. For the Admin and Power levels, both a per-machine as well as a per-user installation
  244. is possible. If the Highest level is set and the user is an Administrator or Power
  245. User, both options are also available.</p>
  246. <p>
  247. Usually it's a good thing to give the user to choice between these options. For
  248. users of the Modern UI version 2, a page is provided that asks the user for the
  249. installation mode. To use this page, define MULTIUSER_MUI before including User.nsh.
  250. Then, the MULTIUSER_PAGE_INSTALLMODE macro can be used just like a normal Modern
  251. UI page (this page will automatically be skipped when running Windows 95/98/Me):</p>
  252. <pre>!define MULTIUSER_EXECUTIONLEVEL Highest
  253. <b>!define MULTIUSER_MUI</b>
  254. !define MULTIUSER_INSTALLMODE_COMMANDLINE
  255. !include MultiUser.nsh
  256. !include MUI2.nsh
  257. <b>!insertmacro MULTIUSER_PAGE_INSTALLMODE</b>
  258. !insertmacro MUI_PAGE_DIRECTORY
  259. !insertmacro MUI_PAGE_INSTFILES
  260. !insertmacro MUI_LANGUAGE English
  261. ...
  262. Function .onInit
  263. !insertmacro MULTIUSER_INIT
  264. FunctionEnd
  265. Function un.onInit
  266. !insertmacro MULTIUSER_UNINIT
  267. FunctionEnd
  268. </pre>
  269. <p>
  270. The MULTIUSER_INSTALLMODE_COMMANDLINE setting that also appears in this example
  271. enables the installation mode to be set using the /AllUsers or /CurrentUser command
  272. line parameters. This is especially useful for silent setup.</p>
  273. <p>
  274. The following settings can be used to customize the texts on the page (in addition
  275. to the general Modern UI page settings):</p>
  276. <table>
  277. <tr>
  278. <td>
  279. <b>Setting</b>
  280. </td>
  281. <td>
  282. <b>Description</b>
  283. </td>
  284. </tr>
  285. <tr>
  286. <td>
  287. MULTIUSER_INSTALLMODEPAGE_TEXT_TOP
  288. </td>
  289. <td>
  290. Text to display on the top of the page.
  291. </td>
  292. </tr>
  293. <tr>
  294. <td>
  295. MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS
  296. </td>
  297. <td>
  298. Text to display on the combo button for a per-machine installation.
  299. </td>
  300. </tr>
  301. <tr>
  302. <td>
  303. MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER
  304. </td>
  305. <td>
  306. Text to display on the combo button for a per-user installation.
  307. </td>
  308. </tr>
  309. </table>
  310. <h3>
  311. Installation Mode Initalization</h3>
  312. <p>
  313. The SetShellVarContext flag (which determines the folders for e.g. shortcuts, like
  314. $DESKTOP) is automatically set depending on the installation mode. In addition,
  315. the following settings can be used to perform additional actions when the installation
  316. mode is initialized:</p>
  317. <table>
  318. <tr>
  319. <td>
  320. <b>Setting</b>
  321. </td>
  322. <td>
  323. <b>Description</b>
  324. </td>
  325. </td>
  326. </tr>
  327. <tr>
  328. <td>
  329. MULTIUSER_INSTALLMODE_INSTDIR
  330. </td>
  331. <td>
  332. Name of the folder in which to install the application, without a path. This folder
  333. will be located in Program Files for a per-machine installation and in the local
  334. Application Data folder for a per-user installation (if supported).
  335. </td>
  336. </tr>
  337. <tr>
  338. <td>
  339. MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME
  340. </td>
  341. <td>
  342. Registry key from which to obtain a previously stored installation folder. It will
  343. be retrieved from HKCU for per-user and HKLM for per-machine.
  344. </td>
  345. </tr>
  346. <tr>
  347. <td>
  348. MULTIUSER_INSTALLMODE_FUNCTION<br />
  349. MULTIUSER_INSTALLMODE_UNFUNCTION
  350. </td>
  351. <td>
  352. A custom fuction to be called during the initialization of the installation mode
  353. to set additional installer settings that depend on the mode
  354. </td>
  355. </table>
  356. <p>
  357. To set the installation mode manually, call one of these four functions:</p>
  358. <table>
  359. <tr>
  360. <td>
  361. <b>Function name</b>
  362. </td>
  363. <td>
  364. <b>Installation mode</b>
  365. </td>
  366. </tr>
  367. <tr>
  368. <td>
  369. MultiUser.InstallMode.AllUsers
  370. </td>
  371. <td>
  372. Installer: Per-machine installation
  373. </td>
  374. </tr>
  375. <tr>
  376. <td>
  377. MultiUser.InstallMode.CurrentUser
  378. <td>
  379. Installer: Per-user installation
  380. </td>
  381. </tr>
  382. <tr>
  383. <td>
  384. un.MultiUser.InstallMode.AllUsers<td>
  385. Uninstaller: Per-machine installation
  386. </td>
  387. </tr>
  388. <tr>
  389. <td>
  390. un.MultiUser.InstallMode.CurrentUser<td>
  391. Uninstaller: Per-user installation
  392. </td>
  393. </tr>
  394. </table>
  395. </body>
  396. </html>