[API]
LARGE_INTEGER
LUID_AND_ATTRIBUTES
TOKEN_PRIVILEGES
LookupPrivilegeValueA
GetCurrentProcess
AdjustTokenPrivileges
OpenProcessToken
ExitWindowsEx
GetVersion

[CODE]
Public Function ShutdownWindows() As Boolean
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xType2 As TOKEN_PRIVILEGES
  Dim xType3 As TOKEN_PRIVILEGES
  
#If Unicode Then
  If IsUnicode Then
#Else
  If (GetVersion And &H80000000) = 0& Then
#End If
    If OpenProcessToken(GetCurrentProcess(), 40&, xLong2) Then
      xLong1 = LookupPrivilegeValueA(vbNullString, "SeShutdownPrivilege", xType2.Privileges(0).pLuid)
      xType2.PrivilegeCount = 1&
      xType2.Privileges(0).Attributes = 2&
      Call AdjustTokenPrivileges(xLong2, 0&, xType2, LenB(xType3), xType3, xLong1)
      End If
    End If
  ShutDownWindows = Not (ExitWindowsEx(9&, 0&) = 0&)
  End Function
