Archive: .onGUIInit and check for Admin and set the context to all


.onGUIInit and check for Admin and set the context to all
Hi all,

My requirement is to install the product for all users (per-machine), and because of this (and other reasons) I check if the current user is admin. As I need to show a multilanguage MsbBox in case the user is not admin, I decided to use:
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
and to check in myGuiInit if the user is admin and if not to show a multilanguage MsgBox.

Question:
1) Is this way correct? Or it's not the right path to go to?
2) Is the .onGUIInit always called, even in a silent (un)install?
3) I also have to set the context to all users using the SetShellVarContext. Where is the best place to do so? Is it ok to also have this in the myGuiInit function after I check that the current user is admin?

Thanks,
Viv


It's a valid way of doing this. The .onGUIInit callback isn't called when running silently, so you should preform the test in .onInit and only display the message in .onGUIInit, if not running silently. You can check if the installer was ran silently using IsSilent.

It doesn't matter where you put SetShellVarContext, as long as it's called before everything else you'd want it to affect.


Thx,
Viv