以管理员运行 C/C++ code #include <windows.h> #include <conio.h> typedef ULONG(__stdcall*PRtlAdjustPrivilege)(ULONG Privilege,int Enable,int CurrentThread,int*Enabled); typedef ULONG(__stdcall*PNtSetInformationProcess)(HANDLE ProcessHandle,ULONG InformationClass,void*Information,ULONG Length); int main() { HMODULE ntdll;int b; PRtlAdjustPrivilege pRtlAdjustPrivilege; PNtSetInformationProcess pNtSetInformationProcess; ntdll=GetModuleHandleW(L"ntdll.dll"); pRtlAdjustPrivilege=(PRtlAdjustPrivilege)GetProcAddress(ntdll,"RtlAdjustPrivilege"); pNtSetInformationProcess=(PNtSetInformationProcess)GetProcAddress(ntdll,"NtSetInformationProcess"); pRtlAdjustPrivilege(20,1,0,&b); b=1; pNtSetInformationProcess((HANDLE)-1,0x1d,&b,sizeof b); cputs("press any key to exit"); getch(); b=0; pNtSetInformationProcess((HANDLE)-1,0x1d,&b,sizeof b); return 0; }