const //[EXIT CODE]
EI_SYSEXIT_LOGOFF =$00;
EI_SYSEXIT_SHUTDOWN =$01;
EI_SYSEXIT_REBOOT =$02;
EI_SYSEXIT_FORCE =$04;
EI_SYSEXIT_POWEROFF =$08;
EI_SYSEXIT_FORCEIFHUNG =$10;
FUNCTION FkSystemExit(vType:INTEGER;vForce:BOOL):BOOL;
VAR
hToken: THANDLE;
hProc: THANDLE;
iLUID: INT64;
mPriv, mNewPriv: TOKEN_PRIVILEGES;
dLength: DWORD;
dExit
WORD;
BEGIN
IF vForce THEN dExit:=vType+EWX_FORCE ELSE dExit:=vType;
//[WIN9X]
IF Win32Platform=VER_PLATFORM_WIN32_WINDOWS THEN
BEGIN Result:=ExitWindowsEx(dExit,0); END;
//[WINNT]
IF Win32Platform=VER_PLATFORM_WIN32_NT THEN
BEGIN
hProc:=GetCurrentProcess() ;
OpenProcessToken(hProc,TOKEN_ADJUST_PRIVILEGES +TOKEN_QUERY,hToken);
LookupPrivilegeValue('','SeShutdownPrivilege',iLUID);
mPriv.PrivilegeCount:=1;
mPriv.Privileges[0].Attributes:=SE_PRIVILEGE_ENABLED;
mPriv.Privileges[0].Luid :=iLUID;
AdjustTokenPrivileges(hToken,False,mPriv,
(4+(12*mPriv.PrivilegeCount)),
mNewPriv,dLength);
Result:=ExitWindowsEx(dExit,0);
END;
//[END;]
END;
[
][
][
][
][
][
]
用FkSystemExit(EI_SYSEXIT_POWEROFF,TRUE);不要告诉我不行!!!!!!![
][
][
]