[USERSRV] Hard-error improvements 6/7

Make UserpFormatMessages() return the possible timeout for the hard error; use it when displaying the hard error message boxes.
This commit is contained in:
Hermès Bélusca-Maïto 2018-03-24 23:07:35 +01:00
parent 08d70697a3
commit 2363fee51f
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -346,6 +346,7 @@ UserpFormatMessages(
IN OUT PUNICODE_STRING TextStringU,
IN OUT PUNICODE_STRING CaptionStringU,
OUT PUINT pdwType,
OUT PULONG pdwTimeout,
IN PHARDERROR_MSG Message)
{
NTSTATUS Status;
@ -418,6 +419,12 @@ UserpFormatMessages(
CaptionStringU->Length = 0;
}
/* Set the timeout */
if (Message->NumberOfParameters >= 4)
*pdwTimeout = (ULONG)Parameters[3];
else
*pdwTimeout = INFINITE;
goto Quit;
}
@ -462,6 +469,9 @@ UserpFormatMessages(
*pdwType |= MB_SYSTEMMODAL | MB_SETFOREGROUND;
/* Set the timeout */
*pdwTimeout = INFINITE;
/* Copy the Parameters array locally */
RtlCopyMemory(&CopyParameters, Parameters, sizeof(CopyParameters));
@ -991,7 +1001,8 @@ UserServerHardError(
IN PHARDERROR_MSG Message)
{
ULONG ErrorMode;
UINT dwType = 0;
UINT dwType = 0;
ULONG Timeout = INFINITE;
UNICODE_STRING TextU, CaptionU;
WCHAR LocalTextBuffer[256];
WCHAR LocalCaptionBuffer[256];
@ -1029,7 +1040,7 @@ UserServerHardError(
/* Format the message caption and text */
RtlInitEmptyUnicodeString(&TextU, LocalTextBuffer, sizeof(LocalTextBuffer));
RtlInitEmptyUnicodeString(&CaptionU, LocalCaptionBuffer, sizeof(LocalCaptionBuffer));
UserpFormatMessages(&TextU, &CaptionU, &dwType, /* &Timeout, */ Message);
UserpFormatMessages(&TextU, &CaptionU, &dwType, &Timeout, Message);
/* Log the hard error message */
UserpLogHardError(&TextU, &CaptionU);
@ -1065,7 +1076,7 @@ UserServerHardError(
Message->Response = UserpMessageBox(TextU.Buffer,
CaptionU.Buffer,
dwType,
(ULONG)-1);
Timeout);
Quit:
/* Free the strings if they have been reallocated */