//提升进程权限
BOOL UpdateProcessPrivilege( HANDLE hProcess, LPCTSTR lpPrivilegeName = SE_DEBUG_NAME )
// hProcess [in] : 要提升的进程,目标进程
// lpPrivilegeName [in] : 要提升到的特权,目标特权
// 返回值 : TRUE : 成功; FALSE : 失败
{
HANDLE hToken;
if ( ::OpenProcessToken( hProcess, TOKEN_ALL_ACCESS, &hToken ) ) {
LUID destLuid;
if ( ::LookupPrivilegeValue( NULL, lpPrivilegeName, &destLuid ) ) {
TOKEN_PRIVILEGES TokenPrivileges;
TokenPrivileges.PrivilegeCount = 1;
TokenPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
TokenPrivileges.Privileges[0].Luid = destLuid;
int iResult;
if ( iResult = ::AdjustTokenPrivileges( hToken, FALSE, &TokenPrivileges,
0, NULL, NULL ) ) {
return TRUE;
}
}
}
return FALSE;
}
参考帖子:
(http://www.csdn.net/expert/topic/580/580874.xml?temp=.7492029)
特此致谢!