{"id":61,"date":"2007-05-11T21:18:27","date_gmt":"2007-05-11T19:18:27","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/reboot\/"},"modified":"2007-05-11T21:18:29","modified_gmt":"2007-05-11T19:18:29","slug":"reboot","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/reboot\/","title":{"rendered":"ReBoot"},"content":{"rendered":"<p>[code lang=&#8221;delphi&#8221;]var<br \/>\nhToken : THandle;<br \/>\ntkp, ptkp : TTokenPrivileges;<br \/>\ni : dword;<\/p>\n<p>begin<br \/>\n\/\/* Get a token for this process. *\/<br \/>\nOpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY,<br \/>\nhToken);<br \/>\n\/\/* Get the LUID for the shutdown privilege. *\/<br \/>\nLookupPrivilegeValue(NiL, &#8216;SE_SHUTDOWN_NAME&#8217;, tkp.Privileges[0].Luid);<br \/>\ntkp.PrivilegeCount := 1;  \/\/\/* one privilege to set    *\/<br \/>\ntkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;<br \/>\n\/\/* Get the shutdown privilege for this process. *\/<br \/>\nAdjustTokenPrivileges(hToken,FALSE,tkp,0,ptkp,i);<br \/>\n\/\/* Cannot test the return value of AdjustTokenPrivileges. *\/<br \/>\nGetLastError;<br \/>\n\/\/* Shut down the system and force all applications to close. *\/<br \/>\nExitWindowsEx(EWX_SHUTDOWN or EWX_FORCE, 0);<br \/>\nend.[\/code]<\/p>\n<p>[tags]Delphi, API[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[code lang=&#8221;delphi&#8221;]var hToken : THandle; tkp, ptkp : TTokenPrivileges; i : dword; begin \/\/* Get a token for this process. *\/ OpenProcessToken(GetCurrentProcess,TOKEN_ADJUST_PRIVILEGES or&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[84,75],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/s71Tml-reboot","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/61"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}