Old 13th January 2011, 14:22   #1
Junior Member
Join Date: Jan 2011
Posts: 8
Unhappy RunAs with Windows 7 does not work

I am using the NSIS RunAs plugin in order to call another install program if the user has only user privileges. In XP the RunAs is working fine. Under Win7 the RunAs always exits with error.

I have tried both methods:

StrCpy $3 “$INST_TEMP\Update_Monitor\UpdateMon_Installer.exe "
StrCpy $4 0
System::Call 'RunAs::RunAsW(w r1,w r2,w r3,*w .r4) i .r0 ? u'

RunAs::RunAs `"$INST_TEMP\Update_Monitor\UpdateMon_Installer.exe` `$ADMIN_LOGON` `$ADMIN_PASSWD`

Any ideas why this works does not work anymore on Win7?

Many thanks.
happyhippo is offline   Reply With Quote
Old 13th January 2011, 21:04   #2
Anders's Avatar
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
2 is never going to work, this thing is not a NSIS plugin...

As to why 1 does not work is hard to say when you don't post the error message. But I'd say this "plugin" code is horrible and buggy, it leaks handles and the error string buffer.

To get the error string, you would have to treat $4 as a WCHAR* and extract it with the system::call struct syntax, then you will get a error string that may give some hints as to why it is failing, alternatively, do something like
PHP Code:
system::call 'user32::MessageBoxW(i0,i r4,i0,i0)i' 
After that you can pass $4 to LocalFree, but there is no way to close the two leaked handles, that needs to be fixed in the source

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 20th January 2011, 14:44   #3
Junior Member
Join Date: Jan 2011
Posts: 8
I have found the runas problem.

Method 1 is another runas plugin for NSIS and I have used this dll to run method 2.

The good thing with method 1 was that it does not require any dll file to be located with the installer. But as the method does not longer work with Windows 7 I have to switch to the other runas plugin.
happyhippo is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

nsis, plugin, run as administrator, runas, windows 7

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump