[WINLOGON] Minor formatting only.

Add also original author's name (from original PR #458).
This commit is contained in:
Hermès Bélusca-Maïto 2020-10-04 01:01:46 +02:00
parent d86301f72b
commit be7bfc813d
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 28 additions and 32 deletions

View file

@ -3,7 +3,8 @@
* PROJECT: ReactOS Winlogon * PROJECT: ReactOS Winlogon
* FILE: base/system/winlogon/shutdown.c * FILE: base/system/winlogon/shutdown.c
* PURPOSE: System shutdown dialog * PURPOSE: System shutdown dialog
* PROGRAMMERS: alpha5056 <alpha5056@users.noreply.github.com> * PROGRAMMERS: Edward Bronsten <tanki.alpha5056@gmail.com>
* Eric Kohl
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
@ -19,7 +20,6 @@
#define SECONDS_PER_DAY 86400 #define SECONDS_PER_DAY 86400
#define SECONDS_PER_DECADE 315360000 #define SECONDS_PER_DECADE 315360000
/* STRUCTS *******************************************************************/ /* STRUCTS *******************************************************************/
typedef struct _SYS_SHUTDOWN_PARAMS typedef struct _SYS_SHUTDOWN_PARAMS
@ -33,12 +33,10 @@ typedef struct _SYS_SHUTDOWN_PARAMS
BOOLEAN bShuttingDown; BOOLEAN bShuttingDown;
} SYS_SHUTDOWN_PARAMS, *PSYS_SHUTDOWN_PARAMS; } SYS_SHUTDOWN_PARAMS, *PSYS_SHUTDOWN_PARAMS;
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
SYS_SHUTDOWN_PARAMS g_ShutdownParams; SYS_SHUTDOWN_PARAMS g_ShutdownParams;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static static
@ -70,12 +68,11 @@ DoSystemShutdown(
return Success; return Success;
} }
static static
VOID VOID
OnTimer( OnTimer(
HWND hwndDlg, IN HWND hwndDlg,
PSYS_SHUTDOWN_PARAMS pShutdownParams) IN PSYS_SHUTDOWN_PARAMS pShutdownParams)
{ {
WCHAR szFormatBuffer[32]; WCHAR szFormatBuffer[32];
WCHAR szBuffer[32]; WCHAR szBuffer[32];
@ -120,15 +117,14 @@ OnTimer(
pShutdownParams->dwTimeout--; pShutdownParams->dwTimeout--;
} }
static static
INT_PTR INT_PTR
CALLBACK CALLBACK
ShutdownDialogProc( ShutdownDialogProc(
HWND hwndDlg, IN HWND hwndDlg,
UINT uMsg, IN UINT uMsg,
WPARAM wParam, IN WPARAM wParam,
LPARAM lParam) IN LPARAM lParam)
{ {
PSYS_SHUTDOWN_PARAMS pShutdownParams; PSYS_SHUTDOWN_PARAMS pShutdownParams;
@ -172,12 +168,11 @@ ShutdownDialogProc(
return TRUE; return TRUE;
} }
static static
DWORD DWORD
WINAPI WINAPI
InitiateSystemShutdownThread( InitiateSystemShutdownThread(
LPVOID lpParameter) IN LPVOID lpParameter)
{ {
PSYS_SHUTDOWN_PARAMS pShutdownParams; PSYS_SHUTDOWN_PARAMS pShutdownParams;
INT_PTR status; INT_PTR status;
@ -213,14 +208,13 @@ TerminateSystemShutdown(VOID)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
DWORD DWORD
StartSystemShutdown( StartSystemShutdown(
PUNICODE_STRING lpMessage, IN PUNICODE_STRING pMessage,
ULONG dwTimeout, IN ULONG dwTimeout,
BOOLEAN bForceAppsClosed, IN BOOLEAN bForceAppsClosed,
BOOLEAN bRebootAfterShutdown, IN BOOLEAN bRebootAfterShutdown,
ULONG dwReason) IN ULONG dwReason)
{ {
HANDLE hThread; HANDLE hThread;
@ -231,11 +225,11 @@ StartSystemShutdown(
if (_InterlockedCompareExchange8((volatile char*)&g_ShutdownParams.bShuttingDown, TRUE, FALSE) == TRUE) if (_InterlockedCompareExchange8((volatile char*)&g_ShutdownParams.bShuttingDown, TRUE, FALSE) == TRUE)
return ERROR_SHUTDOWN_IN_PROGRESS; return ERROR_SHUTDOWN_IN_PROGRESS;
if (lpMessage && lpMessage->Length && lpMessage->Buffer) if (pMessage && pMessage->Length && pMessage->Buffer)
{ {
g_ShutdownParams.pszMessage = HeapAlloc(GetProcessHeap(), g_ShutdownParams.pszMessage = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
lpMessage->Length + sizeof(UNICODE_NULL)); pMessage->Length + sizeof(UNICODE_NULL));
if (g_ShutdownParams.pszMessage == NULL) if (g_ShutdownParams.pszMessage == NULL)
{ {
g_ShutdownParams.bShuttingDown = FALSE; g_ShutdownParams.bShuttingDown = FALSE;
@ -243,8 +237,8 @@ StartSystemShutdown(
} }
wcsncpy(g_ShutdownParams.pszMessage, wcsncpy(g_ShutdownParams.pszMessage,
lpMessage->Buffer, pMessage->Buffer,
lpMessage->Length / sizeof(WCHAR)); pMessage->Length / sizeof(WCHAR));
} }
else else
{ {
@ -256,7 +250,8 @@ StartSystemShutdown(
g_ShutdownParams.bRebootAfterShutdown = bRebootAfterShutdown; g_ShutdownParams.bRebootAfterShutdown = bRebootAfterShutdown;
g_ShutdownParams.dwReason = dwReason; g_ShutdownParams.dwReason = dwReason;
/* If dwTimeout is zero perform an immediate system shutdown, otherwise display the countdown shutdown dialog */ /* If dwTimeout is zero perform an immediate system shutdown,
* otherwise display the countdown shutdown dialog. */
if (g_ShutdownParams.dwTimeout == 0) if (g_ShutdownParams.dwTimeout == 0)
{ {
if (DoSystemShutdown(&g_ShutdownParams)) if (DoSystemShutdown(&g_ShutdownParams))
@ -264,7 +259,8 @@ StartSystemShutdown(
} }
else else
{ {
hThread = CreateThread(NULL, 0, InitiateSystemShutdownThread, (PVOID)&g_ShutdownParams, 0, NULL); hThread = CreateThread(NULL, 0, InitiateSystemShutdownThread,
&g_ShutdownParams, 0, NULL);
if (hThread) if (hThread)
{ {
CloseHandle(hThread); CloseHandle(hThread);

View file

@ -333,11 +333,11 @@ TerminateSystemShutdown(VOID);
DWORD DWORD
StartSystemShutdown( StartSystemShutdown(
PUNICODE_STRING lpMessage, IN PUNICODE_STRING pMessage,
ULONG dwTimeout, IN ULONG dwTimeout,
BOOLEAN bForceAppsClosed, IN BOOLEAN bForceAppsClosed,
BOOLEAN bRebootAfterShutdown, IN BOOLEAN bRebootAfterShutdown,
ULONG dwReason); IN ULONG dwReason);
/* winlogon.c */ /* winlogon.c */
BOOL BOOL