Restart the machine on 98, NT and 2000

zhaozj2021-02-08  249

The following is the source code, in fact, in 98, only the last example of EXITWINDOWEX, the previous is to obtain permissions.

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 = :: AdjustTokenPrivilegeg (HDLTokenHandle, False, & Tkp, Sizeof (TkpnewButInored), & TkpnewButInored, & lbufferneed;

EXITWINDOWSEX (EWX_REBOOT, 0);

转载请注明原文地址:https://www.9cbs.com/read-1777.html

New Post(0)