Skip to content
⌘ NSIS Forum Archive

Do it the “7-Zip way” (request admin _not_ on launch, but later)?!

7 posts

eagle3386#

Do it the “7-Zip way” (request admin _not_ on launch, but later)?!

Hey guys,

since I switched to a specific 7-Zip version I don’t really remember, I noticed 7-Zip’s installer requesting administrative rights when it gets to the step where it copies/registers it’s context-menu DLL.

I also know that there’s the UAC-plugin available, but after having a look at 7-Zip’s NSIS-file (included within its source code-archive, but attached to this post for your pleasure 😉), I couldn’t find such a call anywhere?!

So, how does 7-Zip do it then?

Any help would be greatly appreciated! 🙂

/Martin..
eagle3386#
Well, since there are paragraphs like
# set "all users" mode
SetShellVarContext all
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED 7-zip.dll $INSTDIR\7-zip.dll $INSTDIR
and/or
WriteRegStr HKCR "Drive\shellex\DragDropHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}"

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${CLSID_CONTEXT_MENU}" "7-Zip Shell Extension"
I do believe NSIS is used.. 😉

Or is it because of these lines
!ifdef WIN64
ExecWait 'regsvr32 /s "$INSTDIR\7-zip.dll"'
!endif
within the script?

I’m asking all these questions, because I want to request administrative rights _only_ in case the user has not enough “power” to write to an UAC-protected folder — in all other cases, the installer shall run fine with the user-level.. 😉
eagle3386#
I’m sorry, but I don’t know what you mean with “UAC dialog”.. 🙁
Could you explain that in more detail, please?
Anders#
requesting administrative rights, elevation dialog or whatever you wanna call it http://img.tomshardware.com/uk/2007/...ac_meldung.png
eagle3386#
Right, now I got it.. 😉

The details only show path + filename and look like this:
C:\Users\<User>\Desktop\7z464-x64.msi

And that’s where I should apologize for being so dumb (again).. 🙄
It’s actually an MSI-setup, not a NSIS-one..