首页 > 其他 > 详细

Debug权限提升

时间:2017-07-19 21:23:38      阅读:298      评论:0      收藏:0      [点我收藏+]
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权限提升

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!