如下是源码,其实在98上只用最后一句ExitWindowEx即可,前面是为了取得权限.
TOKEN_PRIVILEGES tkp,tkpNewButIgnored; HANDLE hdlTokenHandle; LUID tmpLuid; BOOL rc; DWORD lBufferNeeded;
HANDLE hdlProcessHandle = GetCurrentProcess(); rc = ::OpenProcessToken(hdlProcessHandle,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hdlTokenHandle);
rc = LookupPrivilegeValue("","SeShutdownPrivilege", &tmpLuid); tkp.PrivilegeCount = 1; // One privilege to set tkp.Privileges[0].Luid = tmpLuid; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; rc = ::AdjustTokenPrivileges(hdlTokenHandle, FALSE, &tkp, sizeof(tkpNewButIgnored), &tkpNewButIgnored, &lBufferNeeded);
ExitWindowsEx(EWX_REBOOT,0);