重启windows 2000/nt系统
重新启动windows2000/nt系统
rebootsawindows2000pc.manyexamplesshellthekernelandjustkillthepc.thisdoesproperlyandtakesintoaccountauserprivilages.
'apicallsusedforrebootpc
privateconsttoken_adjust_privileges=&h20
privateconsttoken_query=&h8
privateconstse_privilege_enabled=&h2
privateconstewx_shutdownlong=1
privateconstewx_forcelong=4
privateconstewx_reboot=2
privatetypeluid
usedpartlong
ignoredfornowhigh32bitpartlong
endtype
privatetypetoken_privileges
privilegecountlong
theluidluid
attributeslong
endtype
privatedeclarefunctionexitwindowsexlib"user32"(byvaldwoptionslong,byvaldwreservedlong)long
privatedeclarefunctiongetcurrentprocesslib"kernel32"long
privatedeclarefunctionopenprocesstokenlib"advapi32"(byvalprocesshandlelong,byvaldesiredaccesslong,tokenhandlelong)long
privatedeclarefunctionlookupprivilegevaluelib"advapi32"alias"lookupprivilegevaluea"(byvallpsystemnamestring,byvallpnamestring,lpluidluid)long
privatedeclarefunctionadjusttokenprivilegeslib"advapi32"(byvaltokenhandlelong,byvaldisableallprivilegeslong,newstatetoken_privileges,byvalbufferlengthlong,previousstatetoken_privileges,returnlengthlong)long
subrebootpc
localerrorgotorebootpc_errorhandler
constcsprocname="rebootpc"
dimhprocesshandlelong
dimhtokenhandlelong
dimtmpluidluid
dimtkpnewtoken_privileges
dimtkpprevioustoken_privileges
dimlbufferneededlong
hprocesshandle=getcurrentprocess
callopenprocesstoken(hprocesshandle,token_adjust_privilegestoken_query,htokenhandle)
'gettheluidfortheshutdownprivilege
calllookupprivilegevalue("","seshutdownprivilege",tmpluid)
bxwx.org=1'oneprivilegesebxwx.org=tmpluibxwx.org=se_privilege_enabled
'enabletheshutdownprivilegetheaccesstokenthibxwx.org=0
calladjusttokenprivileges(htokenhandle,false,tkpnew,len(tkpprevious),tkpprevious,lbufferneeded)
'forceareboot(nooptions**efilescancelout)
callexitwindowsex(ewx_forceewx_reboot,&hffff)
exitsub
rebootpc_errorhandler:
callraiseerror(csmodname,csprocname,err.number,err.description)
endsub