下面是函数定义:
NTSTATUS RtlAdjustPrivilege ( ULONG Privilege, BOOLEAN Enable, BOOLEAN CurrentThread, PBOOLEAN Enabled )
参数的含义: Privilege [In] Privilege index to change. // 所需要的权限名称,可以到MSDN查找关于Process Token & Privilege内容可以查到
Enable [In] If TRUE, then enable the privilege otherwise disable. // 如果为True 就是打开相应权限,如果为False 则是关闭相应权限
CurrentThread [In] If TRUE, then enable in calling thread, otherwise process. // 如果为True 则仅提升当前线程权限,否则提升整个进程的权限
Enabled [Out] Whether privilege was previously enabled or disabled. // 输出原来相应权限的状态(打开 | 关闭)
用法很简单:
#define SE_DEBUG_PRIVILEGE 0x14 //DEBUG 权限 int s; RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE,true,false,&s);
|