Try the code here which has these commands:
Standby
Hibernate
Shutdown
Restart
LogOff
Strict
Framework BRL.Blitz
Import brl.retro
Import "-lkernel32"
Import "-ladvapi32"
Extern "Win32"
'advapi32
Function OpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle:Byte Ptr)
Function LookupPrivilegeValue(lpSystemName$z, lpName$z, lpLuid:Byte Ptr) = "LookupPrivilegeValueA@12"
Function AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges, NewState:Byte Ptr,..
BufferLength, PreviousState:Byte Ptr, ReturnLength:Byte Ptr)
'kernel32
Function GetVersion()
Function GetCurrentProcess()
Function SetSystemPowerState(fSuspend, fForce)
Function ExitWindowsEx(uFlags%,dwReserved%=0)
Function GetLastError()
End Extern
'Standby
'Hibernate
'Shutdown
'Restart
'LogOff
End
Function Standby(forced%=False)
If EnableShutdownPrivileges()
SetSystemPowerState(True, forced)
EndIf
End Function
Function Hibernate(forced%=False)
If EnableShutdownPrivileges()
SetSystemPowerState(False, forced)
EndIf
End Function
Function Shutdown(forced%=False)
If EnableShutdownPrivileges()
ExitWindowsEx $8 | $4 * forced
EndIf
End Function
Function Restart(forced%=False)
If EnableShutdownPrivileges()
ExitWindowsEx $2 | $4 * forced
EndIf
End Function
Function LogOff(forced%=False)
If EnableShutdownPrivileges()
ExitWindowsEx $0 | $4 * forced
EndIf
End Function
Function EnableShutdownPrivileges%()
Const TOKEN_ADJUST_PRIVILEGES% = $20
Const TOKEN_QUERY% = $8
Const SE_PRIVILEGE_ENABLED% = $2
Local tokenPrivilege%[4]
If LookupPrivilegeValue(Null, "SeShutdownPrivilege", Byte Ptr(tokenPrivilege)+4)
Local hProc% = GetCurrentProcess() ' -1
Local hToken%
If OpenProcessToken(hProc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, Varptr(hToken))
tokenPrivilege[0] = 1
tokenPrivilege[3] = SE_PRIVILEGE_ENABLED
If AdjustTokenPrivileges(hToken, False, Byte Ptr(tokenPrivilege), Null, Null, Null)
Return True
EndIf
EndIf
EndIf
End Function