13,822
社区成员
发帖
与我相关
我的任务
分享
//提升权限需要实用到"ntdl.dll"库,此库可以在c:\windows\system32目录下面 找到
//以下两种代码都可以
//1.第一种
HMODULE b=LoadLibraryA("ntdll.dll");
typedef int(__stdcall *Func_RtlAdjustPrivilege)(int,bool,bool,int *);
Func_RtlAdjustPrivilege bb=(Func_RtlAdjustPrivilege)GetProcAddress(b,"RtlAdjustPrivilege");
int RN=0;
bb(20,true,false,&RN);
//2.第二种
#define SE_DEBUG_PRIVILEGE (20)
typedef long NTSTATUS;
typedef NTSTATUS (WINAPI *_RtlAdjustPrivilege)(ULONG /*Privilege*/,BOOL /*Enable*/,BOOL /*CurrentThread*/,PBOOL /*Enabled*/);
_RtlAdjustPrivilege RtlAdjustPrivilege = (_RtlAdjustPrivilege)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlAdjustPrivilege");
BOOL bResult;
RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, 1, 0, &bResult);