码迷,mamicode.com
首页 > 其他好文 > 详细

Debug权限提升

时间:2017-07-19 21:49:30      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:read   uid   var   sed   led   current   deb   att   get   

procedure SetPrivilege;
 
var
 
OldTokenPrivileges, TokenPrivileges: TTokenPrivileges;
 
ReturnLength: dword;
 
hToken: THandle;
 
Luid: int64;
 
begin
 
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken);
 
LookupPrivilegeValue(nil, SeDebugPrivilege, Luid);
 
TokenPrivileges.Privileges[0].luid := Luid;
 
TokenPrivileges.PrivilegeCount := 1;
 
TokenPrivileges.Privileges[0].Attributes := 0;
 
AdjustTokenPrivileges(hToken, False, TokenPrivileges, SizeOf(TTokenPrivileges), OldTokenPrivileges, ReturnLength);
 
OldTokenPrivileges.Privileges[0].luid := Luid;
 
OldTokenPrivileges.PrivilegeCount := 1;
 
OldTokenPrivileges.Privileges[0].Attributes := TokenPrivileges.Privileges[0].Attributes or SE_PRIVILEGE_ENABLED;
 
AdjustTokenPrivileges(hToken, False, OldTokenPrivileges, ReturnLength, PTokenPrivileges(nil)^, ReturnLength);
 
end;

http://www.delphi6.com/thread-3.htm

 

Debug权限提升

标签:read   uid   var   sed   led   current   deb   att   get   

原文地址:http://www.cnblogs.com/findumars/p/7207666.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!