#include #include #include #include #define SE_SHUTDOWN_PRIVILEGE 0x13 int main() { HINSTANCE hdll; int lyp=0; int result; if(hdll=LoadLibrary("ntdll")) { typedef int (*lypRtlAdjustPrivilege)(int,bool,bool,int*); typedef int (*lypZwShutdownSystem)(int); lypRtlAdjustPrivilege RtlAdjustPrivilege; lypZwShutdownSystem ZwShutdownSystem; RtlAdjustPrivilege=GetProcAddress(hdll,"RtlAdjustPrivilege"); ZwShutdownSystem=GetProcAddress(hdll,"ZwShutdownSystem"); if(RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE,true,true,&lyp)==0x0c000007c) { printf("yes!"); result=RtlAdjustPrivilege(SE_SHUTDOWN_PRIVILEGE,true,false,&lyp); result=ZwShutdownSystem(2); } FreeLibrary("ntdll"); } return 0; }