<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wolfgang</id>
	<title>NSIS Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wolfgang"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/Special:Contributions/Wolfgang"/>
	<updated>2026-04-21T22:41:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10587</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10587"/>
		<updated>2006-05-30T18:34:49Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manage administrator&lt;br /&gt;
permissions on the processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers require administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
Here is a visual example of such a login page:&lt;br /&gt;
&lt;br /&gt;
http://nsis.sourceforge.net/mediawiki/images/c/c0/RunAs.jpg&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments: the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handle the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10586</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10586"/>
		<updated>2006-05-30T18:34:05Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* About NSIS-RunAs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manage administrator&lt;br /&gt;
permissions on the processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers require administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
Here is a visual example of such a login page:&lt;br /&gt;
&lt;br /&gt;
http://nsis.sourceforge.net/mediawiki/images/c/c0/RunAs.jpg&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handle the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10585</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10585"/>
		<updated>2006-05-30T18:33:12Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manage administrator&lt;br /&gt;
permissions on the processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
Here is a visual example of such a login page:&lt;br /&gt;
&lt;br /&gt;
http://nsis.sourceforge.net/mediawiki/images/c/c0/RunAs.jpg&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handle the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10584</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10584"/>
		<updated>2006-05-30T18:31:18Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
Here is a visual example of such a login page:&lt;br /&gt;
&lt;br /&gt;
http://nsis.sourceforge.net/mediawiki/images/c/c0/RunAs.jpg&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handle the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10583</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10583"/>
		<updated>2006-05-30T18:29:38Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Screenshot==&lt;br /&gt;
Here is an example of a login page:&lt;br /&gt;
&lt;br /&gt;
http://nsis.sourceforge.net/mediawiki/images/c/c0/RunAs.jpg&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handle the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:RunAs.jpg&amp;diff=10582</id>
		<title>File:RunAs.jpg</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:RunAs.jpg&amp;diff=10582"/>
		<updated>2006-05-30T18:26:09Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10581</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10581"/>
		<updated>2006-05-30T18:17:36Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handle the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10580</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10580"/>
		<updated>2006-05-30T18:16:49Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword, WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10579</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10579"/>
		<updated>2006-05-30T18:13:45Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword,&lt;br /&gt;
                     WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  IntOp $0 $0 - 1&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10578</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10578"/>
		<updated>2006-05-30T18:12:19Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword,&lt;br /&gt;
                     WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 1 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10577</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10577"/>
		<updated>2006-05-30T18:08:13Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword,&lt;br /&gt;
                     WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 0 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:User Accounts Related Functions]]&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10576</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10576"/>
		<updated>2006-05-30T18:03:56Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* About NSIS-RunAs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for example, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword,&lt;br /&gt;
                     WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 0 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10575</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10575"/>
		<updated>2006-05-30T17:59:46Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: /* Copyright */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for examples, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword,&lt;br /&gt;
                     WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 0 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang_AT_NOSPAM_Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10574</id>
		<title>NSIS-RunAs</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=NSIS-RunAs&amp;diff=10574"/>
		<updated>2006-05-30T17:58:21Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is NSIS-RunAs, a dll to help NSIS installer scripts manager administrator&lt;br /&gt;
permissions on processes it launches.&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
&amp;lt;attach&amp;gt;NSIS-RunAs.zip&amp;lt;/attach&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==About NSIS-RunAs==&lt;br /&gt;
Sometimes, certain installers requires administator privileges to be able to&lt;br /&gt;
perform certain actions. For example to modify the registry or to install&lt;br /&gt;
files in protected areas of the filesystem. Those installers will either tell&lt;br /&gt;
you that you need to restart them as an administrator, or they will suggest&lt;br /&gt;
you to enter an appropriate username/password combination. This is what&lt;br /&gt;
NSIS-RunAs is meant to help you do.&lt;br /&gt;
&lt;br /&gt;
The dll contains two functions: RunAsW and GetAdministrators. By creating&lt;br /&gt;
approriate dialogs with, for examples, the InstallOptions plugin, you could&lt;br /&gt;
create a login page that will lead the installer to be restarted.&lt;br /&gt;
&lt;br /&gt;
==Interface==&lt;br /&gt;
The interface to those functions are the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
WINAPI DWORD RunAsW (WCHAR *uusername, WCHAR *upassword,&lt;br /&gt;
                     WCHAR *ucommand, WCHAR **error);&lt;br /&gt;
