mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 21:11:54 +00:00
[WINLOGON] Fix shutdown timeout format string for long timeout
- Use the "%d days" format for timeouts longer than a day. - Fail if timeout is 10 years or longer. - TODO: Replace format strings by resources. German WinXP uses "%d days" instead of "%d Tage". We can do better! ;-)
This commit is contained in:
parent
3d66048b16
commit
3318d8d5be
1 changed files with 23 additions and 8 deletions
|
@ -16,6 +16,8 @@
|
|||
/* DEFINES *******************************************************************/
|
||||
|
||||
#define SHUTDOWN_TIMER_ID 2000
|
||||
#define SECONDS_PER_DAY 86400
|
||||
#define SECONDS_PER_DECADE 315360000
|
||||
|
||||
|
||||
/* STRUCTS *******************************************************************/
|
||||
|
@ -46,16 +48,25 @@ OnTimer(
|
|||
HWND hwndDlg,
|
||||
PSYS_SHUTDOWN_PARAMS pShutdownParams)
|
||||
{
|
||||
WCHAR szBuffer[10];
|
||||
INT iSeconds, iMinutes, iHours;
|
||||
WCHAR szBuffer[12];
|
||||
INT iSeconds, iMinutes, iHours, iDays;
|
||||
|
||||
iSeconds = (INT)pShutdownParams->dwTimeout;
|
||||
iHours = iSeconds / 3600;
|
||||
iSeconds -= iHours * 3600;
|
||||
iMinutes = iSeconds / 60;
|
||||
iSeconds -= iMinutes * 60;
|
||||
if (pShutdownParams->dwTimeout < SECONDS_PER_DAY)
|
||||
{
|
||||
iSeconds = (INT)pShutdownParams->dwTimeout;
|
||||
iHours = iSeconds / 3600;
|
||||
iSeconds -= iHours * 3600;
|
||||
iMinutes = iSeconds / 60;
|
||||
iSeconds -= iMinutes * 60;
|
||||
|
||||
swprintf(szBuffer, L"%02d:%02d:%02d", iHours, iMinutes, iSeconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
iDays = (INT)(pShutdownParams->dwTimeout / SECONDS_PER_DAY);
|
||||
swprintf(szBuffer, L"%d days", iDays);
|
||||
}
|
||||
|
||||
swprintf(szBuffer, L"%02d:%02d:%02d", iHours, iMinutes, iSeconds);
|
||||
SetDlgItemTextW(hwndDlg, IDC_SYSSHUTDOWNTIMELEFT, szBuffer);
|
||||
|
||||
if (pShutdownParams->dwTimeout == 0)
|
||||
|
@ -185,6 +196,10 @@ StartSystemShutdown(
|
|||
{
|
||||
HANDLE hThread;
|
||||
|
||||
/* Fail if the timeout is 10 years or more */
|
||||
if (dwTimeout >= SECONDS_PER_DECADE)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (_InterlockedCompareExchange8((volatile char*)&g_ShutdownParams.bShuttingDown, TRUE, FALSE) == TRUE)
|
||||
return ERROR_SHUTDOWN_IN_PROGRESS;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue