ReactOS 0.4.15-dev-7842-g558ab78
shutdown.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VOID ShutDown_StandBy (VOID)
 
VOID ShutDown_Hibernate (VOID)
 
VOID ShutDown_PowerOff (VOID)
 
VOID ShutDown_Reboot (VOID)
 
VOID ShutDown_LogOffUser (VOID)
 
VOID ShutDown_SwitchUser (VOID)
 
VOID ShutDown_LockComputer (VOID)
 
VOID ShutDown_Disconnect (VOID)
 
VOID ShutDown_EjectComputer (VOID)
 

Function Documentation

◆ ShutDown_Disconnect()

VOID ShutDown_Disconnect ( VOID  )

Definition at line 174 of file shutdown.c.

175{
176}

Referenced by TaskManagerWndProc().

◆ ShutDown_EjectComputer()

VOID ShutDown_EjectComputer ( VOID  )

Definition at line 179 of file shutdown.c.

180{
181}

Referenced by TaskManagerWndProc().

◆ ShutDown_Hibernate()

VOID ShutDown_Hibernate ( VOID  )

Definition at line 73 of file shutdown.c.

74{
76
78 {
80 return;
81 }
82
83#ifdef NT_INITIATE_POWERACTION_IMPLEMENTED
86 0, FALSE);
87#else
90 0);
91#endif
92
93 if (!NT_SUCCESS(Status))
95
97}
LONG NTSTATUS
Definition: precomp.h:26
static DWORD EnablePrivilege(LPCWSTR lpszPrivilegeName, BOOL bEnablePrivilege)
Definition: shutdown.c:142
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID ShowWin32Error(IN DWORD dwError)
Definition: eventvwr.c:140
Status
Definition: gdiplustypes.h:25
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSTATUS NTAPI NtInitiatePowerAction(IN POWER_ACTION SystemAction, IN SYSTEM_POWER_STATE MinSystemState, IN ULONG Flags, IN BOOLEAN Asynchronous)
Definition: power.c:778
NTSTATUS NTAPI NtSetSystemPowerState(IN POWER_ACTION SystemAction, IN SYSTEM_POWER_STATE MinSystemState, IN ULONG Flags)
Definition: power.c:1007
@ PowerSystemHibernate
Definition: ntpoapi.h:40
@ PowerActionHibernate
Definition: ntpoapi.h:126
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384

Referenced by TaskManagerWndProc().

◆ ShutDown_LockComputer()

VOID ShutDown_LockComputer ( VOID  )

Definition at line 167 of file shutdown.c.

168{
169 if (!LockWorkStation())
171}
EXTINLINE BOOL WINAPI LockWorkStation(VOID)
Definition: ntwrapper.h:82

Referenced by TaskManagerWndProc().

◆ ShutDown_LogOffUser()

VOID ShutDown_LogOffUser ( VOID  )

Definition at line 155 of file shutdown.c.

156{
157 if (!ExitWindowsEx(EWX_LOGOFF, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER))
159}
#define EWX_LOGOFF
Definition: winuser.h:636
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)

Referenced by TaskManagerWndProc().

◆ ShutDown_PowerOff()

VOID ShutDown_PowerOff ( VOID  )

Definition at line 100 of file shutdown.c.

101{
102 /* Trick: on Windows, pressing the CTRL key forces shutdown via NT API */
103 BOOL ForceShutdown = !!(GetKeyState(VK_CONTROL) & 0x8000);
104
106 {
108 return;
109 }
110
111 if (ForceShutdown)
112 {
114 if (!NT_SUCCESS(Status))
116 }
117 else
118 {
119 // The choice of EWX_SHUTDOWN or EWX_POWEROFF may be done with NtPowerInformation
120 if (!ExitWindowsEx(EWX_POWEROFF /* EWX_SHUTDOWN */, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER))
122 }
123
125}
unsigned int BOOL
Definition: ntddk_ex.h:94
@ ShutdownPowerOff
Definition: extypes.h:178
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
#define EWX_POWEROFF
Definition: winuser.h:637
#define VK_CONTROL
Definition: winuser.h:2203
SHORT WINAPI GetKeyState(_In_ int)

Referenced by TaskManagerWndProc().

◆ ShutDown_Reboot()

VOID ShutDown_Reboot ( VOID  )

Definition at line 128 of file shutdown.c.

129{
130 /* Trick: on Windows, pressing the CTRL key forces reboot via NT API */
131 BOOL ForceReboot = !!(GetKeyState(VK_CONTROL) & 0x8000);
132
134 {
136 return;
137 }
138
139 if (ForceReboot)
140 {
142 if (!NT_SUCCESS(Status))
144 }
145 else
146 {
147 if (!ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER))
149 }
150
152}
@ ShutdownReboot
Definition: extypes.h:177
#define EWX_REBOOT
Definition: winuser.h:638

Referenced by TaskManagerWndProc().

◆ ShutDown_StandBy()

VOID ShutDown_StandBy ( VOID  )

Definition at line 46 of file shutdown.c.

47{
49
51 {
53 return;
54 }
55
56#ifdef NT_INITIATE_POWERACTION_IMPLEMENTED
59 0, FALSE);
60#else
63 0);
64#endif
65
66 if (!NT_SUCCESS(Status))
68
70}
@ PowerSystemSleeping1
Definition: ntpoapi.h:37
@ PowerActionSleep
Definition: ntpoapi.h:125

Referenced by TaskManagerWndProc().

◆ ShutDown_SwitchUser()

VOID ShutDown_SwitchUser ( VOID  )

Definition at line 162 of file shutdown.c.

163{
164}

Referenced by TaskManagerWndProc().