您的位置:首页 > 编程语言 > C语言/C++

C++编写不能被结束的进程

2012-01-10 22:59 549 查看
以管理员运行

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;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: