ReactOS 0.4.15-dev-7788-g1ad9096
shutdown.c File Reference
#include <advapi32.h>
Include dependency graph for shutdown.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (advapi)
 
BOOL WINAPI AbortSystemShutdownA (LPCSTR lpMachineName)
 
BOOL WINAPI AbortSystemShutdownW (LPCWSTR lpMachineName)
 
BOOL WINAPI InitiateSystemShutdownA (LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown)
 
BOOL WINAPI InitiateSystemShutdownW (LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown)
 
BOOL WINAPI InitiateSystemShutdownExA (LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason)
 
BOOL WINAPI InitiateSystemShutdownExW (LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason)
 
DWORD WINAPI InitiateShutdownW (LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwGracePeriod, DWORD dwShutdownFlags, DWORD dwReason)
 
DWORD WINAPI InitiateShutdownA (LPSTR lpMachineName, LPSTR lpMessage, DWORD dwGracePeriod, DWORD dwShutdownFlags, DWORD dwReason)
 

Function Documentation

◆ AbortSystemShutdownA()

BOOL WINAPI AbortSystemShutdownA ( LPCSTR  lpMachineName)

Definition at line 20 of file shutdown.c.

21{
22 ANSI_STRING MachineNameA;
23 UNICODE_STRING MachineNameW;
25 BOOL rv;
26
27 RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
28 Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
30 {
32 return FALSE;
33 }
34
35 rv = AbortSystemShutdownW(MachineNameW.Buffer);
36 RtlFreeUnicodeString(&MachineNameW);
38 return rv;
39}
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI AbortSystemShutdownW(LPCWSTR lpMachineName)
Definition: shutdown.c:48
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define STATUS_SUCCESS
Definition: shellext.h:65
char * LPSTR
Definition: xmlstorage.h:182

◆ AbortSystemShutdownW()

BOOL WINAPI AbortSystemShutdownW ( LPCWSTR  lpMachineName)

Definition at line 48 of file shutdown.c.

49{
50 DWORD dwError;
51
53 {
54 dwError = BaseAbortSystemShutdown((PREGISTRY_SERVER_NAME)lpMachineName);
55 }
57 {
59 }
61
62 if (dwError != ERROR_SUCCESS)
63 {
64 TRACE("BaseAbortSystemShutdown() failed (Error %lu)\n", dwError);
65 SetLastError(dwError);
66 return FALSE;
67 }
68
69 return TRUE;
70}
ULONG __stdcall BaseAbortSystemShutdown(PREGISTRY_SERVER_NAME ServerName)
Definition: rpcserver.c:429
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RpcEndExcept
Definition: rpc.h:128
#define RpcTryExcept
Definition: rpc.h:126
#define RpcExcept(expr)
Definition: rpc.h:127
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
PWCHAR PREGISTRY_SERVER_NAME
Definition: winreg.idl:10

Referenced by AbortSystemShutdownA(), and wmain().

◆ InitiateShutdownA()

DWORD WINAPI InitiateShutdownA ( LPSTR  lpMachineName,
LPSTR  lpMessage,
DWORD  dwGracePeriod,
DWORD  dwShutdownFlags,
DWORD  dwReason 
)

Definition at line 314 of file shutdown.c.

319{
320 ANSI_STRING MachineNameA, MessageA;
321 UNICODE_STRING MachineNameW, MessageW;
323 INT LastError;
324 DWORD rv;
325
326 MachineNameW.Buffer = NULL;
327 MessageW.Buffer = NULL;
328
329 if (lpMachineName)
330 {
331 RtlInitAnsiString(&MachineNameA, lpMachineName);
332 Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
333 if (STATUS_SUCCESS != Status)
334 {
335 if(MachineNameW.Buffer)
336 RtlFreeUnicodeString(&MachineNameW);
337
339 return FALSE;
340 }
341 }
342
343 if (lpMessage)
344 {
345 RtlInitAnsiString(&MessageA, lpMessage);
346 Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
347 if (STATUS_SUCCESS != Status)
348 {
349 if (MessageW.Buffer)
350 RtlFreeUnicodeString(&MessageW);
351
353 return FALSE;
354 }
355 }
356
357 rv = InitiateShutdownW(MachineNameW.Buffer,
358 MessageW.Buffer,
359 dwGracePeriod,
360 dwShutdownFlags,
361 dwReason);
362 LastError = GetLastError();
363
364 /* Clear the values of both strings */
365 if (lpMachineName)
366 RtlFreeUnicodeString(&MachineNameW);
367
368 if (lpMessage)
369 RtlFreeUnicodeString(&MessageW);
370
371 SetLastError(LastError);
372 return rv;
373}
DWORD dwReason
Definition: misc.cpp:154
#define NULL
Definition: types.h:112
DWORD WINAPI InitiateShutdownW(LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwGracePeriod, DWORD dwShutdownFlags, DWORD dwReason)
Definition: shutdown.c:298
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ InitiateShutdownW()

DWORD WINAPI InitiateShutdownW ( LPWSTR  lpMachineName,
LPWSTR  lpMessage,
DWORD  dwGracePeriod,
DWORD  dwShutdownFlags,
DWORD  dwReason 
)

Definition at line 298 of file shutdown.c.

303{
305 return ERROR_SUCCESS;
306}
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by InitiateShutdownA().

◆ InitiateSystemShutdownA()

BOOL WINAPI InitiateSystemShutdownA ( LPSTR  lpMachineName,
LPSTR  lpMessage,
DWORD  dwTimeout,
BOOL  bForceAppsClosed,
BOOL  bRebootAfterShutdown 
)

Definition at line 80 of file shutdown.c.

85{
86 ANSI_STRING MachineNameA, MessageA;
87 UNICODE_STRING MachineNameW, MessageW;
89 BOOL res;
90
91 MachineNameW.Buffer = NULL;
92 MessageW.Buffer = NULL;
93
94 if (lpMachineName)
95 {
96 RtlInitAnsiString(&MachineNameA, lpMachineName);
97 Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
99 {
100 if(MachineNameW.Buffer)
101 RtlFreeUnicodeString(&MachineNameW);
102
104 return FALSE;
105 }
106 }
107
108 if (lpMessage)
109 {
110 RtlInitAnsiString(&MessageA, lpMessage);
111 Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
112 if (STATUS_SUCCESS != Status)
113 {
114 if (MessageW.Buffer)
115 RtlFreeUnicodeString(&MessageW);
116
118 return FALSE;
119 }
120 }
121
122 res = InitiateSystemShutdownW(MachineNameW.Buffer,
123 MessageW.Buffer,
124 dwTimeout,
125 bForceAppsClosed,
126 bRebootAfterShutdown);
127
128 /* Clear the values of both strings */
129 if (lpMachineName)
130 RtlFreeUnicodeString(&MachineNameW);
131
132 if (lpMessage)
133 RtlFreeUnicodeString(&MessageW);
134
135 return res;
136}
BOOL WINAPI InitiateSystemShutdownW(LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown)
Definition: shutdown.c:145
GLuint res
Definition: glext.h:9613
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6081

◆ InitiateSystemShutdownExA()

BOOL WINAPI InitiateSystemShutdownExA ( LPSTR  lpMachineName,
LPSTR  lpMessage,
DWORD  dwTimeout,
BOOL  bForceAppsClosed,
BOOL  bRebootAfterShutdown,
DWORD  dwReason 
)

Definition at line 187 of file shutdown.c.

193{
194 ANSI_STRING MachineNameA, MessageA;
195 UNICODE_STRING MachineNameW, MessageW;
197 BOOL res;
198
199 MachineNameW.Buffer = NULL;
200 MessageW.Buffer = NULL;
201
202 if (lpMachineName)
203 {
204 RtlInitAnsiString(&MachineNameA, lpMachineName);
205 Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
206 if (STATUS_SUCCESS != Status)
207 {
208 if(MachineNameW.Buffer)
209 RtlFreeUnicodeString(&MachineNameW);
210
212 return FALSE;
213 }
214 }
215
216 if (lpMessage)
217 {
218 RtlInitAnsiString(&MessageA, lpMessage);
219 Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
220 if (STATUS_SUCCESS != Status)
221 {
222 if (MessageW.Buffer)
223 RtlFreeUnicodeString(&MessageW);
224
226 return FALSE;
227 }
228 }
229
230 res = InitiateSystemShutdownExW(MachineNameW.Buffer,
231 MessageW.Buffer,
232 dwTimeout,
233 bForceAppsClosed,
234 bRebootAfterShutdown,
235 dwReason);
236
237 /* Clear the values of both strings */
238 if (lpMachineName)
239 RtlFreeUnicodeString(&MachineNameW);
240
241 if (lpMessage)
242 RtlFreeUnicodeString(&MessageW);
243
244 return res;
245}
BOOL WINAPI InitiateSystemShutdownExW(LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason)
Definition: shutdown.c:254

◆ InitiateSystemShutdownExW()

BOOL WINAPI InitiateSystemShutdownExW ( LPWSTR  lpMachineName,
LPWSTR  lpMessage,
DWORD  dwTimeout,
BOOL  bForceAppsClosed,
BOOL  bRebootAfterShutdown,
DWORD  dwReason 
)

Definition at line 254 of file shutdown.c.

260{
262 DWORD dwError;
263
264 RtlInitUnicodeString(&Message, lpMessage);
265
267 {
270 dwTimeout,
271 bForceAppsClosed,
272 bRebootAfterShutdown,
273 dwReason);
274 }
276 {
277 dwError = RpcExceptionCode();
278 }
280
281 if (dwError != ERROR_SUCCESS)
282 {
283 TRACE("BaseInitiateSystemShutdownEx() failed (Error %lu)\n", dwError);
284 SetLastError(dwError);
285 return FALSE;
286 }
287
288 return TRUE;
289}
ULONG __stdcall BaseInitiateSystemShutdownEx(PREGISTRY_SERVER_NAME ServerName, PRPC_UNICODE_STRING lpMessage, ULONG dwTimeout, BOOLEAN bForceAppsClosed, BOOLEAN bRebootAfterShutdown, ULONG dwReason)
Definition: rpcserver.c:494
static const WCHAR Message[]
Definition: register.c:74
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by InitiateSystemShutdownExA(), and wmain().

◆ InitiateSystemShutdownW()

BOOL WINAPI InitiateSystemShutdownW ( LPWSTR  lpMachineName,
LPWSTR  lpMessage,
DWORD  dwTimeout,
BOOL  bForceAppsClosed,
BOOL  bRebootAfterShutdown 
)

Definition at line 145 of file shutdown.c.

150{
152 DWORD dwError;
153
154 RtlInitUnicodeString(&Message, lpMessage);
155
157 {
158 dwError = BaseInitiateSystemShutdown((PREGISTRY_SERVER_NAME)lpMachineName,
160 dwTimeout,
161 bForceAppsClosed,
162 bRebootAfterShutdown);
163 }
165 {
167 }
169
170 if (dwError != ERROR_SUCCESS)
171 {
172 TRACE("BaseInitiateSystemShutdown() failed (Error %lu)\n", dwError);
173 SetLastError(dwError);
174 return FALSE;
175 }
176
177 return TRUE;
178}
ULONG __stdcall BaseInitiateSystemShutdown(PREGISTRY_SERVER_NAME ServerName, PRPC_UNICODE_STRING lpMessage, ULONG dwTimeout, BOOLEAN bForceAppsClosed, BOOLEAN bRebootAfterShutdown)
Definition: rpcserver.c:409

Referenced by InitiateSystemShutdownA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( advapi  )