Back to the WFC main page
wfc_am_i_administrator
$Revision: 12 $
Declaration
BOOL wfc_am_i_administrator( void )
Description
This function returns TRUE if your program is running
with Administrator priveleges, FALSE if you don't have
Administrator proveleges. It uses the method described in
the Microsoft Knowledge Base article
Q118626.
Example
#include <wfc.h>
#pragma hdrstop
int _tmain( int number_of_command_line_arguments, LPCTSTR command_line_arguments[] )
{
WFCTRACEINIT( TEXT( "_tmain()" ) );
if ( wfc_am_i_administrator() != FALSE )
{
_tprintf( TEXT( "You are Administrator or in the Administrators group\n" ) );
}
else
{
_tprintf( TEXT( "You are nothing, a nobody!\n" ) );
}
return( EXIT_SUCCESS );
}
API's Used
wfc_am_i_administrator() uses the following API's:
- AllocateAndInitializeSid
- EqualSid
- FreeSid
- GetCurrentProcess
- GetCurrentThread
- GetLastError
- GetTokenInformation
- OpenProcessToken
- OpenThreadToken
Copyright, 2000, Samuel R. Blackburn
$Workfile: wfc_am_i_administrator.cpp $
$Modtime: 1/17/00 9:31a $