git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5033 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
78f805da52
commit
0cb1253452
2 changed files with 133 additions and 94 deletions
|
@ -1,6 +1,8 @@
|
|||
Name "UserInfo.dll test"
|
||||
OutFile UserInfo.exe
|
||||
|
||||
!define REALMSG "$\nOriginal non-restricted account type: $2"
|
||||
|
||||
Section
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
|
@ -8,17 +10,26 @@ Section
|
|||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
# 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
|
||||
StrCmp $1 "Admin" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is in the Administrators group'
|
||||
MessageBox MB_OK 'User "$0" is in the Administrators group${REALMSG}'
|
||||
Goto done
|
||||
StrCmp $1 "Power" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is in the Power Users group'
|
||||
MessageBox MB_OK 'User "$0" is in the Power Users group${REALMSG}'
|
||||
Goto done
|
||||
StrCmp $1 "User" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is just a regular user'
|
||||
MessageBox MB_OK 'User "$0" is just a regular user${REALMSG}'
|
||||
Goto done
|
||||
StrCmp $1 "Guest" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is a guest'
|
||||
MessageBox MB_OK 'User "$0" is a guest${REALMSG}'
|
||||
Goto done
|
||||
MessageBox MB_OK "Unknown error"
|
||||
Goto done
|
||||
|
@ -29,4 +40,5 @@ Section
|
|||
MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
|
||||
|
||||
done:
|
||||
SectionEnd
|
||||
SectionEnd
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue