X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fdll%2Fwin32%2Fadvapi32%2Fmisc%2Fshutdown.c;h=494c7aaaf310078ff0f6b079d57c9bf5137b5813;hp=da1ab65c2e306a376e6d48eca3c358a87b5661cb;hb=aa46f44e5003b3f38d4bd7c2618769a2e795b468;hpb=8c33fab48bc7206787c38a456e560187bfb43dfc diff --git a/reactos/dll/win32/advapi32/misc/shutdown.c b/reactos/dll/win32/advapi32/misc/shutdown.c index da1ab65c2e3..494c7aaaf31 100644 --- a/reactos/dll/win32/advapi32/misc/shutdown.c +++ b/reactos/dll/win32/advapi32/misc/shutdown.c @@ -43,10 +43,12 @@ AbortSystemShutdownA(LPCSTR lpMachineName) RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName); Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE); - if (STATUS_SUCCESS != Status) { + if (STATUS_SUCCESS != Status) + { SetLastError(RtlNtStatusToDosError(Status)); return FALSE; } + rv = AbortSystemShutdownW(MachineNameW.Buffer); RtlFreeUnicodeString(&MachineNameW); SetLastError(ERROR_SUCCESS); @@ -60,23 +62,26 @@ AbortSystemShutdownA(LPCSTR lpMachineName) * @unimplemented */ BOOL STDCALL -InitiateSystemShutdownW( - LPWSTR lpMachineName, - LPWSTR lpMessage, - DWORD dwTimeout, - BOOL bForceAppsClosed, - BOOL bRebootAfterShutdown) +InitiateSystemShutdownW(LPWSTR lpMachineName, + LPWSTR lpMessage, + DWORD dwTimeout, + BOOL bForceAppsClosed, + BOOL bRebootAfterShutdown) { SHUTDOWN_ACTION Action = ShutdownNoReboot; - NTSTATUS Status; + NTSTATUS Status; - if (lpMachineName) { - /* FIXME: remote machine shutdown not supported yet */ + if (lpMachineName) + { + /* FIXME: remote machine shutdown not supported yet */ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } - if (dwTimeout) { + + if (dwTimeout) + { } + Status = NtShutdownSystem(Action); SetLastError(RtlNtStatusToDosError(Status)); return FALSE; @@ -90,12 +95,11 @@ InitiateSystemShutdownW( */ BOOL STDCALL -InitiateSystemShutdownA( - LPSTR lpMachineName, - LPSTR lpMessage, - DWORD dwTimeout, - BOOL bForceAppsClosed, - BOOL bRebootAfterShutdown) +InitiateSystemShutdownA(LPSTR lpMachineName, + LPSTR lpMessage, + DWORD dwTimeout, + BOOL bForceAppsClosed, + BOOL bRebootAfterShutdown) { ANSI_STRING MachineNameA; ANSI_STRING MessageA; @@ -105,38 +109,49 @@ InitiateSystemShutdownA( INT LastError; BOOL rv; - if (lpMachineName) { + if (lpMachineName) + { RtlInitAnsiString(&MachineNameA, lpMachineName); Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE); - if (STATUS_SUCCESS != Status) { + if (STATUS_SUCCESS != Status) + { SetLastError(RtlNtStatusToDosError(Status)); return FALSE; } } - if (lpMessage) { + + if (lpMessage) + { RtlInitAnsiString(&MessageA, lpMessage); Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE); - if (STATUS_SUCCESS != Status) { - if (MachineNameW.Length) { + if (STATUS_SUCCESS != Status) + { + if (MachineNameW.Length) + { RtlFreeUnicodeString(&MachineNameW); } + SetLastError(RtlNtStatusToDosError(Status)); return FALSE; } } - rv = InitiateSystemShutdownW( - MachineNameW.Buffer, - MessageW.Buffer, - dwTimeout, - bForceAppsClosed, - bRebootAfterShutdown); + + rv = InitiateSystemShutdownW(MachineNameW.Buffer, + MessageW.Buffer, + dwTimeout, + bForceAppsClosed, + bRebootAfterShutdown); LastError = GetLastError(); - if (lpMachineName) { + if (lpMachineName) + { RtlFreeUnicodeString(&MachineNameW); } - if (lpMessage) { + + if (lpMessage) + { RtlFreeUnicodeString(&MessageW); } + SetLastError(LastError); return rv; } @@ -146,9 +161,13 @@ InitiateSystemShutdownA( * * see InitiateSystemShutdownExA */ -BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage, - DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, - DWORD dwReason) +BOOL WINAPI +InitiateSystemShutdownExW(LPWSTR lpMachineName, + LPWSTR lpMessage, + DWORD dwTimeout, + BOOL bForceAppsClosed, + BOOL bRebootAfterShutdown, + DWORD dwReason) { UNIMPLEMENTED; return TRUE;