Back to the WFC main page
wfc_enable_privilege
$Revision: 1 $
Declaration
BOOL wfc_enable_privilege( LPCTSTR privilege_name )
Description
This function returns TRUE if the
privilege_name
was acquired. It will return FALSE if that privilege could
not be enabled.
Example
int _tmain( int number_of_command_line_arguments, LPCTSTR command_line_arguments[] )
{
WFCTRACEINIT( TEXT( "_tmain()" ) );
if ( number_of_command_line_arguments < 2 )
{
return( EXIT_SUCCESS );
}
int loop_index = 1;
while( loop_index < number_of_command_line_arguments )
{
if ( wfc_enable_privilege( command_line_arguments[ loop_index ] ) == FALSE )
{
_tprintf( TEXT( "Could not enable the \"%s\" privilege.\n" ),
command_line_arguments[ loop_index ] );
}
loop_index++;
}
return( EXIT_SUCCESS );
}
API's Used
wfc_enable_privilege() uses the following API's:
- AdjustTokenPrivileges
- GetCurrentProcess
- GetLastError
- LookupPrivilegeValue
- OpenProcessToken
- ZeroMemory
Copyright, 2000, Samuel R. Blackburn
$Workfile: wfc_enable_privilege.cpp $
$Modtime: 1/17/00 9:32a $