2002-11-04 15:40:55 +00:00
|
|
|
Name "UserInfo.dll test"
|
|
|
|
OutFile UserInfo.exe
|
2019-11-03 16:14:02 +00:00
|
|
|
RequestExecutionLevel Highest
|
2002-11-04 15:40:55 +00:00
|
|
|
|
2007-04-03 10:02:51 +00:00
|
|
|
!define REALMSG "$\nOriginal non-restricted account type: $2"
|
|
|
|
|
2002-11-04 15:40:55 +00:00
|
|
|
Section
|
2003-02-09 13:22:09 +00:00
|
|
|
ClearErrors
|
2002-11-04 15:40:55 +00:00
|
|
|
UserInfo::GetName
|
2019-11-03 16:14:02 +00:00
|
|
|
IfErrors PluginFail
|
2002-11-04 15:40:55 +00:00
|
|
|
Pop $0
|
2019-11-03 16:14:02 +00:00
|
|
|
StrCmp $0 "" 0 +2 ; GetName can return a empty string on Win9x
|
|
|
|
StrCpy $0 "?"
|
2002-11-04 15:44:51 +00:00
|
|
|
UserInfo::GetAccountType
|
2002-11-04 15:40:55 +00:00
|
|
|
Pop $1
|
2007-04-03 10:02:51 +00:00
|
|
|
# GetOriginalAccountType will check the tokens of the original user of the
|
|
|
|
# current thread/process. If the user tokens were elevated or limited for
|
|
|
|
# this process, GetOriginalAccountType will return the non-restricted
|
|
|
|
# account type.
|
|
|
|
# On Vista with UAC, for example, this is not the same value when running
|
|
|
|
# with `RequestExecutionLevel user`. GetOriginalAccountType will return
|
|
|
|
# "admin" while GetAccountType will return "user".
|
|
|
|
UserInfo::GetOriginalAccountType
|
|
|
|
Pop $2
|
2019-11-03 16:14:02 +00:00
|
|
|
StrCmp $1 "Admin" 0 +3 ; Note: Win9x always returns "Admin"
|
2007-04-03 10:02:51 +00:00
|
|
|
MessageBox MB_OK 'User "$0" is in the Administrators group${REALMSG}'
|
2002-11-06 16:22:30 +00:00
|
|
|
Goto done
|
|
|
|
StrCmp $1 "Power" 0 +3
|
2007-04-03 10:02:51 +00:00
|
|
|
MessageBox MB_OK 'User "$0" is in the Power Users group${REALMSG}'
|
2002-11-06 16:22:30 +00:00
|
|
|
Goto done
|
|
|
|
StrCmp $1 "User" 0 +3
|
2007-04-03 10:02:51 +00:00
|
|
|
MessageBox MB_OK 'User "$0" is just a regular user${REALMSG}'
|
2002-11-06 16:22:30 +00:00
|
|
|
Goto done
|
|
|
|
StrCmp $1 "Guest" 0 +3
|
2007-04-03 10:02:51 +00:00
|
|
|
MessageBox MB_OK 'User "$0" is a guest${REALMSG}'
|
2002-11-06 16:22:30 +00:00
|
|
|
Goto done
|
2003-02-09 13:22:09 +00:00
|
|
|
MessageBox MB_OK "Unknown error"
|
2003-05-02 17:11:40 +00:00
|
|
|
Goto done
|
2003-02-09 13:22:09 +00:00
|
|
|
|
2019-11-03 16:14:02 +00:00
|
|
|
PluginFail:
|
|
|
|
MessageBox MB_OK "Error! Unable to call plug-in!"
|
2002-11-06 16:22:30 +00:00
|
|
|
|
|
|
|
done:
|
2007-04-03 10:02:51 +00:00
|
|
|
SectionEnd
|
|
|
|
|