Re: Determining an administrator on Vista



http://blogs.msdn.com/cjacks/archive/2006/10/09/How-to-Determine-if-a-User-is-a-Member-of-the-Administrators-Group-with-UAC-Enabled-on-Windows-Vista.aspx

Maybe these guys can be more help.

"Al" <Al@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6EB33FAB-D276-4B5B-9DAE-9DF1AD25ECEA@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DC7AACBF-4361-4353-B1D9-B45489949218@xxxxxxxxxxxxxxxx
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.



.



Relevant Pages

  • Re: Determining an administrator on Vista
    ... This function returns an error code that is ... programming security group. ... GetTokenInformation(hUserToken, TokenElevationType, &elevationType, ...
    (microsoft.public.windows.vista.security)
  • Re: Determining an administrator on Vista
    ... The answer I gave is typical of answers given in the MSDN forums. ... This function returns an error code that is ... >I am using the techinque to get the TokenElevationType using the API ... > GetTokenInformation on Vista to determine if a user is an admin. ...
    (microsoft.public.windows.vista.security)
  • Re: Determining an administrator on Vista
    ... First, when posting questions about a function that returns potential errors, include the error code. ... If you have not used GetLastError for this then if you do use it for this you might have an answer. ... Search the MSDN, and if that does not help, search the Windows programming security group and if that does not help search the internet. ... GetTokenInformation(hUserToken, TokenElevationType, &elevationType, ...
    (microsoft.public.windows.vista.security)