3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/advapi32/misc/shutdown.c
6 * PURPOSE: System shutdown functions
7 * PROGRAMMER: Emanuele Aliberti
14 #include <ddk/ntddk.h>
18 /**********************************************************************
19 * AbortSystemShutdownW
29 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
34 /**********************************************************************
35 * AbortSystemShutdownA
43 ANSI_STRING MachineNameA;
44 UNICODE_STRING MachineNameW;
52 Status = RtlAnsiStringToUnicodeString(
57 if (STATUS_SUCCESS != Status)
59 SetLastError(RtlNtStatusToDosError(Status));
62 rv = AbortSystemShutdownW(
71 SetLastError(ERROR_SUCCESS);
76 /**********************************************************************
77 * InitiateSystemShutdownW
81 InitiateSystemShutdownW(
85 BOOL bForceAppsClosed,
86 BOOL bRebootAfterShutdown
89 SHUTDOWN_ACTION Action = ShutdownNoReboot;
94 /* FIXME: remote machine shutdown not supported yet */
95 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
101 Status = NtShutdownSystem(Action);
102 SetLastError(RtlNtStatusToDosError(Status));
107 /**********************************************************************
108 * InitiateSystemShutdownA
112 InitiateSystemShutdownA(
116 BOOL bForceAppsClosed,
117 BOOL bRebootAfterShutdown
120 ANSI_STRING MachineNameA;
121 ANSI_STRING MessageA;
122 UNICODE_STRING MachineNameW;
123 UNICODE_STRING MessageW;
134 Status = RtlAnsiStringToUnicodeString(
139 if (STATUS_SUCCESS != Status)
141 RtlFreeAnsiString(&MachineNameA);
142 SetLastError(RtlNtStatusToDosError(Status));
152 Status = RtlAnsiStringToUnicodeString(
157 if (STATUS_SUCCESS != Status)
159 if (MachineNameW.Length)
161 RtlFreeAnsiString(&MachineNameA);
162 RtlFreeUnicodeString(&MachineNameW);
164 RtlFreeAnsiString(&MessageA);
165 SetLastError(RtlNtStatusToDosError(Status));
169 rv = InitiateSystemShutdownW(
176 LastError = GetLastError();
179 RtlFreeAnsiString(&MachineNameA);
180 RtlFreeUnicodeString(&MachineNameW);
184 RtlFreeAnsiString(&MessageA);
185 RtlFreeUnicodeString(&MessageW);
187 SetLastError(LastError);