<strong>整理了两段快速关机的程序</strong><br/><br/>用的是ntdll的ZwShutdownSystem<br/><br/>代码: <br/><br/> <code id="code0">int FastExitSystemNt()<br/>{<br/>FARPROC p = (FARPROC)GetProcAddress(LoadLibraryW(TEXT("Ntdll.dll")),"ZwShutdownSystem");<br/>
IF(p == NULL)<br/> return 0;<br/>__asm <br/>{ <br/> push 1 //ZwShutdownSystem(ShutdownPowerOff); <br/> call p //或者call 寄存器eax 一样的效果<br/>return 1;<br/>}</code><br/><br/><br/>如果上面的你机子没反应就用这个<br/> <br/>代码: <br/><br/> <code id="code1">HANDLE FastExitSystem()<br/>{<br/> const int SE_SHUTDOWN_PRIVILEGE = 0x13;<br/> typedef int (__stdcall *PFN_RtlAdjustPrivilege)( INT, BOOL, BOOL, INT*); <br/> typedef int (__stdcall *PFN_ZwShutdownSystem)(INT); <br/> HMODULE hModule = ::LoadLibraryA("ntdll.dll"); <br/> if( hModule != NULL) <br/> { <br/> PFN_RtlAdjustPrivilege pfnRtl = (PFN_RtlAdjustPrivilege)GetProcAddress( hModule, "RtlAdjustPrivilege"); <br/> PFN_ZwShutdownSystem pfnShutdown = (PFN_ZwShutdownSystem)GetProcAddress( hModule,"ZwShutdownSystem"); <br/> if( pfnRtl != NULL && pfnShutdown != NULL )<br/> { <br/> int en = 0; <br/> int nRet= pfnRtl( SE_SHUTDOWN_PRIVILEGE, TRUE, TRUE, &en); <br/> if( nRet == 0x0C000007C ) <br/> nRet = pfnRtl(SE_SHUTDOWN_PRIVILEGE, TRUE, FALSE, &en); <br/> const int POWEROFF = 2; <br/> nRet = pfnShutdown(POWEROFF);<br/> return (HANDLE)hModule;<br/> } <br/> }<br/>return NULL;<br/>}</code><br/><br/>
0