Determining an administrator on Vista

Posted: 02-03-2009, 08:46 PM
I am using the techinque to get the TokenElevationType using the API
GetTokenInformation on Vista to determine if a user is an admin. It seems to
work fine on Vista Business/Ultimate etc. However, it fails on Vista Home.
Does anyone have any clues?

The code is along the following lines:

TOKEN_ELEVATION_TYPE elevationType;
DWORD dwSize;

GetTokenInformation(hUserToken, TokenElevationType, &elevationType,
sizeof(elevationType), &dwSize);

switch (elevationType)
{
case TokenElevationTypeDefault:
TRACE(_T("TokenElevationTypeDefault - User is not using a split token\n"));
m_bAdmin = FALSE;
break;

case TokenElevationTypeFull:
TRACE(_T("TokenElevationTypeFull - User has a split token, and the
process is running elevated\n"));
m_bAdmin = TRUE;
break;

case TokenElevationTypeLimited:
TRACE(_T("TokenElevationTypeLimited - User has a split token, but the
process is not running elevated\n"));
m_bAdmin = TRUE;
break;

}

Thanks.

Determining an administrator on Vista


Responses to "Determining an administrator on Vista"

Sam Hobbs
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-04-2009, 08:02 PM
First, when posting questions about a function that returns potential
errors, include the error code. This function returns an error code that is
obtained by GetLastError. If you have not used GetLastError for this then if
you do use it for this you might have an answer. If the error code does not
immediately tell you what the problem is then search for GetTokenInformation
with the error code. You might need to convert the error code to a symbolic
name; look in winerror.h to do that. Or you might need to search the error
code with a "0x" prefix. Search the MSDN, and if that does not help, search
the Windows programming security group (Google groups might help) and if
that does not help search the internet.

Second, any time a question says something such as "doesn't work" or
"fails", it is usually necessary to be more specific about the symptoms, as
I describe above.

Finally, this is not a programming group. You should ask in the Windows
programming security group.



"Al" <Al@discussions.microsoft.com> wrote in message
newsC7AACBF-4361-4353-B1D9-B45489949218@microsoft.com...
>I am using the techinque to get the TokenElevationType using the API
> GetTokenInformation on Vista to determine if a user is an admin. It seems
> to
> work fine on Vista Business/Ultimate etc. However, it fails on Vista Home.
> Does anyone have any clues?
>
> The code is along the following lines:
>
> TOKEN_ELEVATION_TYPE elevationType;
> DWORD dwSize;
>
> GetTokenInformation(hUserToken, TokenElevationType, &elevationType,
> sizeof(elevationType), &dwSize);
>
> switch (elevationType)
> {
> case TokenElevationTypeDefault:
> TRACE(_T("TokenElevationTypeDefault - User is not using a split
> token\n"));
> m_bAdmin = FALSE;
> break;
>
> case TokenElevationTypeFull:
> TRACE(_T("TokenElevationTypeFull - User has a split token, and the
> process is running elevated\n"));
> m_bAdmin = TRUE;
> break;
>
> case TokenElevationTypeLimited:
> TRACE(_T("TokenElevationTypeLimited - User has a split token, but the
> process is not running elevated\n"));
> m_bAdmin = TRUE;
> break;
>
> }
>
> Thanks.
SuperXero
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-04-2009, 08:57 PM

How about this instead. Right Click on my computer, click manage, local
users and groups, users, right click, properties, member of. If they are
in the administrators group they are an admin.

SuperXero
*'HackingManual.Net' (http://hackingmanual.net)*


--
SuperXero
Al
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-04-2009, 09:05 PM
You obviously are clueless about what I asked. If you don't know, that is
fine but please don't waste everyone's time by responding with useless
messages.

"Sam Hobbs" wrote:
> First, when posting questions about a function that returns potential
> errors, include the error code. This function returns an error code that is
> obtained by GetLastError. If you have not used GetLastError for this then if
> you do use it for this you might have an answer. If the error code does not
> immediately tell you what the problem is then search for GetTokenInformation
> with the error code. You might need to convert the error code to a symbolic
> name; look in winerror.h to do that. Or you might need to search the error
> code with a "0x" prefix. Search the MSDN, and if that does not help, search
> the Windows programming security group (Google groups might help) and if
> that does not help search the internet.
>
> Second, any time a question says something such as "doesn't work" or
> "fails", it is usually necessary to be more specific about the symptoms, as
> I describe above.
>
> Finally, this is not a programming group. You should ask in the Windows
> programming security group.
>
>
>
> "Al" <Al@discussions.microsoft.com> wrote in message
> newsC7AACBF-4361-4353-B1D9-B45489949218@microsoft.com...
> >I am using the techinque to get the TokenElevationType using the API
> > GetTokenInformation on Vista to determine if a user is an admin. It seems
> > to
> > work fine on Vista Business/Ultimate etc. However, it fails on Vista Home.
> > Does anyone have any clues?
> >
> > The code is along the following lines:
> >
> > TOKEN_ELEVATION_TYPE elevationType;
> > DWORD dwSize;
> >
> > GetTokenInformation(hUserToken, TokenElevationType, &elevationType,
> > sizeof(elevationType), &dwSize);
> >
> > switch (elevationType)
> > {
> > case TokenElevationTypeDefault:
> > TRACE(_T("TokenElevationTypeDefault - User is not using a split
> > token\n"));
> > m_bAdmin = FALSE;
> > break;
> >
> > case TokenElevationTypeFull:
> > TRACE(_T("TokenElevationTypeFull - User has a split token, and the
> > process is running elevated\n"));
> > m_bAdmin = TRUE;
> > break;
> >
> > case TokenElevationTypeLimited:
> > TRACE(_T("TokenElevationTypeLimited - User has a split token, but the
> > process is not running elevated\n"));
> > m_bAdmin = TRUE;
> > break;
> >
> > }
> >
> > Thanks.
>
Mark H
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-04-2009, 09:25 PM
http://www.developmentnow.com/groups...hreadid=851943

http://blogs.msdn.com/cjacks/archive...ows-Vista.aspx


If that doesn't answer it, contact Wang. (e-mail at end of post, first link)

"Al" <Al@discussions.microsoft.com> wrote in message
newsC7AACBF-4361-4353-B1D9-B45489949218@microsoft.com...
> I am using the techinque to get the TokenElevationType using the API
> GetTokenInformation on Vista to determine if a user is an admin. It seems
to
> work fine on Vista Business/Ultimate etc. However, it fails on Vista Home.
> Does anyone have any clues?
>
> The code is along the following lines:
>
> TOKEN_ELEVATION_TYPE elevationType;
> DWORD dwSize;
>
> GetTokenInformation(hUserToken, TokenElevationType, &elevationType,
> sizeof(elevationType), &dwSize);
>
> switch (elevationType)
> {
> case TokenElevationTypeDefault:
> TRACE(_T("TokenElevationTypeDefault - User is not using a split
token\n"));
> m_bAdmin = FALSE;
> break;
>
> case TokenElevationTypeFull:
> TRACE(_T("TokenElevationTypeFull - User has a split token, and the
> process is running elevated\n"));
> m_bAdmin = TRUE;
> break;
>
> case TokenElevationTypeLimited:
> TRACE(_T("TokenElevationTypeLimited - User has a split token, but the
> process is not running elevated\n"));
> m_bAdmin = TRUE;
> break;
>
> }
>
> Thanks.

FromTheRafters
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-04-2009, 10:11 PM
http://blogs.msdn.com/cjacks/archive...ows-Vista.aspx

Maybe these guys can be more help.

"Al" <Al@discussions.microsoft.com> wrote in message
news:6EB33FAB-D276-4B5B-9DAE-9DF1AD25ECEA@microsoft.com...
> You obviously are clueless about what I asked. If you don't know, that is
> fine but please don't waste everyone's time by responding with useless
> messages.
>
> "Sam Hobbs" wrote:
>
>> First, when posting questions about a function that returns potential
>> errors, include the error code. This function returns an error code that
>> is
>> obtained by GetLastError. If you have not used GetLastError for this then
>> if
>> you do use it for this you might have an answer. If the error code does
>> not
>> immediately tell you what the problem is then search for
>> GetTokenInformation
>> with the error code. You might need to convert the error code to a
>> symbolic
>> name; look in winerror.h to do that. Or you might need to search the
>> error
>> code with a "0x" prefix. Search the MSDN, and if that does not help,
>> search
>> the Windows programming security group (Google groups might help) and if
>> that does not help search the internet.
>>
>> Second, any time a question says something such as "doesn't work" or
>> "fails", it is usually necessary to be more specific about the symptoms,
>> as
>> I describe above.
>>
>> Finally, this is not a programming group. You should ask in the Windows
>> programming security group.
>>
>>
>>
>> "Al" <Al@discussions.microsoft.com> wrote in message
>> newsC7AACBF-4361-4353-B1D9-B45489949218@microsoft.com...
>> >I am using the techinque to get the TokenElevationType using the API
>> > GetTokenInformation on Vista to determine if a user is an admin. It
>> > seems
>> > to
>> > work fine on Vista Business/Ultimate etc. However, it fails on Vista
>> > Home.
>> > Does anyone have any clues?
>> >
>> > The code is along the following lines:
>> >
>> > TOKEN_ELEVATION_TYPE elevationType;
>> > DWORD dwSize;
>> >
>> > GetTokenInformation(hUserToken, TokenElevationType, &elevationType,
>> > sizeof(elevationType), &dwSize);
>> >
>> > switch (elevationType)
>> > {
>> > case TokenElevationTypeDefault:
>> > TRACE(_T("TokenElevationTypeDefault - User is not using a split
>> > token\n"));
>> > m_bAdmin = FALSE;
>> > break;
>> >
>> > case TokenElevationTypeFull:
>> > TRACE(_T("TokenElevationTypeFull - User has a split token, and the
>> > process is running elevated\n"));
>> > m_bAdmin = TRUE;
>> > break;
>> >
>> > case TokenElevationTypeLimited:
>> > TRACE(_T("TokenElevationTypeLimited - User has a split token, but the
>> > process is not running elevated\n"));
>> > m_bAdmin = TRUE;
>> > break;
>> >
>> > }
>> >
>> > Thanks.
>>

Sam Hobbs
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-05-2009, 01:20 AM
So do you think this is a programmer's group?

The answer I gave is typical of answers given in the MSDN forums. It is very
normal for people in a programmer's forum to ask for details of "fails"; in
particular what does GetLastError return when it is relevant. If this
question were responded to by a Microsoft person, they would certainly ask
for that.

What in particular do you consider incorrect?


"Al" <Al@discussions.microsoft.com> wrote in message
news:6EB33FAB-D276-4B5B-9DAE-9DF1AD25ECEA@microsoft.com...
> You obviously are clueless about what I asked. If you don't know, that is
> fine but please don't waste everyone's time by responding with useless
> messages.
>
> "Sam Hobbs" wrote:
>
>> First, when posting questions about a function that returns potential
>> errors, include the error code. This function returns an error code that
>> is
>> obtained by GetLastError. If you have not used GetLastError for this then
>> if
>> you do use it for this you might have an answer. If the error code does
>> not
>> immediately tell you what the problem is then search for
>> GetTokenInformation
>> with the error code. You might need to convert the error code to a
>> symbolic
>> name; look in winerror.h to do that. Or you might need to search the
>> error
>> code with a "0x" prefix. Search the MSDN, and if that does not help,
>> search
>> the Windows programming security group (Google groups might help) and if
>> that does not help search the internet.
>>
>> Second, any time a question says something such as "doesn't work" or
>> "fails", it is usually necessary to be more specific about the symptoms,
>> as
>> I describe above.
>>
>> Finally, this is not a programming group. You should ask in the Windows
>> programming security group.
>>
>>
>>
>> "Al" <Al@discussions.microsoft.com> wrote in message
>> newsC7AACBF-4361-4353-B1D9-B45489949218@microsoft.com...
>> >I am using the techinque to get the TokenElevationType using the API
>> > GetTokenInformation on Vista to determine if a user is an admin. It
>> > seems
>> > to
>> > work fine on Vista Business/Ultimate etc. However, it fails on Vista
>> > Home.
>> > Does anyone have any clues?
>> >
>> > The code is along the following lines:
>> >
>> > TOKEN_ELEVATION_TYPE elevationType;
>> > DWORD dwSize;
>> >
>> > GetTokenInformation(hUserToken, TokenElevationType, &elevationType,
>> > sizeof(elevationType), &dwSize);
>> >
>> > switch (elevationType)
>> > {
>> > case TokenElevationTypeDefault:
>> > TRACE(_T("TokenElevationTypeDefault - User is not using a split
>> > token\n"));
>> > m_bAdmin = FALSE;
>> > break;
>> >
>> > case TokenElevationTypeFull:
>> > TRACE(_T("TokenElevationTypeFull - User has a split token, and the
>> > process is running elevated\n"));
>> > m_bAdmin = TRUE;
>> > break;
>> >
>> > case TokenElevationTypeLimited:
>> > TRACE(_T("TokenElevationTypeLimited - User has a split token, but the
>> > process is not running elevated\n"));
>> > m_bAdmin = TRUE;
>> > break;
>> >
>> > }
>> >
>> > Thanks.
>>
Sam Hobbs
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-05-2009, 01:29 AM
Al (the person asking the question) needs to do it in a program. If I am
incorrect about that then the source code is misleading. In programming
forums, when someone provides source code, they cannot use a "manual"
(non-automated) solution.



"SuperXero" <guest@unknown-email.com> wrote in message
news:fe98e168f1e9742b425772919bea40d0@nntp-gateway.com...
>
> How about this instead. Right Click on my computer, click manage, local
> users and groups, users, right click, properties, member of. If they are
> in the administrators group they are an admin.
>
> SuperXero
> *'HackingManual.Net' (http://hackingmanual.net)*
>
>
> --
> SuperXero
SuperXero
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-05-2009, 03:38 AM

I get it sam, like if a program needs to validate someone as admin o
not admin. Yep I'm not a programmer just a network admin

--
SuperXero
Sam Hobbs
Guest
Posts: n/a
 
Re: Determining an administrator on Vista
Posted: 02-05-2009, 05:14 PM
Yes, there you go; there are many reasons that might be done. Generally it
would be useful for issuing a message informing someone they need to have
Administrator privileges when they don't, instead of letting them proceed
and then get a more obscure crash message.


"SuperXero" <guest@unknown-email.com> wrote in message
news:d6b96f0bac0c419cce51220fb62c841e@nntp-gateway.com...
>
> I get it sam, like if a program needs to validate someone as admin or
> not admin. Yep I'm not a programmer just a network admin.
>
>
> --
> SuperXero
 
LinkBack Thread Tools Display Modes
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining if I have AntiVirus Protection in Vista Home Premium DDB Windows Vista Security 3 04-12-2008 08:38 AM
determining a driver me10lee83 Windows XP Configuration & Management 2 07-31-2007 04:07 AM
Determining IDE/RAid Linux / Unix 3 05-27-2004 07:13 PM
determining USB ports HillBillyBuddhist Windows XP Basics 1 08-29-2003 08:57 PM
determining bit size Joe727 Windows XP Basics 0 08-13-2003 01:21 PM