Problem with UserInfo or StrCmp or with me.
Hello,
After reading the documentation I tried to start experimenting with some of those examples that I found. Now base on the script that I experiment below, what I want to achieve is, if a user is not a member of Power User or Administrator group it will pop-up a message that says "User is just an ordinary user". Now when I try this script with a user that don't belong to Power User or Admin group, the message that pop-up is "Error! This DLL can't run under Windows 9x!".
Maybe I missed something here, why is it that my script didn't work?
Thanks!
Function .onInit
Call TestFunction
Pop $R0
MessageBox MB_OK "$R0"
Abort
FunctionEnd
>Function TestFunction
Push $R0
ClearErrors
UserInfo::GetName
IfErrors Win9x
Pop$0
UserInfo::GetAccountType
Pop$1
StrCmp$1 "Admin" 0 +3
Strcpy $R0 'User "$0" is in the Administrators group'
Goto done
StrCmp$1 "Power" 0 +3
Strcpy $R0 'User "$0" is in the Power Users group'
Goto done
Strcpy $R0 'User "$0" is just an ordinary user'
>; StrCmp $1 "User" 0 +3
>; Strcpy $R0 'User "$0" is just a regular user'
>; Goto done
>; StrCmp $1 "Guest" 0 +3
>; Strcpy $R0 'User "$0" is a guest'
>; Goto done
>; Strcpy $R0 "Unknown error"
Win9x:
# This one means you don't need to care about admin or
# not admin because Windows 9x doesn't either
Strcpy $R0 "Error! This DLL can't run under Windows 9x!"
done:
Exch $R0
FunctionEnd
>