Sky1234
15th September 2013 07:12 UTC
ExecShell
Am quite new to nsis just having a little problem getting the syntax correct for execshell - if someone could take a quick look would be awesome
I basically need to run 7za as admin so that it can extract an archive in the $EXEDIR to programfiles (The archive is super-large [>4gb] so i cant just bundle it with installer - unless i used torrentdownloader or something)
ExecShell "open" "7za.exe x $EXEDIR\Archieve.7z -pSECRETKEY -aoa -o$INSTDIR'" [[SW_SHOWMAXIMIZED]]
Obviously i replaced the password and archive name. Should be easy to fix - I got nsExec::Exec working but it wont work in program files as it needs to spawn 7za with admin rights.
Am just not sure where/how to use runas to run it as admin
Many thanks
Anders
15th September 2013 15:44 UTC
ExecShell "runas" "c:\path\to\app.exe" 'param1 "space param" param3'
but I would not recommend doing this:
- The runas verb is broken if UAC is turned off
- If you require elevation the whole installer should be elevated (RequestExecutionLevel)
Sky1234
16th September 2013 09:11 UTC
I have a requestexecutionlevel: admin flag in there but the child 7za process it spawns doesnt get admin privilidges and so cant unzip to C:/programfiles from $EXEDIR - If you have a workaround please tell :).
Anders
16th September 2013 15:46 UTC
Even if you use nsexec? Can you verify all of this by using Process Explorer (Enable the integrity column) and check both your installer and the child process...
Sky1234
23rd September 2013 08:26 UTC
Using NSExec the archive extracts from $EXEDIR to $INSTALLDIR whenever its outside Program Files, as soon as It tries to extract to program files it fails.
Sky1234
23rd September 2013 11:33 UTC
nevermind found the issue.
Regards
aerDNA
23rd September 2013 15:00 UTC
I notice that 7za.exe is the standard choice for dealing with pass-protected archives. I just wanted to share an alternative: 7-zip32.dll. Unlike Pavlov's 7za.dll/7zxa.dll, this one can be employed in NSIS. It's Japanese with poorly translated documentation so here's a snippet that might save someone's valuable time:
File /oname=$PLUGINSDIR\7-zip32.dll 7-zip32.dll
System::Call "$PLUGINSDIR\7-zip32::SevenZip(i 0, t 'x $\"$Archive$\" -o$\"$Destination$\" -p$Pass -y -hide', i 0, i 0) i.R0"
StrCmp $R0 0 Success