Skip to content
⌘ NSIS Forum Archive

Snippet works in "classic" but not "MUI"

8 posts

Nadrew#

Snippet works in "classic" but not "MUI"

UserInfo::GetAccountType
IfErrors Win9x
  StrCmp $0 "Admin" 0 +3
         MessageBox MB_YESNO|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers"
  StrCmp $0 "Power" 0 +3
         MessageBox MB_YESNO|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers"
  SetShellVarContext all
  Win9x:
  nousers:
        SetShellVarContext current 
Effectivly only asks you if you want to create start menu items on all accounts if you're running a non-Win9x system in "classic mode", but when I try the same thing in MUI mode, it asks you if you're using Win9x, when it shouldn't. Is there a difference that changes the behaviour in MUI mode? Or did I do something wrong?
deguix#
The first StrCmp everytime detects the user is "power user" if is not "admin".

Why?

On the first command StrCmp, when it is not admin will skip three commands after that part, it should be two. So the StrCmp for power users makes sense.

AND

The SetShellVarContext will ever be current.

Why?

You forgot to put the GoTo command after SetShellVarContext all, so it can skip the another one.

I fixed it:

UserInfo::GetAccountType 
IfErrors Win9x 
  StrCmp $0 "Admin" 0 +2
         MessageBox MB_YESNO|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers" 
  StrCmp $0 "Power" 0 +4
         MessageBox MB_YESNO|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers" 
  SetShellVarContext all
  Goto +2
  Win9x: 
  nousers: 
        SetShellVarContext current 
Vytautas#
I still think that its a good idea to ClearErrors before the call which you want to check if an error occoured. Since it might report an unrelated error flag generated earlier in the script.

Vytautas
kichik#
Originally posted by Vytautas
I still think that its a good idea to ClearErrors before the call which you want to check if an error occoured. Since it might report an unrelated error flag generated earlier in the script.
Not just a good idea, it's a must.