Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 236811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:22:30+00:00 2026-05-11T20:22:30+00:00

the following is the code I’m using (copied from msdn) but even when the

  • 0

the following is the code I’m using (copied from msdn) but even when the the pocess user is not a local admin it returns as if it is any ideas?

BOOL IsUserAdmin(VOID)
/*++ 
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 b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup; 
b = AllocateAndInitializeSid(
    &NtAuthority,
    2,
    SECURITY_BUILTIN_DOMAIN_RID,
    DOMAIN_ALIAS_RID_ADMINS,
    0, 0, 0, 0, 0, 0,
    &AdministratorsGroup); 
if(b) 
{
    if (!CheckTokenMembership( NULL, AdministratorsGroup, &b)) 
    {
         b = FALSE;
    } 
    FreeSid(AdministratorsGroup); 
}

return(b);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:22:30+00:00Added an answer on May 11, 2026 at 8:22 pm

    In the MSDN doc here… There is a note mentioning issues when using this on VISTA (or later).

    To paraphrase, if you’re using this on Vista – the API will return true – because of the way Vista uses a split token for security.

    Here is the original note (originally written by tchao):

    When UAC is enabled in Windows
    Vista–which is the default setup, a
    thread in an administrator account
    will have a pair of split tokens: a
    filtered token and an elevated token.
    The filtered token will have the local
    administrators group SID in its group,
    but that SID is not enabled until the
    thread gets the elevated token after
    user’s approval via the UAC dialog or
    programmatically. The above sample
    code shows that both a filtered
    administrator token and an elevated
    administrator token as having the
    local administrators group SID
    “enabled,” but that is not the case
    with the filtered administrator token
    which has its TOKEN_ELEVATION_TYPE as
    TokenElevationTypeLimited.

    If you look at the local
    administrators group association with
    the administrator filtered token, it’s
    for deny only, but
    CheckTokenMembership() will show that
    the administrator filtered token is a
    member (enabled?) of the local
    administrators group. Perhaps this is
    also a function implementation bug?!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code using boost::asio will not compile: #ifndef _SERVER_H_ #define _SERVER_H_ #include Connection.h
The following code does not catch an exception, when I try to divide by
Following code I can use for storing the value of UILabel into a string.
The following code: key = open(C:\Scripts\private.ppk,'rb').read() reads the file and assigns its data to
The following code loads the page-handler.php into #page when the function load is fired
The following code does two things: Checks to see if the item has the
The following code already exists in one of the javascript files i am working
The following code can be compiled def isEven(a:Int)= if (a%2==0) true else false def
The following code creates a pdf that downloads after you press the link /
The following code don't show up multiline text UIButton * viewedYou = [UIButton buttonWithType:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.