WINAPI WCHAR **GetAdministrators (LPWSTR domain, LPDWORD read);&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RunAsW takes 4 arguments, the username, the password, the command to execute&lt;br /&gt;
and a pointer to an error string. It returns 1 on success, 0 on failure.&lt;br /&gt;
The correct invocation with the System plugin would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $1 $username&lt;br /&gt;
  StrCpy $2 $password&lt;br /&gt;
  StrCpy $3 $command&lt;br /&gt;
  StrCpy $4 0&lt;br /&gt;
  System::Call &#039;RunAs::RunAsW(w r1, w r2, w r3, *w .r4) i .r0 ? u&#039;&lt;br /&gt;
  IntCmp $0 0 success&lt;br /&gt;
  [failure code]&lt;br /&gt;
success:&lt;br /&gt;
  [success code]&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GetAdministrators is a bit more tricky to handle, since it will return an&lt;br /&gt;
array of wide-char pointers. Its arguments are the domain to query (leave it&lt;br /&gt;
to &amp;quot;&amp;quot; for the local machine) and a pointer to an integer that will receive the&lt;br /&gt;
number of user-accounts returned in the array.&lt;br /&gt;
The invocation of GetAdministrators would look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
  StrCpy $0 0&lt;br /&gt;
  StrCpy $1 &amp;quot;&amp;quot;&lt;br /&gt;
  StrCpy $2 0&lt;br /&gt;
  StrCpy $3 0&lt;br /&gt;
  System::Call &#039;RunAs::GetAdministrators(w r1, *i .r0) i .r2 ? u&#039;&lt;br /&gt;
  StrCpy $4 $2&lt;br /&gt;
loop:&lt;br /&gt;
  IntCmp $0 0 endloop&lt;br /&gt;
  System::Call &#039;*$2(w .r3)&#039;&lt;br /&gt;
  [code to handles the username in $3]&lt;br /&gt;
  System::Free $3   ; we free the memory used by the string&lt;br /&gt;
  IntOp $2 $2 + 4   ; pointers have a size of 4 on 32 bit machines&lt;br /&gt;
  Goto Loop&lt;br /&gt;
endloop:&lt;br /&gt;
  System::Free $4   ; we free the memory used by the array&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
I avoid using proprietary software, especially when free equivalents exists.&lt;br /&gt;
And I also encourage you to do so. Therefore I am using the GCC compiler&lt;br /&gt;
ported to Win32 by the mingw project. You can download the MingW SDK from&lt;br /&gt;
http://www.mingw.org/. Basically you need the GNU make utility, GCC and the&lt;br /&gt;
Win32 interface files.&lt;br /&gt;
&lt;br /&gt;
In the case you want to use another compiling environment, I have named the&lt;br /&gt;
makefile &amp;quot;GNUmakefile&amp;quot; to avoid incompatibilities with other make utilities.&lt;br /&gt;
GNU make will recognize it as a regular makefile. Also, you might want to&lt;br /&gt;
replace the &amp;quot;__declspec(dllexport)&amp;quot; directive in the function declarations&lt;br /&gt;
with a similar directive or pragma for your environment. If you do so, please&lt;br /&gt;
send me your changes so that I can incorporate them in my tree.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
NSIS-RunAs is copyright (c) 2006  Wolfgang Sourdeau &amp;lt;Wolfgang@Contre.COM&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The NSIS-RunAs module is distributed under the GNU General Public License. You&lt;br /&gt;
can find a copy of this license in the file &amp;quot;COPYING.txt&amp;quot; in the Source&lt;br /&gt;
subdirectory of the distribution or at this address: http://www.gnu.org/licenses/gpl.html. An exception applies on the resulting RunAs.dll in the case you&lt;br /&gt;
use it along your product installer since it would only impair you and would&lt;br /&gt;
not be specially useful to your users either. This exception is documented in the header of the&lt;br /&gt;
file &amp;quot;NSIS-RunAs.c&amp;quot; in the Source subdirectory.&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=File:NSIS-RunAs.zip&amp;diff=10573</id>
		<title>File:NSIS-RunAs.zip</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=File:NSIS-RunAs.zip&amp;diff=10573"/>
		<updated>2006-05-30T17:48:38Z</updated>

		<summary type="html">&lt;p&gt;Wolfgang: A dll to interface with the System plugin to provide the user with an administrator login dialog.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A dll to interface with the System plugin to provide the user with an administrator login dialog.&lt;/div&gt;</summary>
		<author><name>Wolfgang</name></author>
	</entry>
</feed>