提權函數(shù)之RtlAdjustPrivilege()使用說明
更新時間:2011年06月27日 21:42:54 作者:
RtlAdjustPrivilege() 這玩意是在 NTDLL.DLL 里的一個不為人知的函數(shù),MS沒有公開,原因就是這玩意實在是太NB了,以至于不需要任何其他函數(shù)的幫助,僅憑這一個函數(shù)就可以獲得進程ACL的任意權限!
下面是函數(shù)定義:
NTSTATUS RtlAdjustPrivilege
(
ULONG Privilege,
BOOLEAN Enable,
BOOLEAN CurrentThread,
PBOOLEAN Enabled
)
參數(shù)的含義:
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.
// 輸出原來相應權限的狀態(tài)(打開 | 關閉)
用法很簡單:
#define SE_DEBUG_PRIVILEGE 0x14 //DEBUG 權限
int s;
RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE,true,false,&s);
復制代碼 代碼如下:
NTSTATUS RtlAdjustPrivilege
(
ULONG Privilege,
BOOLEAN Enable,
BOOLEAN CurrentThread,
PBOOLEAN Enabled
)
參數(shù)的含義:
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.
// 輸出原來相應權限的狀態(tài)(打開 | 關閉)
用法很簡單:
復制代碼 代碼如下:
#define SE_DEBUG_PRIVILEGE 0x14 //DEBUG 權限
int s;
RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE,true,false,&s);
相關文章
在Framework 4.0中:找出新增的方法與新增的類(二)
為什么動態(tài)加載程序集無法找出Framework 4.0 和Framwork2.0 新增的方法和類2013-05-05
C#采用FileSystemWatcher實現(xiàn)監(jiān)視磁盤文件變更的方法
這篇文章主要介紹了C#采用FileSystemWatcher實現(xiàn)監(jiān)視磁盤文件變更的方法,詳細分析了FileSystemWatcher的用法,并以此為基礎實現(xiàn)監(jiān)視磁盤文件變更,是非常實用的技巧,具有一定的借鑒價值,需要的朋友可以參考下2014-11-11
c#?使用線程對串口serialPort進行收發(fā)數(shù)據(jù)(四種)
本文主要介紹了c#?使用線程對串口serialPort進行收發(fā)數(shù)據(jù),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-07-07

