Desktop Functions: Smart Device Functions:
|
Search Results for "ShutDown" in [All]Structures
''' this entrypoint is called during process initialization and shutdown and
' entrypoint is called during process initialization and shutdown and during thread creations/
' entrypoint is called during process initialization and shutdown and during thread creations/
PowerActionShutdown, // Shutdown.
PowerActionShutdownReset, // Shutdown and reset.
PowerActionShutdownOff, // Shutdown and power off.
POWER_USER_NOTIFY_SHUTDOWN = 0x00000010, // Indicates a power action of shutdown/off.
PowerActionShutdown ' Shutdown.
PowerActionShutdownReset ' Shutdown and reset.
PowerActionShutdownOff ' Shutdown and power off.
POWER_USER_NOTIFY_SHUTDOWN = &H10 ' Indicates a power action of shutdown/off.
SERVICE_ACCEPT_PRESHUTDOWN = 0x00000100,
SERVICE_ACCEPT_SHUTDOWN = 0x00000004,
PowerSystemShutdown = 6,
PowerSystemShutdown = 6 aygshell
EWX_SHUTDOWN = 1,
Specifies the type of shutdown. This parameter must be one of the following values: Available only at Windows Mobile 5.0 or later. The ExitWindowsEx function returns as soon as it has initiated the shutdown. The shutdown then proceeds asynchronously. Because the function executes asynchronously, a nonzero return value indicates that the shutdown has been initiated. It does not indicate whether the shutdown will succeed. It is possible that the system, the user, or another application will abort the shutdown. user32
static extern int CancelShutdown();
Declare Function CancelShutdown Lib "user32.dll" () As Integer
System.Diagnostics.Process.Start("Shutdown", "-a"); One does not simply shutdown a computer. CancelShutdown(); 7: EndTask
static extern bool EndTask(IntPtr hWnd, bool fShutDown, bool fForce);
Private Shared Function EndTask(hWnd As IntPtr, fShutDown As Boolean, fForce As Boolean) As Boolean
public static extern bool EndTask(IntPtr hWnd, bool fShutDown,bool fForce);
// fShutDown = true will kill the window instantly
// fShutDown = false will show the message box before closing for Saving Changes
Public Shared Function EndTask(hWnd As IntPtr, fShutDown As Boolean, fForce As Boolean) As Boolean
static extern bool ExitWindowsEx(ExitWindows uFlags, ShutdownReason dwReason);
ByVal dwReason As ShutdownReason) As <MarshalAs(UnmanagedType.Bool)> Boolean
To shut down or restart the system on NT/2K/XP, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.
ExitWindowsEx(ExitWindows.LogOff, ShutdownReason.MajorOther | ShutdownReason.MinorOther); Changed the sample code Reason parameter from "&" to "ShutdownReason.MajorOther | ShutdownReason.MinorOther". Amperstand (&) is the binary AND condition, and the values ANDed together would be zero. The intended condition is that the flags be ORed together. (|)
static extern bool ShutdownBlockReasonCreate(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string reason);
Declare Function ShutdownBlockReasonCreate Lib "user32.dll" (ByVal hWnd As IntPtr, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal reason As String) As Boolean reason - The reason the application must block system shutdown.
IntPtr handleForShutdownBlocker = shutdownBlockingForm.Handle;
if (!ShutdownBlockReasonCreate(handleForShutdownBlocker, UIMessages.GetString("ShutdownBlockReason"))) {
log.Error(string.Format("Failed calling ShutdownBlockReasonCreate. Error code: {0}, blocking form handle: {1}", error, handleForShutdownBlocker));
static extern bool ShutdownBlockReasonDestroy(IntPtr hWnd);
Declare Function ShutdownBlockReasonDestroy Lib "user32.dll" (hWnd As IntPtr) As Boolean powrprof
static extern bool IsPwrShutdownAllowed();
Declare Function IsPwrShutdownAllowed Lib "powrprof.dll" () As Boolean ws2_3212: closesocket
//you may add sck.Shutdown(SocketShutdown.Both); 13: shutdown
public static extern int shutdown(IntPtr s, ShutDownFlags how);
Declare Function shutdown Lib "ws2_32.dll" (TODO) As TODO
public enum ShutDownFlags : int kernel3214: ConsoleFunctions
CTRL_SHUTDOWN_EVENT
private void shutdownToolStripMenuItem_Click(object sender, EventArgs e) 17: HandlerRoutine
CTRL_SHUTDOWN_EVENT For a Windows application that is being updated, the last opportunity to call this function is while processing the WM_QUERYENDSESSION message. For a console application that is being updated, the registration must occur before the installer tries to shutdown the application (you need to keep the registration current; you cannot call this function when handling the CTRL_C_EVENT notification). Note that for an application to be restarted when the update requires a computer restart, the installer must call the ExitWindowsEx function with the EWX_RESTARTAPPS flag set or the InitiateShutdown function with the SHUTDOWN_RESTARTAPPS flag set.
CTRL_SHUTDOWN_EVENT
CTRL_SHUTDOWN_EVENT coredll20: lineShutDown
advapi32
Privileges.EnablePrivilege(SecurityEntity.SE_SHUTDOWN_NAME);
case SecurityEntity.SE_REMOTE_SHUTDOWN_NAME:
return "SeRemoteShutdownPrivilege";
case SecurityEntity.SE_SHUTDOWN_NAME:
return "SeShutdownPrivilege";
SE_SHUTDOWN_NAME,
SE_REMOTE_SHUTDOWN_NAME,
'This routine enables the Shutdown privilege for the current process,
Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege"
Public Sub AcquireShutdownPrivilege()
'Get the LUID that corresponds to the Shutdown privilege, if it exists.
Dim luid_Shutdown As LUID
If Not LookupPrivilegeValue(Nothing, SE_SHUTDOWN_NAME, luid_Shutdown) Then
'Set up a LUID_AND_ATTRIBUTES structure containing the Shutdown privilege, marked as enabled.
luaAttr.Luid = luid_Shutdown
'Set up a TOKEN_PRIVILEGES structure containing only the shutdown privilege.
7 SERVICE_CONFIG_PRESHUTDOWN_INFO
7 SERVICE_CONFIG_PRESHUTDOWN_INFO 25: ControlService
SHUTDOWN = 0x00000005,
SHUTDOWN = 0x00000004,
SHUTDOWN = &H5
SHUTDOWN = &H4 26: InitiateShutdown
static extern UInt32 InitiateShutdown(
UInt32 dwShutdownFlags,
' InitiateShutdown
Friend Shared Function InitiateShutdown( _
ByVal dwShutdownFlags As UInt32, _
' used with InitiateShutdown
Friend Enum ShutdownFlags As UInt32
SHUTDOWN_FORCE_OTHERS = &H1 ' all sessions are forcefully logged off
SHUTDOWN_FORCE_SELF = &H2 ' the originating session is forcefully logged off
SHUTDOWN_RESTART = &H4 ' shut down and reboot
SHUTDOWN_POWEROFF = &H8 ' shut down and power down
SHUTDOWN_NOREBOOT = &H10 ' shut down but don't power down nor reboot
SHUTDOWN_GRACE_OVERRIDE = &H20 ' override the grace period (shut down immediately)
SHUTDOWN_INSTALL_UPDATES = &H40 ' install pending Windows updates before starting the shutdown
SHUTDOWN_RESTARTAPPS = &H80 ' restart applications that have been registered for restart using the RegisterApplicationRestart function
SHUTDOWN_HYBRID = &H200 ' for Win8 and above: perform a hybrid shutdown (log out the users and hibernate the kernel)
public static extern bool InitiateSystemShutdownEx(
bool bRebootAfterShutdown,
ShutdownReason dwReason);
public enum ShutdownReason : uint
Public Function InitiateSystemShutdownEx( _
<MarshalAs(UnmanagedType.Bool)> ByVal bRebootAfterShutdown As Boolean, _
ByVal ShutdownReason As ShutdownReason) As <MarshalAs(UnmanagedType.Bool)> Boolean
Public Enum ShutdownReason As UInteger dwReason: The ShutdownReason enum can be used for this parameter.
public static extern bool InitiateSystemShutdownEx(
bool bRebootAfterShutdown,
ShutdownReason dwReason);
public enum ShutdownReason : uint
Public Function InitiateSystemShutdownEx( _
<MarshalAs(UnmanagedType.Bool)> ByVal bRebootAfterShutdown As Boolean, _
ByVal ShutdownReason As ShutdownReason) As <MarshalAs(UnmanagedType.Bool)> Boolean
Public Enum ShutdownReason As UInteger dwReason: The ShutdownReason enum can be used for this parameter.
public const string SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege";
public const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
if (!LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, out tkp.Privileges[0].Luid)) 30: ShutDown
Enums31: ExitWindows
32: HRESULT
///A system shutdown is in progress.
[Description("A system shutdown is in progress.")]
public const int SEC_E_SHUTDOWN_IN_PROGRESS = unchecked((int)0x8009033F);
public const int SCARD_P_SHUTDOWN = unchecked((int)0x80100018);
'''A system shutdown is in progress.
<Description("A system shutdown is in progress.")> _
Public Const SEC_E_SHUTDOWN_IN_PROGRESS As Integer = CInt(&H8009033fUI)
Public Const SCARD_P_SHUTDOWN As Integer = CInt(&H80100018UI) 33: POWER_ACTION
PowerActionShutdownPowerActionShutdown,
PowerActionShutdownResetPowerActionShutdownReset,
PowerActionShutdownOffPowerActionShutdownOff, 34: RM_APP_STATUS
/// Shutdown action masked by filer.
RmStatusShutdownMasked = 0x40, 35: ShutdownReason
36: SystemPowerState
PowerSystemShutdownPowerSystemShutdown = 6, 37: WindowsMessages
/// The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
'''The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero. After processing this message the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
''' system shutdown functions. Constants38: EWX
private const UInt32 EWX_SHUTDOWN = 0x00000001; 39: NERR_
public const int UPSShutdownFailed = 2484; 40: WINERROR
/// A system shutdown is in progress.
public const int ERROR_SHUTDOWN_IN_PROGRESS = 1115;
/// Unable to abort the system shutdown because no shutdown was in progress.
public const int ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116;
public const int ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255;
public const int ERROR_SHUTDOWN_CLUSTER = 5008;
/// The membership engine requested shutdown of the cluster service on this node.
public const int ERROR_DS_DRA_SHUTDOWN = 8463;
/// Error Status: 0x%2. Please click OK to shutdown the system. You can use the recovery console to diagnose the system further.
/// Error Status: 0x%2. Please click OK to shutdown the system. You can use the recovery console to diagnose the system further.
/// The operation cannot be performed because this zone is shutdown.
public const int DNS_ERROR_ZONE_IS_SHUTDOWN = 9621;
/// A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call.
public const int WSAESHUTDOWN = 10058;
/// Returned by WSARecv or WSARecvFrom to indicate the remote party has initiated a graceful shutdown sequence.
/// A system shutdown is in progress.
public const int SEC_E_SHUTDOWN_IN_PROGRESS = (int)(0x8009033F - 0x100000000);
public const int SCARD_P_SHUTDOWN = (int)(0x80100018 - 0x100000000); 41: WINNT
private const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
Private Const SE_SHUTDOWN_NAME As String = "SeShutdownPrivilege" 42: WM
wtsapi32
public static extern int WTSShutdownSystem(IntPtr ServerHandle, long ShutdownFlags);
Private Shared Function WTSShutdownSystem(ByVal hServer As IntPtr, ByVal ShutdownFlags As Long) As Integer private const long WTS_WSD_SHUTDOWN = 0x00000002; public static extern int WTSShutdownSystem(IntPtr ServerHandle, long ShutdownFlags);
WTSShutdownSystem(new IntPtr(0), WTS_WSD_REBOOT); ntdllSE_SHUTDOWN_PRIVILEGE = 19 gdiplus45: GdiplusShutdown
static extern void GdiplusShutdown(ref IntPtr token);
Declare Function GdiplusShutdown Lib "gdiplus.dll" (TODO) As TODO 46: GdiplusStartup
|