Home > Fresh News > Is process a member of the Administrators local group

Is process a member of the Administrators local group

January 29th, 2011 Leave a comment Go to comments

The CheckTokenMembership function determines whether a specified security identifier (SID) is enabled in an access token.

Routine Description: This routine returns TRUE if the caller’s
process is a member of the Administrators local group. Caller is NOT
expected to be impersonating anyone and is expected to be able to
open its own process and process token.
Arguments: None.
Return Value:
TRUE – Caller has Administrators local group.
FALSE – Caller does not have Administrators local group.
BOOL IsUserAdmin(void)
BOOL bResult;
PSID AdministratorsGroup;
bResult = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
if(!CheckTokenMembership(NULL, AdministratorsGroup, &bResult))
bResult = FALSE;


  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.